# Will Engines drop tables on downward migration?

**URL:** <https://www.ruby-forum.com/t/will-engines-drop-tables-on-downward-migration/149598>\
**Category:** Engines\
**Created:** [September 26, 2008, 5:23pm UTC](https://www.ruby-forum.com/t/will-engines-drop-tables-on-downward-migration/149598 "2008-09-26T17:23:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![yetanothergeek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/8e8cbc/32.png) [@yetanothergeek](https://www.ruby-forum.com/u/yetanothergeek)\
**Post date:** [September 26, 2008, 5:23pm UTC](https://www.ruby-forum.com/t/will-engines-drop-tables-on-downward-migration/149598/1 "2008-09-26T17:23:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![yetanothergeek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/8e8cbc/32.png) [@yetanothergeek](https://www.ruby-forum.com/u/yetanothergeek)\
**Post date:** [September 29, 2008, 6:26am UTC](https://www.ruby-forum.com/t/will-engines-drop-tables-on-downward-migration/149598/2 "2008-09-29T06:26:03Z")

</div>

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.
