This project is archived and is in readonly mode.

#4412 ✓resolved
phs

[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

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

Pages