Heroku Drop Table Rails Help

后端 未结 3 1710
眼角桃花
眼角桃花 2021-02-06 07:07

I am using Ruby on Rails and I no longer need my table Order so I deleted it using SQLite manager.. How can I make the table deletion take place in heroku?

3条回答
  •  你的背包
    2021-02-06 07:43

    Just create a migration like this:

    def self.up
        drop_table :orders
    end
    
    def self.down
        # whatever you need to recreate the table or
        # raise IrreversibleMigration
        # if you want this to be irreversible.
    end
    

    and then do a heroku rake db:migrate the next time you push your changes.

    You might want to recreate the table in SQLite so that you can run this migration locally as well.

提交回复
热议问题