2018-04-05 17:22:34 +00:00
|
|
|
class CreateProjectDeployTokens < ActiveRecord::Migration
|
|
|
|
DOWNTIME = false
|
|
|
|
|
2018-04-05 21:37:39 +00:00
|
|
|
def change
|
2018-04-05 17:22:34 +00:00
|
|
|
create_table :project_deploy_tokens do |t|
|
|
|
|
t.integer :project_id, null: false
|
|
|
|
t.integer :deploy_token_id, null: false
|
2018-04-06 14:30:21 +00:00
|
|
|
t.datetime_with_timezone :created_at, null: false
|
2018-04-05 17:22:34 +00:00
|
|
|
|
2018-04-05 21:37:39 +00: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 22:07:36 +00:00
|
|
|
t.index [:project_id, :deploy_token_id], unique: true
|
2018-04-05 17:22:34 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|