Commit 5fc0322d authored by Rubén Dávila's avatar Rubén Dávila

Add ON DELETE constraint to namespace_id FK on gitlab_subscriptions

parent 547b8ad2
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20181212104941) do ActiveRecord::Schema.define(version: 20181215161939) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
...@@ -3260,7 +3260,7 @@ ActiveRecord::Schema.define(version: 20181212104941) do ...@@ -3260,7 +3260,7 @@ ActiveRecord::Schema.define(version: 20181212104941) do
add_foreign_key "geo_repository_renamed_events", "projects", on_delete: :cascade add_foreign_key "geo_repository_renamed_events", "projects", on_delete: :cascade
add_foreign_key "geo_repository_updated_events", "projects", on_delete: :cascade add_foreign_key "geo_repository_updated_events", "projects", on_delete: :cascade
add_foreign_key "geo_reset_checksum_events", "projects", on_delete: :cascade add_foreign_key "geo_reset_checksum_events", "projects", on_delete: :cascade
add_foreign_key "gitlab_subscriptions", "namespaces" add_foreign_key "gitlab_subscriptions", "namespaces", name: "fk_e2595d00a1", on_delete: :cascade
add_foreign_key "gitlab_subscriptions", "plans", column: "hosted_plan_id", name: "fk_bd0c4019c3", on_delete: :cascade add_foreign_key "gitlab_subscriptions", "plans", column: "hosted_plan_id", name: "fk_bd0c4019c3", on_delete: :cascade
add_foreign_key "gpg_key_subkeys", "gpg_keys", on_delete: :cascade add_foreign_key "gpg_key_subkeys", "gpg_keys", on_delete: :cascade
add_foreign_key "gpg_keys", "users", on_delete: :cascade add_foreign_key "gpg_keys", "users", on_delete: :cascade
......
# frozen_string_literal: true
class AddOnDeleteCascadeToNamespaceIdFkOnGitlabSubscriptions < ActiveRecord::Migration[5.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
remove_foreign_key(:gitlab_subscriptions, column: :namespace_id)
add_concurrent_foreign_key(:gitlab_subscriptions, :namespaces, column: :namespace_id)
end
def down
# Previously there was a foreign key without a CASCADING DELETE, so we'll
# just leave the foreign key in place.
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment