summaryrefslogtreecommitdiff
path: root/db/migrate/20160823083941_add_column_scopes_to_personal_access_tokens.rb
blob: 4c320123088d083f1d7a944a7919c601ddccda0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 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
# `[]`.

class AddColumnScopesToPersonalAccessTokens < ActiveRecord::Migration[4.2]
  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