2018-11-13 07:27:31 +00:00
|
|
|
class CreateInternalIdsTable < ActiveRecord::Migration[4.2]
|
2018-03-06 19:09:01 +00:00
|
|
|
include Gitlab::Database::MigrationHelpers
|
|
|
|
|
|
|
|
DOWNTIME = false
|
|
|
|
|
2018-03-16 12:34:08 +00:00
|
|
|
def change
|
2018-03-12 17:12:38 +00:00
|
|
|
create_table :internal_ids, id: :bigserial do |t|
|
2018-03-14 12:42:24 +00:00
|
|
|
t.references :project, null: false, foreign_key: { on_delete: :cascade }
|
2018-03-06 19:09:01 +00:00
|
|
|
t.integer :usage, null: false
|
|
|
|
t.integer :last_value, null: false
|
|
|
|
|
2018-03-14 12:42:24 +00:00
|
|
|
t.index [:usage, :project_id], unique: true
|
2018-03-06 19:09:01 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|