debian-mirror-gitlab/db/migrate/20200311093210_create_user_highest_roles.rb
2020-06-23 00:09:42 +05:30

27 lines
712 B
Ruby

# frozen_string_literal: true
class CreateUserHighestRoles < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
def up
with_lock_retries do
create_table :user_highest_roles, id: false do |t|
t.datetime_with_timezone :updated_at, null: false
t.references :user, primary_key: true, default: nil, index: false, foreign_key: { on_delete: :cascade }
t.integer :highest_access_level
t.index [:user_id, :highest_access_level]
end
end
end
def down
with_lock_retries do
# rubocop:disable Migration/DropTable
drop_table :user_highest_roles
# rubocop:enable Migration/DropTable
end
end
end