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.
|
2018-11-13 02:27:31 -05:00
|
|
|
class AddDeployments < ActiveRecord::Migration[4.2]
|
2016-06-10 17:36:54 -04:00
|
|
|
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
|
2016-06-15 08:05:10 -04:00
|
|
|
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
|
2016-06-15 08:05:26 -04:00
|
|
|
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
|