Skip to content

Longer allowed_event_timeslots_csv db field#724

Closed
manno wants to merge 2 commits intomasterfrom
fix-mysql-allowed_event_timeslots_csv-column
Closed

Longer allowed_event_timeslots_csv db field#724
manno wants to merge 2 commits intomasterfrom
fix-mysql-allowed_event_timeslots_csv-column

Conversation

@manno
Copy link
Member

@manno manno commented Sep 15, 2020

Fixes 'Mysql2::Error: Data too long for column'

@elad-eyal
Copy link
Collaborator

elad-eyal commented Sep 16, 2020

This edits #651

@manno
Copy link
Member Author

manno commented Sep 16, 2020

This edits #651

The migration from #651 will not work on mysql with existing data.

The data migration will raise an exception and leave the deployment in a broken state:
https://github.com/eladeyal-intel/frab/blob/144c777159517149598808fe3bfa2b36832bb78c/db/migrate/20191116151919_add_allowed_event_timeslots_to_conferences.rb#L6

In theory disabling strict mode (?) for the DB could help, but would create truncated CSVs.
I can't think of any other way to fix that, than to edit the original migration. Which should be fine, since the new migration would bring old systems to the same schema?

@elad-eyal
Copy link
Collaborator

Ahh I see. The problem is that the migration will fail in case an existing conference had too many [potential] options for populating allowed_event_timeslots_csv. I guess this workaround will do fine. I think you should also edit https://github.com/frab/frab/blob/master/db/schema.rb (by running.... rails db:schema:dump if I correctly recall )

@elad-eyal
Copy link
Collaborator

@elad-eyal
Copy link
Collaborator

I think :string is limited to 255 characters, which gives approx 80 options (i.e., 1,2,3,4,.....,85 is 243 characters). Aren't 80 options enough for every sane conference? i.e, if the slot duration is 1 minute it will let one specify events ranging from 1min to 1:20minutes; and if the slot duration is 5 minutes (which is more plausible) it will let one specify events ranging from 5min to 7h. This field only defines values which are available for submitter to specify which event length they're after. It does not affect events already submitted (or presented). So supporting more than 80 options is not such a good solution anyway.

I propose to change the migration code to add a special case, if conference.max_timeslots > 70, then the allowed allowed_event_timeslots_csv will be a sane default, i.e. = conference.default_timeslots. So the migration will be changing the UI only for conferences which are open for submissions and have more than 70 timeslots. This way we can keep the :string which I imagine is more performant.

@elad-eyal
Copy link
Collaborator

I thought about it some more and decided :text would be good enough. If we want to keep :string we'll need to add validations whenever editing the conference settings too.

@elad-eyal
Copy link
Collaborator

See #726

@elad-eyal
Copy link
Collaborator

In #726 I solved this issue, including fixing a failed mysql migration which may have left the DB in an non consistent state

@elad-eyal
Copy link
Collaborator

I merged #726 so this can be closed

@elad-eyal elad-eyal closed this Oct 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants