Greetings fellow Railites, Last night I converted an existing Rails app to be Engines based. The transition was very easy, which was great, but I was left scratching my head with Engines' migration handling. After moving my db/migration folder to plugin/db/migration I did as suggested by the Engines README and ran `script/generate plugin_migration`. This created the expected migration with an upward migrate(8) and a downward migrate(0). That is my entire existing schema--I have 8 migrations. I wanted to test the migration handling of Engines so I issued `rake db:migrate VERSION=0` hoping to drop all my tables and then recreate them from scratch with an upward `rake db:migrate`. However, after issuing the downward migration I saw that, despite all 8 migrations having a drop table in the down method, Engines didn't drop any of my tables. It did, however, set the version to 0 in schema_info and plugin_schema_info. Am I incorrect in thinking that Engines will just call the down method in each migration of a plugin? Why were my tables not dropped? Thanks in advance for all replies.
on 2008-09-26 17:23
on 2008-09-29 06:26
Turns out that plugin_schema_info should be 8 and schema_info should be 1. After those values were correct the engines migrations worked as expected (tables dropped). I found out by manually deleting all the tables, setting plugin_schema_info and schema_info to 0, and running a fresh db:migrate.
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.