diff options
author | Imre Farkas <ifarkas@gitlab.com> | 2019-02-20 14:39:37 +0300 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2019-02-20 14:39:37 +0300 |
commit | 6d92a3d4e232d4137f66773c82f01c32d7474a21 (patch) | |
tree | b3fda377c51504a6d21da1742cac3de7fd668ef0 /db | |
parent | 83a23297bdeb5086ecc96d86b2e264dd3591022d (diff) |
Remove undigested token column from personal_access_tokens table
Token column are no longer used as token values are stored digested in
token_digest.
Diffstat (limited to 'db')
-rw-r--r-- | db/post_migrate/20181101091005_steal_digest_column.rb | 17 | ||||
-rw-r--r-- | db/post_migrate/20181101091124_remove_token_from_personal_access_tokens.rb | 11 | ||||
-rw-r--r-- | db/schema.rb | 2 |
3 files changed, 28 insertions, 2 deletions
diff --git a/db/post_migrate/20181101091005_steal_digest_column.rb b/db/post_migrate/20181101091005_steal_digest_column.rb new file mode 100644 index 00000000000..58ea710c18a --- /dev/null +++ b/db/post_migrate/20181101091005_steal_digest_column.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class StealDigestColumn < ActiveRecord::Migration[5.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + Gitlab::BackgroundMigration.steal('DigestColumn') + end + + def down + # raise ActiveRecord::IrreversibleMigration + end +end diff --git a/db/post_migrate/20181101091124_remove_token_from_personal_access_tokens.rb b/db/post_migrate/20181101091124_remove_token_from_personal_access_tokens.rb new file mode 100644 index 00000000000..415373068d5 --- /dev/null +++ b/db/post_migrate/20181101091124_remove_token_from_personal_access_tokens.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class RemoveTokenFromPersonalAccessTokens < ActiveRecord::Migration[5.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def change + remove_column :personal_access_tokens, :token, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 25a645562ec..1651a24f412 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1515,7 +1515,6 @@ ActiveRecord::Schema.define(version: 20190204115450) do create_table "personal_access_tokens", force: :cascade do |t| t.integer "user_id", null: false - t.string "token" t.string "name", null: false t.boolean "revoked", default: false t.date "expires_at" @@ -1524,7 +1523,6 @@ ActiveRecord::Schema.define(version: 20190204115450) do t.string "scopes", default: "--- []\n", null: false t.boolean "impersonation", default: false, null: false t.string "token_digest" - t.index ["token"], name: "index_personal_access_tokens_on_token", unique: true, using: :btree t.index ["token_digest"], name: "index_personal_access_tokens_on_token_digest", unique: true, using: :btree t.index ["user_id"], name: "index_personal_access_tokens_on_user_id", using: :btree end |