No sooner does someone add some notes to the wiki than do we get
support for migrations in Engines. If your Engine has a properly
-formed “db/migrate” folder, you can now use the provided “rake
engines_migrate” task to manage its tables in the database. Find this
code in the development branch of engines
I.E. Big Huge Warning In Flashing Lights.
PLEASE, PLEASE, PLEASE bear in mind that if you are letting someone
ELSE have a say in what tables you are using, you’re basically opening
your application schema open to potential HAVOC. I cannot stress how
serious this is. It is YOUR responsibility to ensure that you trust
the schema and migration information, and that it’s not going to drop
your whole database. You need to inspect these things. YOU do. If you
run these voodoo commands and your database essplodes because you
didn’t double double double check what was going on, your embarassment
will be infinite. And your project will be skroo’d if the migration
That said, if you are working in a team and you all trust each other,
which is hopefully true, this can be quite useful.
Also you might want to bear in mind if you’re using the development
branch, things might break. These changes will make it into the
‘trunk’ (what gets installed via the script/plugin command) once we’re
sure it doesn’t blow up the world or anything.
[Please note this is just an example - the login_engine doesn’t have
any migration information, yet.]
How to use
To migrate all engines to the latest version:
To migrate a single engine:
rake engines_migrate ENGINE=login (or login_engine)
To migrate a single engine to a specific revision:
rake engines_migrate ENGINE=login VERSION=4
rake engines_migrate VERSION=1
… will not work, because we felt it was too dangerous to allow ALL
engines to be migrated to a specific version, since such versions
might be incompatible.
Rather than polluting the schema_info table, Engines will create its
own version table to manage internal Engine versions. You can see the
task and the little tweaks to Migrations (they are tiny) in the
Let me know how it works - bug reports etc etc to the Trac site please!