Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
skip to migration version 1
  • my database and migrations are unsynced. I would like to delete the db, and start all over from migration 001.. Is there a way to do that?

    Or, 
    I think I'm in migration 024, and the database from the live server is in migration 015. If I could set the current migration to be 015, then it should be solved.. How can I do that?

    Thank you.
  • HarroHarro
    Accepted Answer
    There are two places in which migrations are tracked: the "migration" table, and the migration config file.

    The contents of the table is leading. If the table does not exist, or is empty, migrations will start with the first one.

    If there are entries in the table that are not in the config file, the config file is updated with the missing entries, those migrations will not run twice (you need this in clusters when databases are replicated).

    If the migrations in the config are ahead of the migrations in the table, then these entries are ignored.

    You can use "migrate:current" to run the missing migrations defined in the config. This is hardly used, but it allows you to migrate to a known level instead of simply run all migrations.

    For example, if you have 001 to 020, the table has up until 012, and the config has up to 016, "migrate" or "migrate:run" will migrate up to 020, while "migrate:current" will run migrations up to 016.
  • HarroHarro
    Accepted Answer
    To make the story complete: you can also migrate down to a specific version:

    oil refine migrate:down --version=1

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion