gitlab-org--gitlab-foss/db/migrate/20160610204157_add_deployme...

27 lines
964 B
Ruby
Raw Normal View History

2016-06-10 21:36:54 +00:00
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class AddDeployments < ActiveRecord::Migration[4.2]
2016-06-10 21:36:54 +00:00
include Gitlab::Database::MigrationHelpers
def change
create_table :deployments, force: true do |t|
2016-06-15 10:03:49 +00:00
t.integer :iid, null: false
t.integer :project_id, null: false
t.integer :environment_id, null: false
2016-06-15 10:03:49 +00:00
t.string :ref, null: false
t.boolean :tag, null: false
t.string :sha, null: false
2016-06-10 21:36:54 +00:00
t.integer :user_id
2016-06-14 11:51:12 +00:00
t.integer :deployable_id
t.string :deployable_type
2016-06-10 21:36:54 +00: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 21:36:54 +00:00
add_index :deployments, [:project_id, :environment_id]
add_index :deployments, [:project_id, :environment_id, :iid]
end
end