blob: 21028993f5daa419e8f25895e21dc4a44eebf978 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
# frozen_string_literal: true
class AddNotNullConstraintToOAuthAccessTokensExpiresIn < Gitlab::Database::Migration[2.1]
disable_ddl_transaction!
def up
# validate: false ensures that existing records are not affected
# https://docs.gitlab.com/ee/development/database/not_null_constraints.html#prevent-new-invalid-records-current-release
add_not_null_constraint :oauth_access_tokens, :expires_in, validate: false
change_column_default :oauth_access_tokens, :expires_in, 7200
end
def down
remove_not_null_constraint :oauth_access_tokens, :expires_in
change_column_default :oauth_access_tokens, :expires_in, nil
end
end
|