Change migration to prevent down

This commit is contained in:
Robin Ward
2013-10-22 17:51:04 -04:00
parent e94a8cf62e
commit 6394d924c8
2 changed files with 8 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
class CreateApiKeys < ActiveRecord::Migration
def change
def up
create_table :api_keys do |t|
t.string :key, limit: 64, null: false
t.integer :user_id, null: true
@@ -13,4 +14,9 @@ class CreateApiKeys < ActiveRecord::Migration
execute "INSERT INTO api_keys (key, created_at, updated_at) SELECT value, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP FROM site_settings WHERE name = 'api_key'"
execute "DELETE FROM site_settings WHERE name = 'api_key'"
end
def down
raise ActiveRecord::IrreversibleMigration.new
end
end