rosa-build/db/migrate/20121219122905_add_encrypte...

23 lines
774 B
Ruby
Raw Normal View History

class AddEncryptedSecretToKeyPairs < ActiveRecord::Migration
def up
rename_table :key_pairs, :key_pairs_backup
2014-08-20 21:49:26 +01:00
# rename_index :key_pairs_backup, 'index_key_pairs_on_repository_id', 'index_key_pairs_backup_on_repository_id'
create_table :key_pairs do |t|
2014-01-21 04:51:49 +00:00
t.text :public, null: false
t.text :encrypted_secret, null: false
2014-08-20 21:49:26 +01:00
t.string :key_id, null: false, references: nil
2014-01-21 04:51:49 +00:00
t.references :user, null: false
t.references :repository, null: false
t.timestamps
end
2014-01-21 04:51:49 +00:00
add_index :key_pairs, :repository_id, unique: true
end
def down
drop_table :key_pairs
rename_table :key_pairs_backup, :key_pairs
2014-08-20 21:49:26 +01:00
# rename_index :key_pairs, 'index_key_pairs_backup_on_repository_id', 'index_key_pairs_on_repository_id'
end
end