diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-03 09:08:16 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-03 09:08:16 +0300 |
commit | 2cfa1fc75dd4bd6d1f70d5fee1a824410694f297 (patch) | |
tree | c312945cb6f7b7e897c6d168f3640c5d1cbddca7 /db | |
parent | daa5663fbe5d9fe8702e94273877f68b411121f8 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20191227140254_update_personal_access_tokens_user_id_foreign_key.rb | 20 | ||||
-rw-r--r-- | db/schema.rb | 2 |
2 files changed, 21 insertions, 1 deletions
diff --git a/db/migrate/20191227140254_update_personal_access_tokens_user_id_foreign_key.rb b/db/migrate/20191227140254_update_personal_access_tokens_user_id_foreign_key.rb new file mode 100644 index 00000000000..fbf17b28274 --- /dev/null +++ b/db/migrate/20191227140254_update_personal_access_tokens_user_id_foreign_key.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class UpdatePersonalAccessTokensUserIdForeignKey < ActiveRecord::Migration[5.2] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + CONSTRAINT_NAME = 'fk_personal_access_tokens_user_id' + + disable_ddl_transaction! + + def up + add_concurrent_foreign_key(:personal_access_tokens, :users, column: :user_id, on_delete: :cascade, name: CONSTRAINT_NAME) + remove_foreign_key_if_exists(:personal_access_tokens, column: :user_id, on_delete: nil) + end + + def down + add_concurrent_foreign_key(:personal_access_tokens, :users, column: :user_id, on_delete: nil) + remove_foreign_key_if_exists(:personal_access_tokens, column: :user_id, on_delete: :cascade, name: CONSTRAINT_NAME) + end +end diff --git a/db/schema.rb b/db/schema.rb index 2f9c5fa8f5a..5a877870e6c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -4687,7 +4687,7 @@ ActiveRecord::Schema.define(version: 2019_12_29_140154) do add_foreign_key "pages_domains", "projects", name: "fk_ea2f6dfc6f", on_delete: :cascade add_foreign_key "path_locks", "projects", name: "fk_5265c98f24", on_delete: :cascade add_foreign_key "path_locks", "users" - add_foreign_key "personal_access_tokens", "users" + add_foreign_key "personal_access_tokens", "users", name: "fk_personal_access_tokens_user_id", on_delete: :cascade add_foreign_key "plan_limits", "plans", on_delete: :cascade add_foreign_key "pool_repositories", "projects", column: "source_project_id", on_delete: :nullify add_foreign_key "pool_repositories", "shards", on_delete: :restrict |