2018-11-13 02:27:31 -05:00
|
|
|
class CreateProjectDeployTokens < ActiveRecord::Migration[4.2]
|
2018-04-05 13:22:34 -04:00
|
|
|
DOWNTIME = false
|
|
|
|
|
2018-04-05 17:37:39 -04:00
|
|
|
def change
|
2018-04-05 13:22:34 -04:00
|
|
|
create_table :project_deploy_tokens do |t|
|
|
|
|
t.integer :project_id, null: false
|
|
|
|
t.integer :deploy_token_id, null: false
|
2018-04-06 10:30:21 -04:00
|
|
|
t.datetime_with_timezone :created_at, null: false
|
2018-04-05 13:22:34 -04:00
|
|
|
|
2018-04-05 17:37:39 -04:00
|
|
|
t.foreign_key :deploy_tokens, column: :deploy_token_id, on_delete: :cascade
|
|
|
|
t.foreign_key :projects, column: :project_id, on_delete: :cascade
|
|
|
|
|
2018-04-05 18:07:36 -04:00
|
|
|
t.index [:project_id, :deploy_token_id], unique: true
|
2018-04-05 13:22:34 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|