diff options
Diffstat (limited to 'db')
8 files changed, 107 insertions, 8 deletions
diff --git a/db/docs/p_ci_pipeline_variables.yml b/db/docs/p_ci_pipeline_variables.yml new file mode 100644 index 00000000000..38dbf96ac94 --- /dev/null +++ b/db/docs/p_ci_pipeline_variables.yml @@ -0,0 +1,10 @@ +--- +table_name: p_ci_pipeline_variables +classes: +- Ci::PipelineVariable +feature_categories: +- continuous_integration +description: Routing table for ci_pipeline_variables +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/141270 +milestone: '16.9' +gitlab_schema: gitlab_ci diff --git a/db/migrate/20240110092610_add_index_on_project_id_to_web_hooks.rb b/db/migrate/20240110092610_add_index_on_project_id_to_web_hooks.rb new file mode 100644 index 00000000000..95c64caa1ce --- /dev/null +++ b/db/migrate/20240110092610_add_index_on_project_id_to_web_hooks.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddIndexOnProjectIdToWebHooks < Gitlab::Database::Migration[2.2] + disable_ddl_transaction! + + milestone '16.9' + + TABLE_NAME = :web_hooks + INDEX_NAME = 'index_web_hooks_on_project_id_and_id' + CLAUSE = "((type)::text = 'ProjectHook'::text)" + + def up + add_concurrent_index TABLE_NAME, [:project_id, :id], name: INDEX_NAME, where: CLAUSE + end + + def down + remove_concurrent_index_by_name TABLE_NAME, INDEX_NAME + end +end diff --git a/db/migrate/20240117081214_add_enable_user_cap_member_promotion_management_to_application_settings.rb b/db/migrate/20240117081214_add_enable_user_cap_member_promotion_management_to_application_settings.rb new file mode 100644 index 00000000000..2b3c13b1600 --- /dev/null +++ b/db/migrate/20240117081214_add_enable_user_cap_member_promotion_management_to_application_settings.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddEnableUserCapMemberPromotionManagementToApplicationSettings < Gitlab::Database::Migration[2.2] + milestone '16.9' + + def change + add_column(:application_settings, :enable_member_promotion_management, :boolean, default: false, null: false) + end +end diff --git a/db/post_migrate/20240118125559_convert_ci_pipeline_variables_to_list_partitioning_adds_fk_to_ci_pipelines.rb b/db/post_migrate/20240118125559_convert_ci_pipeline_variables_to_list_partitioning_adds_fk_to_ci_pipelines.rb new file mode 100644 index 00000000000..5d6b4fce30a --- /dev/null +++ b/db/post_migrate/20240118125559_convert_ci_pipeline_variables_to_list_partitioning_adds_fk_to_ci_pipelines.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +class ConvertCiPipelineVariablesToListPartitioningAddsFkToCiPipelines < Gitlab::Database::Migration[2.2] + milestone '16.9' + disable_ddl_transaction! + + include Gitlab::Database::PartitioningMigrationHelpers::TableManagementHelpers + + TABLE_NAME = :ci_pipeline_variables + PARENT_TABLE_NAME = :p_ci_pipeline_variables + FIRST_PARTITION = [100, 101] + PARTITION_COLUMN = :partition_id + + def up + convert_table_to_first_list_partition( + table_name: TABLE_NAME, + partitioning_column: PARTITION_COLUMN, + parent_table_name: PARENT_TABLE_NAME, + initial_partitioning_value: FIRST_PARTITION + ) + end + + def down + revert_converting_table_to_first_list_partition( + table_name: TABLE_NAME, + partitioning_column: PARTITION_COLUMN, + parent_table_name: PARENT_TABLE_NAME, + initial_partitioning_value: FIRST_PARTITION + ) + end +end diff --git a/db/schema_migrations/20240110092610 b/db/schema_migrations/20240110092610 new file mode 100644 index 00000000000..9eef6bb1e48 --- /dev/null +++ b/db/schema_migrations/20240110092610 @@ -0,0 +1 @@ +f2f81a5e257e8a90b8f4a3847b7d1722e7b274bc4885c50a4a4e07c0172e49b4
\ No newline at end of file diff --git a/db/schema_migrations/20240117081214 b/db/schema_migrations/20240117081214 new file mode 100644 index 00000000000..882545177ac --- /dev/null +++ b/db/schema_migrations/20240117081214 @@ -0,0 +1 @@ +9b4106a42da1d80bb01f4e1e2b0afd112f09fd33ecb93e99f001321edbc5776d
\ No newline at end of file diff --git a/db/schema_migrations/20240118125559 b/db/schema_migrations/20240118125559 new file mode 100644 index 00000000000..79bce6d6c81 --- /dev/null +++ b/db/schema_migrations/20240118125559 @@ -0,0 +1 @@ +27ef688c8ed556edf45f4b3dcb4a2aba89a2839339a3a5339574c3a33d34f68f
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 182e150704e..a4efb7a734c 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -12633,6 +12633,7 @@ CREATE TABLE application_settings ( lock_toggle_security_policies_policy_scope boolean DEFAULT false NOT NULL, rate_limits jsonb DEFAULT '{}'::jsonb NOT NULL, elasticsearch_max_code_indexing_concurrency integer DEFAULT 30 NOT NULL, + enable_member_promotion_management boolean DEFAULT false NOT NULL, CONSTRAINT app_settings_container_reg_cleanup_tags_max_list_size_positive CHECK ((container_registry_cleanup_tags_service_max_list_size >= 0)), CONSTRAINT app_settings_container_registry_pre_import_tags_rate_positive CHECK ((container_registry_pre_import_tags_rate >= (0)::numeric)), CONSTRAINT app_settings_dep_proxy_ttl_policies_worker_capacity_positive CHECK ((dependency_proxy_ttl_group_policy_worker_capacity >= 0)), @@ -14704,7 +14705,7 @@ CREATE SEQUENCE ci_pipeline_schedules_id_seq ALTER SEQUENCE ci_pipeline_schedules_id_seq OWNED BY ci_pipeline_schedules.id; -CREATE TABLE ci_pipeline_variables ( +CREATE TABLE p_ci_pipeline_variables ( key character varying NOT NULL, value text, encrypted_value text, @@ -14714,9 +14715,9 @@ CREATE TABLE ci_pipeline_variables ( partition_id bigint NOT NULL, raw boolean DEFAULT false NOT NULL, id bigint NOT NULL, - pipeline_id bigint NOT NULL, - CONSTRAINT partitioning_constraint CHECK ((partition_id = ANY (ARRAY[(100)::bigint, (101)::bigint]))) -); + pipeline_id bigint NOT NULL +) +PARTITION BY LIST (partition_id); CREATE SEQUENCE ci_pipeline_variables_id_seq START WITH 1 @@ -14725,7 +14726,20 @@ CREATE SEQUENCE ci_pipeline_variables_id_seq NO MAXVALUE CACHE 1; -ALTER SEQUENCE ci_pipeline_variables_id_seq OWNED BY ci_pipeline_variables.id; +ALTER SEQUENCE ci_pipeline_variables_id_seq OWNED BY p_ci_pipeline_variables.id; + +CREATE TABLE ci_pipeline_variables ( + key character varying NOT NULL, + value text, + encrypted_value text, + encrypted_value_salt character varying, + encrypted_value_iv character varying, + variable_type smallint DEFAULT 1 NOT NULL, + partition_id bigint NOT NULL, + raw boolean DEFAULT false NOT NULL, + id bigint DEFAULT nextval('ci_pipeline_variables_id_seq'::regclass) NOT NULL, + pipeline_id bigint NOT NULL +); CREATE TABLE ci_pipelines ( id integer NOT NULL, @@ -26801,6 +26815,8 @@ ALTER TABLE ONLY p_ci_builds ATTACH PARTITION ci_builds FOR VALUES IN ('100'); ALTER TABLE ONLY p_ci_builds_metadata ATTACH PARTITION ci_builds_metadata FOR VALUES IN ('100'); +ALTER TABLE ONLY p_ci_pipeline_variables ATTACH PARTITION ci_pipeline_variables FOR VALUES IN ('100', '101'); + ALTER TABLE ONLY abuse_events ALTER COLUMN id SET DEFAULT nextval('abuse_events_id_seq'::regclass); ALTER TABLE ONLY abuse_report_assignees ALTER COLUMN id SET DEFAULT nextval('abuse_report_assignees_id_seq'::regclass); @@ -27035,8 +27051,6 @@ ALTER TABLE ONLY ci_pipeline_schedule_variables ALTER COLUMN id SET DEFAULT next ALTER TABLE ONLY ci_pipeline_schedules ALTER COLUMN id SET DEFAULT nextval('ci_pipeline_schedules_id_seq'::regclass); -ALTER TABLE ONLY ci_pipeline_variables ALTER COLUMN id SET DEFAULT nextval('ci_pipeline_variables_id_seq'::regclass); - ALTER TABLE ONLY ci_pipelines ALTER COLUMN id SET DEFAULT nextval('ci_pipelines_id_seq'::regclass); ALTER TABLE ONLY ci_platform_metrics ALTER COLUMN id SET DEFAULT nextval('ci_platform_metrics_id_seq'::regclass); @@ -27541,6 +27555,8 @@ ALTER TABLE ONLY p_ci_builds_metadata ALTER COLUMN id SET DEFAULT nextval('ci_bu ALTER TABLE ONLY p_ci_job_annotations ALTER COLUMN id SET DEFAULT nextval('p_ci_job_annotations_id_seq'::regclass); +ALTER TABLE ONLY p_ci_pipeline_variables ALTER COLUMN id SET DEFAULT nextval('ci_pipeline_variables_id_seq'::regclass); + ALTER TABLE ONLY packages_build_infos ALTER COLUMN id SET DEFAULT nextval('packages_build_infos_id_seq'::regclass); ALTER TABLE ONLY packages_composer_cache_files ALTER COLUMN id SET DEFAULT nextval('packages_composer_cache_files_id_seq'::regclass); @@ -29127,6 +29143,9 @@ ALTER TABLE ONLY ci_pipeline_schedule_variables ALTER TABLE ONLY ci_pipeline_schedules ADD CONSTRAINT ci_pipeline_schedules_pkey PRIMARY KEY (id); +ALTER TABLE ONLY p_ci_pipeline_variables + ADD CONSTRAINT p_ci_pipeline_variables_pkey PRIMARY KEY (id, partition_id); + ALTER TABLE ONLY ci_pipeline_variables ADD CONSTRAINT ci_pipeline_variables_pkey PRIMARY KEY (id, partition_id); @@ -34800,6 +34819,8 @@ CREATE INDEX index_pipeline_metadata_on_name_text_pattern_pipeline_id ON ci_pipe CREATE INDEX index_pipeline_metadata_on_pipeline_id_name_text_pattern ON ci_pipeline_metadata USING btree (pipeline_id, name text_pattern_ops); +CREATE UNIQUE INDEX p_ci_pipeline_variables_pipeline_id_key_partition_id_idx ON ONLY p_ci_pipeline_variables USING btree (pipeline_id, key, partition_id); + CREATE UNIQUE INDEX index_pipeline_variables_on_pipeline_id_key_partition_id_unique ON ci_pipeline_variables USING btree (pipeline_id, key, partition_id); CREATE UNIQUE INDEX index_plan_limits_on_plan_id ON plan_limits USING btree (plan_id); @@ -35940,6 +35961,8 @@ CREATE INDEX index_web_hooks_on_group_id ON web_hooks USING btree (group_id) WHE CREATE INDEX index_web_hooks_on_integration_id ON web_hooks USING btree (integration_id); +CREATE INDEX index_web_hooks_on_project_id_and_id ON web_hooks USING btree (project_id, id) WHERE ((type)::text = 'ProjectHook'::text); + CREATE INDEX index_web_hooks_on_project_id_recent_failures ON web_hooks USING btree (project_id, recent_failures); CREATE INDEX index_web_hooks_on_type ON web_hooks USING btree (type); @@ -37938,6 +37961,8 @@ ALTER INDEX p_ci_builds_metadata_pkey ATTACH PARTITION ci_builds_metadata_pkey; ALTER INDEX p_ci_builds_pkey ATTACH PARTITION ci_builds_pkey; +ALTER INDEX p_ci_pipeline_variables_pkey ATTACH PARTITION ci_pipeline_variables_pkey; + ALTER INDEX p_ci_builds_metadata_build_id_idx ATTACH PARTITION index_ci_builds_metadata_on_build_id_and_has_exposed_artifacts; ALTER INDEX p_ci_builds_metadata_build_id_id_idx ATTACH PARTITION index_ci_builds_metadata_on_build_id_and_id_and_interruptible; @@ -37984,6 +38009,8 @@ ALTER INDEX p_ci_builds_runner_id_idx ATTACH PARTITION index_ci_builds_runner_id ALTER INDEX p_ci_builds_user_id_name_idx ATTACH PARTITION index_partial_ci_builds_on_user_id_name_parser_features; +ALTER INDEX p_ci_pipeline_variables_pipeline_id_key_partition_id_idx ATTACH PARTITION index_pipeline_variables_on_pipeline_id_key_partition_id_unique; + ALTER INDEX p_ci_builds_user_id_name_created_at_idx ATTACH PARTITION index_secure_ci_builds_on_user_id_name_created_at; ALTER INDEX p_ci_builds_name_id_idx ATTACH PARTITION index_security_ci_builds_on_name_and_id_parser_features; @@ -39198,7 +39225,7 @@ ALTER TABLE ONLY timelogs ALTER TABLE ONLY boards ADD CONSTRAINT fk_f15266b5f9 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; -ALTER TABLE ONLY ci_pipeline_variables +ALTER TABLE p_ci_pipeline_variables ADD CONSTRAINT fk_f29c5f4380 FOREIGN KEY (pipeline_id) REFERENCES ci_pipelines(id) ON DELETE CASCADE; ALTER TABLE ONLY zoekt_indices |