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