Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

db:migrate:down does not remove migration version from schema_migrations table

#369

When running rake db:migrate:down VERSION=someversion, them someversion is not removed from the contents of the schema_migrations table. So when rake db:migrate is run, someversion will not be reapplied any more.

The workaround is to manually remove the version from schema_migrations.

Here's a complete moron's guide how to reproduce the problem:

http://dpaste.com/55427/

Reported by RaceCondition · June 8th, 2008 @ 09:27 AM

State: resolved
Milestone: 2.1.1
Assigned to: Jeremy Kemper Jeremy Kemper
Importance: Low

Activity

  1. Jeremy Kemper
    Jeremy Kemper
    • Milestone set to 2.1.1

    June 8th, 2008 @ 09:28 AM

  2. RaceCondition
    RaceCondition

    Forgot to mention that I have verified this bug with both MySQL 5 and SQLite.

    June 8th, 2008 @ 09:37 AM

  3. Michael Raidel
    Michael Raidel

    "rake db:migrate:down" runs "ActiveRecord::Migrator.run(:down,...)" This in turn calls the #run instance method on a new Migrator instance and this method doesn't record its state in the schema_migrations-table. There is even one test which makes it look like this is the wanted behaviour, so I am not completely sure if I am going in the right direction. I have attached a patch which also adds two tests for the up and down-method and removes the test_migrator_run-test which seems to assume this is the right behaviour.

    June 13th, 2008 @ 03:33 PM

  4. Jeremy Kemper
    Jeremy Kemper
    • State changed from new to open
    • Assigned user set to Jeremy Kemper

    June 16th, 2008 @ 12:26 PM

  5. Repository
    Repository
    • State changed from open to resolved

    (from [7839a83227d0d7cb193f0599afc03829d4643a64]) ActiveRecord::Migrator#run records version-state after migrating. [#369 state:resolved]

    http://github.com/rails/rails/co...

    June 23rd, 2008 @ 02:17 AM