2012-12-19 18:18:00 +00:00
|
|
|
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'
|
2012-12-19 18:18:00 +00:00
|
|
|
|
|
|
|
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
|
2012-12-19 18:18:00 +00:00
|
|
|
t.timestamps
|
|
|
|
end
|
2014-01-21 04:51:49 +00:00
|
|
|
add_index :key_pairs, :repository_id, unique: true
|
2012-12-19 18:18:00 +00:00
|
|
|
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'
|
2012-12-19 18:18:00 +00:00
|
|
|
end
|
|
|
|
end
|