20180405142733_create_project_deploy_tokens.rb 520 Bytes
Newer Older
1
class CreateProjectDeployTokens < ActiveRecord::Migration[4.2]
2 3
  DOWNTIME = false

4
  def change
5 6 7
    create_table :project_deploy_tokens do |t|
      t.integer :project_id, null: false
      t.integer :deploy_token_id, null: false
8
      t.datetime_with_timezone :created_at, null: false
9

10 11 12
      t.foreign_key :deploy_tokens, column: :deploy_token_id, on_delete: :cascade
      t.foreign_key :projects, column: :project_id, on_delete: :cascade

13
      t.index [:project_id, :deploy_token_id], unique: true
14 15 16
    end
  end
end