Search code examples
ruby-on-railspostgresqlrails-migrations

What's the best practice for changing migration timestamp so that it changes the order a migration is run in rails?


I'm trying to perform some migrations, but the code stops when it encounters an hstore extension. My AddHstoreExtension migration file is currently the last migration in order of timestamps. Should I change the timestamp to get it to run first? What's best practice?


Solution

  • The prefix of the file name is whats used to determine order, not the timestamp on the file itself just so you know, but yes that would work.

    Remember you can:

    rails db:rollback <number of migrations>
    

    To undo any you've applied.