简体   繁体   中英

Rails with postgres, recreating a table after it was dropped

I ran this command to drop one of my tables and it worked fine.

DROP TABLE gallery_images;

Now I want to recreate that table, and running a rake:db migrate isn't doing anything. What needs to be done to recreate it? Here's what the migration file looks like.

class CreateGalleryImages < ActiveRecord::Migration
  def change
    create_table :gallery_images do |t|
      t.string :url
      t.string :source
      t.string :thumb
      t.string :large
      t.string :original
      t.string :link

      t.timestamps
    end
  end
end

Just delete the row in the schema_migrations table with the same timestamp as the timestamp in the migration's filename. Then run rake db:migrate again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM