2016-11-24 07:37:22 +00:00
|
|
|
# The default needs to be `[]`, but all existing access tokens need to have `scopes` set to `['api']`.
|
|
|
|
# It's easier to achieve this by adding the column with the `['api']` default, and then changing the default to
|
|
|
|
# `[]`.
|
2016-11-22 08:53:53 +00:00
|
|
|
|
2018-11-13 07:27:31 +00:00
|
|
|
class AddColumnScopesToPersonalAccessTokens < ActiveRecord::Migration[4.2]
|
2016-11-22 08:53:53 +00:00
|
|
|
include Gitlab::Database::MigrationHelpers
|
|
|
|
|
|
|
|
DOWNTIME = false
|
|
|
|
|
|
|
|
disable_ddl_transaction!
|
|
|
|
|
|
|
|
def up
|
|
|
|
add_column_with_default :personal_access_tokens, :scopes, :string, default: ['api'].to_yaml
|
|
|
|
end
|
|
|
|
|
|
|
|
def down
|
|
|
|
remove_column :personal_access_tokens, :scopes
|
|
|
|
end
|
|
|
|
end
|