gitlab-org--gitlab-foss/db/migrate/20160610204157_add_deployments.rb

29 lines
997 B
Ruby
Raw Normal View History

2016-06-10 17:36:54 -04:00
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
# rubocop:disable Migration/Datetime
2016-06-10 17:36:54 -04:00
class AddDeployments < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
def change
create_table :deployments, force: true do |t|
2016-06-15 06:03:49 -04:00
t.integer :iid, null: false
t.integer :project_id, null: false
t.integer :environment_id, null: false
2016-06-15 06:03:49 -04:00
t.string :ref, null: false
t.boolean :tag, null: false
t.string :sha, null: false
2016-06-10 17:36:54 -04:00
t.integer :user_id
2016-06-14 07:51:12 -04:00
t.integer :deployable_id
t.string :deployable_type
2016-06-10 17:36:54 -04:00
t.datetime :created_at
t.datetime :updated_at
end
add_index :deployments, :project_id
add_index :deployments, [:project_id, :iid], unique: true
2016-06-10 17:36:54 -04:00
add_index :deployments, [:project_id, :environment_id]
add_index :deployments, [:project_id, :environment_id, :iid]
end
end