diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-30 09:10:03 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-30 09:10:03 +0300 |
commit | 27b43bd4d613cc7b8773ca0863b8d8f9b90f6d87 (patch) | |
tree | 8bc7959282786fd8acce856cfa75ad36fda5f020 /db | |
parent | 6b8e9712617b97b2586c90fe7855aa38e0987831 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r-- | db/post_migrate/20200424043515_drop_namespaces_plan_id.rb | 26 | ||||
-rw-r--r-- | db/structure.sql | 7 |
2 files changed, 27 insertions, 6 deletions
diff --git a/db/post_migrate/20200424043515_drop_namespaces_plan_id.rb b/db/post_migrate/20200424043515_drop_namespaces_plan_id.rb new file mode 100644 index 00000000000..53ce13cc699 --- /dev/null +++ b/db/post_migrate/20200424043515_drop_namespaces_plan_id.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +class DropNamespacesPlanId < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + with_lock_retries do # rubocop: disable Migration/WithLockRetriesWithoutDdlTransaction + remove_column :namespaces, :plan_id + end + end + + def down + unless column_exists?(:namespaces, :plan_id) + with_lock_retries do # rubocop: disable Migration/WithLockRetriesWithoutDdlTransaction + add_column :namespaces, :plan_id, :integer + end + end + + add_concurrent_index :namespaces, :plan_id + add_concurrent_foreign_key :namespaces, :plans, column: :plan_id, on_delete: :nullify + end +end diff --git a/db/structure.sql b/db/structure.sql index cb7c96aeee8..c0a222b61df 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -4141,7 +4141,6 @@ CREATE TABLE public.namespaces ( require_two_factor_authentication boolean DEFAULT false NOT NULL, two_factor_grace_period integer DEFAULT 48 NOT NULL, cached_markdown_version integer, - plan_id integer, project_creation_level integer, runners_token character varying, trial_ends_on timestamp with time zone, @@ -9950,8 +9949,6 @@ CREATE INDEX index_namespaces_on_path ON public.namespaces USING btree (path); CREATE INDEX index_namespaces_on_path_trigram ON public.namespaces USING gin (path public.gin_trgm_ops); -CREATE INDEX index_namespaces_on_plan_id ON public.namespaces USING btree (plan_id); - CREATE UNIQUE INDEX index_namespaces_on_push_rule_id ON public.namespaces USING btree (push_rule_id); CREATE INDEX index_namespaces_on_require_two_factor_authentication ON public.namespaces USING btree (require_two_factor_authentication); @@ -11395,9 +11392,6 @@ ALTER TABLE ONLY public.system_note_metadata ALTER TABLE ONLY public.merge_requests ADD CONSTRAINT fk_fd82eae0b9 FOREIGN KEY (head_pipeline_id) REFERENCES public.ci_pipelines(id) ON DELETE SET NULL; -ALTER TABLE ONLY public.namespaces - ADD CONSTRAINT fk_fdd12e5b80 FOREIGN KEY (plan_id) REFERENCES public.plans(id) ON DELETE SET NULL; - ALTER TABLE ONLY public.project_import_data ADD CONSTRAINT fk_ffb9ee3a10 FOREIGN KEY (project_id) REFERENCES public.projects(id) ON DELETE CASCADE; @@ -13629,6 +13623,7 @@ COPY "schema_migrations" (version) FROM STDIN; 20200423081441 20200423081519 20200423101529 +20200424043515 20200424050250 20200424101920 20200427064130 |