This project is archived and is in readonly mode.
[PATCH] Timestamped migrations should detect collisions
Reported by phs | April 16th, 2010 @ 03:54 AM
The timestamp in timestamped migrations does not account for other migrations sharing the same timestamp. The corner case was previously pathological.
One reasonable use case is @James Adam 's suggestion for engine migrations in #2058. Briefly, engine migrations are copied into the host app. They are re-indexed at the same time, preserving their relative order while letting the host application keep a single, linear schema history.
This copy & re-index can add many migrations to an application at once, which ActiveRecord::Generators::Base.next_migration_number will naively timestamp to the same second.
One solution is to have next_migration_number push the returned timestamp 1 second into the future until there's no collision. I'll see if I can brew up a patch.
Comments and changes to this ticket
-
phs April 16th, 2010 @ 06:38 AM
The patch. Timestamp migration numbers are [current timestamp, current_migration_number + 1].max
-
phs April 16th, 2010 @ 06:39 AM
- Title changed from Timestamped migrations should detect collisions to [PATCH] Timestamped migrations should detect collisions
-
Repository April 19th, 2010 @ 03:52 AM
- State changed from new to resolved
(from [64373937a393518a6e6a63255176ca297d3c009e]) Make the migration generator handle pre-existing migrations with the same timestamp.
In the event a migration already exists with that number, the new migration's timestamp will be incremented by 1.
[#4412 state:resolved]
Signed-off-by: Michael Koziarski michael@koziarski.com
http://github.com/rails/rails/commit/64373937a393518a6e6a63255176ca...
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Referenced by
- 4412 [PATCH] Timestamped migrations should detect collisions [#4412 state:resolved]