Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-06-21 21:07:25 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-06-21 21:07:25 +0300
commit4edcf8309b127c0baf6aab6a2f7e6e1c36b57759 (patch)
tree7edd0cab19b5e7c22f457f6a50767df43633c2e3 /db
parentc39e93b52ed569635a9ae178115f77ae563b3332 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r--db/docs/deleted_tables/u2f_registrations.yml (renamed from db/docs/u2f_registrations.yml)2
-rw-r--r--db/post_migrate/20230314094213_remove_foreign_keys_from_u2f_registrations_table.rb15
-rw-r--r--db/post_migrate/20230314094215_drop_u2f_registrations_table.rb23
-rw-r--r--db/post_migrate/20230615121103_replace_p_ci_builds_metadata_foreign_key_v3.rb37
-rw-r--r--db/post_migrate/20230615121122_replace_p_ci_runner_machine_builds_foreign_key_v3.rb37
-rw-r--r--db/schema_migrations/202303140942131
-rw-r--r--db/schema_migrations/202303140942151
-rw-r--r--db/schema_migrations/202306151211031
-rw-r--r--db/schema_migrations/202306151211221
-rw-r--r--db/structure.sql40
10 files changed, 123 insertions, 35 deletions
diff --git a/db/docs/u2f_registrations.yml b/db/docs/deleted_tables/u2f_registrations.yml
index b1aaa8148bd..a41f0f092b7 100644
--- a/db/docs/u2f_registrations.yml
+++ b/db/docs/deleted_tables/u2f_registrations.yml
@@ -7,4 +7,6 @@ feature_categories:
description: TODO
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/791cc9138be6ea1783e3c3853370cf0290f4d41e
milestone: '8.9'
+removed_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/114576
+removed_in_milestone: '16.1'
gitlab_schema: gitlab_main
diff --git a/db/post_migrate/20230314094213_remove_foreign_keys_from_u2f_registrations_table.rb b/db/post_migrate/20230314094213_remove_foreign_keys_from_u2f_registrations_table.rb
new file mode 100644
index 00000000000..d6185d6674d
--- /dev/null
+++ b/db/post_migrate/20230314094213_remove_foreign_keys_from_u2f_registrations_table.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class RemoveForeignKeysFromU2fRegistrationsTable < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ def up
+ with_lock_retries do
+ remove_foreign_key :u2f_registrations, :users
+ end
+ end
+
+ def down
+ add_concurrent_foreign_key :u2f_registrations, :users, column: :user_id
+ end
+end
diff --git a/db/post_migrate/20230314094215_drop_u2f_registrations_table.rb b/db/post_migrate/20230314094215_drop_u2f_registrations_table.rb
new file mode 100644
index 00000000000..9a57c424592
--- /dev/null
+++ b/db/post_migrate/20230314094215_drop_u2f_registrations_table.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+class DropU2fRegistrationsTable < Gitlab::Database::Migration[2.1]
+ enable_lock_retries!
+
+ def up
+ drop_table :u2f_registrations
+ end
+
+ def down
+ create_table :u2f_registrations do |t| # rubocop: disable Migration/SchemaAdditionMethodsNoPost
+ t.text :certificate
+ t.string :key_handle
+ t.string :public_key
+ t.integer :counter
+ t.references :user, foreign_key: false
+ t.datetime_with_timezone :created_at, null: false
+ t.datetime_with_timezone :updated_at, null: false
+ t.string :name
+ t.index [:key_handle], name: 'index_u2f_registrations_on_key_handle'
+ end
+ end
+end
diff --git a/db/post_migrate/20230615121103_replace_p_ci_builds_metadata_foreign_key_v3.rb b/db/post_migrate/20230615121103_replace_p_ci_builds_metadata_foreign_key_v3.rb
new file mode 100644
index 00000000000..dca891fc064
--- /dev/null
+++ b/db/post_migrate/20230615121103_replace_p_ci_builds_metadata_foreign_key_v3.rb
@@ -0,0 +1,37 @@
+# frozen_string_literal: true
+
+class ReplacePCiBuildsMetadataForeignKeyV3 < Gitlab::Database::Migration[2.1]
+ include Gitlab::Database::PartitioningMigrationHelpers
+ include Gitlab::Database::MigrationHelpers::WraparoundAutovacuum
+
+ disable_ddl_transaction!
+
+ def up
+ return unless should_run?
+
+ add_concurrent_partitioned_foreign_key :p_ci_builds_metadata, :p_ci_builds,
+ name: :temp_fk_e20479742e_p,
+ column: [:partition_id, :build_id],
+ target_column: [:partition_id, :id],
+ on_update: :cascade,
+ on_delete: :cascade,
+ validate: true,
+ reverse_lock_order: true
+ end
+
+ def down
+ return unless should_run?
+
+ with_lock_retries do
+ remove_foreign_key_if_exists :p_ci_builds_metadata, :p_ci_builds,
+ name: :temp_fk_e20479742e_p,
+ reverse_lock_order: true
+ end
+ end
+
+ private
+
+ def should_run?
+ can_execute_on?(:ci_builds_metadata, :ci_builds)
+ end
+end
diff --git a/db/post_migrate/20230615121122_replace_p_ci_runner_machine_builds_foreign_key_v3.rb b/db/post_migrate/20230615121122_replace_p_ci_runner_machine_builds_foreign_key_v3.rb
new file mode 100644
index 00000000000..854d7358e5e
--- /dev/null
+++ b/db/post_migrate/20230615121122_replace_p_ci_runner_machine_builds_foreign_key_v3.rb
@@ -0,0 +1,37 @@
+# frozen_string_literal: true
+
+class ReplacePCiRunnerMachineBuildsForeignKeyV3 < Gitlab::Database::Migration[2.1]
+ include Gitlab::Database::PartitioningMigrationHelpers
+ include Gitlab::Database::MigrationHelpers::WraparoundAutovacuum
+
+ disable_ddl_transaction!
+
+ def up
+ return unless should_run?
+
+ add_concurrent_partitioned_foreign_key :p_ci_runner_machine_builds, :p_ci_builds,
+ name: :temp_fk_bb490f12fe_p,
+ column: [:partition_id, :build_id],
+ target_column: [:partition_id, :id],
+ on_update: :cascade,
+ on_delete: :cascade,
+ validate: true,
+ reverse_lock_order: true
+ end
+
+ def down
+ return unless should_run?
+
+ with_lock_retries do
+ remove_foreign_key_if_exists :p_ci_runner_machine_builds, :p_ci_builds,
+ name: :temp_fk_bb490f12fe_p,
+ reverse_lock_order: true
+ end
+ end
+
+ private
+
+ def should_run?
+ can_execute_on?(:ci_builds)
+ end
+end
diff --git a/db/schema_migrations/20230314094213 b/db/schema_migrations/20230314094213
new file mode 100644
index 00000000000..e2741f5ea30
--- /dev/null
+++ b/db/schema_migrations/20230314094213
@@ -0,0 +1 @@
+ccf7548dc1916a60da14f9545039d7ac3666e44e96ccd59c0f6db4117b15515a \ No newline at end of file
diff --git a/db/schema_migrations/20230314094215 b/db/schema_migrations/20230314094215
new file mode 100644
index 00000000000..a030527fac4
--- /dev/null
+++ b/db/schema_migrations/20230314094215
@@ -0,0 +1 @@
+5549548b53710624294aed31af6ed8aeb26263e538d2e2d7eac254a5c105d08a \ No newline at end of file
diff --git a/db/schema_migrations/20230615121103 b/db/schema_migrations/20230615121103
new file mode 100644
index 00000000000..9c77e1512c1
--- /dev/null
+++ b/db/schema_migrations/20230615121103
@@ -0,0 +1 @@
+37634ac8f82ed0fa043036b1aab2dffbd7a4f9a2fc51f18d53511f8a834eb312 \ No newline at end of file
diff --git a/db/schema_migrations/20230615121122 b/db/schema_migrations/20230615121122
new file mode 100644
index 00000000000..0704b5d0c8d
--- /dev/null
+++ b/db/schema_migrations/20230615121122
@@ -0,0 +1 @@
+7014d18db20d925d1bc41b4104b1ce57f2033f7c8debed8fd31e6afbba8efd78 \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index 34927b960c3..ebd2c9a0424 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -23330,27 +23330,6 @@ CREATE SEQUENCE trending_projects_id_seq
ALTER SEQUENCE trending_projects_id_seq OWNED BY trending_projects.id;
-CREATE TABLE u2f_registrations (
- id integer NOT NULL,
- certificate text,
- key_handle character varying,
- public_key character varying,
- counter integer,
- user_id integer,
- created_at timestamp without time zone NOT NULL,
- updated_at timestamp without time zone NOT NULL,
- name character varying
-);
-
-CREATE SEQUENCE u2f_registrations_id_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
-
-ALTER SEQUENCE u2f_registrations_id_seq OWNED BY u2f_registrations.id;
-
CREATE TABLE upcoming_reconciliations (
id bigint NOT NULL,
namespace_id bigint,
@@ -25882,8 +25861,6 @@ ALTER TABLE ONLY topics ALTER COLUMN id SET DEFAULT nextval('topics_id_seq'::reg
ALTER TABLE ONLY trending_projects ALTER COLUMN id SET DEFAULT nextval('trending_projects_id_seq'::regclass);
-ALTER TABLE ONLY u2f_registrations ALTER COLUMN id SET DEFAULT nextval('u2f_registrations_id_seq'::regclass);
-
ALTER TABLE ONLY upcoming_reconciliations ALTER COLUMN id SET DEFAULT nextval('upcoming_reconciliations_id_seq'::regclass);
ALTER TABLE ONLY upload_states ALTER COLUMN upload_id SET DEFAULT nextval('upload_states_upload_id_seq'::regclass);
@@ -28384,9 +28361,6 @@ ALTER TABLE ONLY topics
ALTER TABLE ONLY trending_projects
ADD CONSTRAINT trending_projects_pkey PRIMARY KEY (id);
-ALTER TABLE ONLY u2f_registrations
- ADD CONSTRAINT u2f_registrations_pkey PRIMARY KEY (id);
-
ALTER TABLE ONLY upcoming_reconciliations
ADD CONSTRAINT upcoming_reconciliations_pkey PRIMARY KEY (id);
@@ -32992,10 +32966,6 @@ CREATE INDEX index_topics_total_projects_count ON topics USING btree (total_proj
CREATE UNIQUE INDEX index_trending_projects_on_project_id ON trending_projects USING btree (project_id);
-CREATE INDEX index_u2f_registrations_on_key_handle ON u2f_registrations USING btree (key_handle);
-
-CREATE INDEX index_u2f_registrations_on_user_id ON u2f_registrations USING btree (user_id);
-
CREATE UNIQUE INDEX index_uniq_ci_runners_on_token ON ci_runners USING btree (token);
CREATE UNIQUE INDEX index_uniq_ci_runners_on_token_encrypted ON ci_runners USING btree (token_encrypted);
@@ -37951,9 +37921,6 @@ ALTER TABLE ONLY timelogs
ALTER TABLE ONLY timelogs
ADD CONSTRAINT fk_timelogs_note_id FOREIGN KEY (note_id) REFERENCES notes(id) ON DELETE SET NULL;
-ALTER TABLE ONLY u2f_registrations
- ADD CONSTRAINT fk_u2f_registrations_user_id FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
-
ALTER TABLE issue_search_data
ADD CONSTRAINT issue_search_data_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;
@@ -37963,8 +37930,11 @@ ALTER TABLE issue_search_data
ALTER TABLE product_analytics_events_experimental
ADD CONSTRAINT product_analytics_events_experimental_project_id_fkey FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
-ALTER TABLE ONLY ci_builds_metadata
- ADD CONSTRAINT temp_fk_e20479742e_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE NOT VALID;
+ALTER TABLE p_ci_runner_machine_builds
+ ADD CONSTRAINT temp_fk_bb490f12fe_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;
+
+ALTER TABLE p_ci_builds_metadata
+ ADD CONSTRAINT temp_fk_e20479742e_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE ONLY user_follow_users
ADD CONSTRAINT user_follow_users_followee_id_fkey FOREIGN KEY (followee_id) REFERENCES users(id) ON DELETE CASCADE;