Unintuitive migration order when extra digits in timestamp #2284
vizvamitra
started this conversation in
General
Replies: 1 comment
-
By design, Sequel does not enforce a particular timestamp pattern. There is no possibility of doing so by default without breaking existing applications. I would be open to a new feature so that users could specify the expected version format via an option, and Sequel would raise an exception if there was a migration file present that did not use that format. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
In our company we're using ROM.rb. Several months ago we’ve created a migration with an extra digit in it’s timestamp. Not a big deal for prod, so we haven’t noticed it for 4 months. But recently I added another migration that changes the same stuff, and
rake db:drop db:create db:migrate
started failing. After some investigation, I've found out thatSequel::TimestampMigrator
that ROM uses under the hood applies migrations with extra digit in the timestamp after all the rest.I’m not sure if it is a bug or not, but it’s definitely an unintuitive behavior that may cause issues. It is not hard at all to name one or two migrations incorrectly throughout the project lifespan. Our project is 6 years old and we had 3 actually.
So, I though that maybe Sequel could help users to stick to the timestamp format somehow? For example,
TimestampMigrator
could produce a warning when it notices a timestamp that is neither a date, date and time or Unix epoch integer. Or maybe even support a configuration option to enforce a particular formatYou can reproduce this behavior with the following files:
Beta Was this translation helpful? Give feedback.
All reactions