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-12-14 12:09:56 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-12-14 12:09:56 +0300
commit3c0faf1c6b40536c7b7687225ff4e03e884192d5 (patch)
treec81ab92ae5a27c6a046e593810f30b231eab7788 /db
parent671c8718a9762eb4e698cb7547cffa255e0ae322 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r--db/docs/audit_events_streaming_http_instance_namespace_filters.yml12
-rw-r--r--db/docs/batched_background_migrations/backfill_branch_protection_namespace_setting.yml9
-rw-r--r--db/migrate/20231115064007_create_audit_events_streaming_http_instance_namespace_filters.rb21
-rw-r--r--db/migrate/20231116115237_add_destination_fk_to_audit_events_http_instance_namespace_filters.rb21
-rw-r--r--db/migrate/20231116115303_add_namespace_fk_to_audit_events_http_instance_namespace_filters.rb21
-rw-r--r--db/post_migrate/20231107092912_queue_backfill_branch_protection_namespace_setting.rb27
-rw-r--r--db/schema_migrations/202311070929121
-rw-r--r--db/schema_migrations/202311150640071
-rw-r--r--db/schema_migrations/202311161152371
-rw-r--r--db/schema_migrations/202311161153031
-rw-r--r--db/structure.sql32
11 files changed, 147 insertions, 0 deletions
diff --git a/db/docs/audit_events_streaming_http_instance_namespace_filters.yml b/db/docs/audit_events_streaming_http_instance_namespace_filters.yml
new file mode 100644
index 00000000000..9dc7d05a315
--- /dev/null
+++ b/db/docs/audit_events_streaming_http_instance_namespace_filters.yml
@@ -0,0 +1,12 @@
+---
+table_name: audit_events_streaming_http_instance_namespace_filters
+classes:
+ - AuditEvents::Streaming::HTTP::Instance::NamespaceFilter
+feature_categories:
+ - audit_events
+description: Represents a group or project filter for instance-level custom http external audit event destinations.
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/136959
+milestone: '16.7'
+gitlab_schema: gitlab_main_cell
+sharding_key:
+ namespace_id: namespaces
diff --git a/db/docs/batched_background_migrations/backfill_branch_protection_namespace_setting.yml b/db/docs/batched_background_migrations/backfill_branch_protection_namespace_setting.yml
new file mode 100644
index 00000000000..9a596cb056e
--- /dev/null
+++ b/db/docs/batched_background_migrations/backfill_branch_protection_namespace_setting.yml
@@ -0,0 +1,9 @@
+---
+migration_job_name: BackfillBranchProtectionNamespaceSetting
+description: This migration back fills column default_branch_protection_defaults of namespace settings table
+feature_category: source_code_management
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/136181
+milestone: '16.7'
+queued_migration_version: 20231107092912
+finalize_after: '2024-01-23'
+finalized_by: # version of the migration that ensured this bbm
diff --git a/db/migrate/20231115064007_create_audit_events_streaming_http_instance_namespace_filters.rb b/db/migrate/20231115064007_create_audit_events_streaming_http_instance_namespace_filters.rb
new file mode 100644
index 00000000000..e5ca560635b
--- /dev/null
+++ b/db/migrate/20231115064007_create_audit_events_streaming_http_instance_namespace_filters.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class CreateAuditEventsStreamingHttpInstanceNamespaceFilters < Gitlab::Database::Migration[2.2]
+ milestone '16.7'
+ enable_lock_retries!
+
+ UNIQ_DESTINATION_INDEX_NAME = 'unique_audit_events_instance_namespace_filters_destination_id'
+ NAMESPACE_INDEX_NAME = 'index_audit_events_instance_namespace_filters_on_namespace_id'
+
+ def change
+ create_table :audit_events_streaming_http_instance_namespace_filters do |t|
+ t.timestamps_with_timezone null: false
+ t.bigint :audit_events_instance_external_audit_event_destination_id,
+ null: false,
+ index: { unique: true, name: UNIQ_DESTINATION_INDEX_NAME }
+ t.bigint :namespace_id,
+ null: false,
+ index: { name: NAMESPACE_INDEX_NAME }
+ end
+ end
+end
diff --git a/db/migrate/20231116115237_add_destination_fk_to_audit_events_http_instance_namespace_filters.rb b/db/migrate/20231116115237_add_destination_fk_to_audit_events_http_instance_namespace_filters.rb
new file mode 100644
index 00000000000..dab72766f0e
--- /dev/null
+++ b/db/migrate/20231116115237_add_destination_fk_to_audit_events_http_instance_namespace_filters.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class AddDestinationFkToAuditEventsHttpInstanceNamespaceFilters < Gitlab::Database::Migration[2.2]
+ milestone '16.7'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :audit_events_streaming_http_instance_namespace_filters,
+ :audit_events_instance_external_audit_event_destinations,
+ column: :audit_events_instance_external_audit_event_destination_id,
+ on_delete: :cascade
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key_if_exists :audit_events_streaming_http_instance_namespace_filters,
+ column: :audit_events_instance_external_audit_event_destination_id
+ end
+ end
+end
diff --git a/db/migrate/20231116115303_add_namespace_fk_to_audit_events_http_instance_namespace_filters.rb b/db/migrate/20231116115303_add_namespace_fk_to_audit_events_http_instance_namespace_filters.rb
new file mode 100644
index 00000000000..375a2a3aa05
--- /dev/null
+++ b/db/migrate/20231116115303_add_namespace_fk_to_audit_events_http_instance_namespace_filters.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class AddNamespaceFkToAuditEventsHttpInstanceNamespaceFilters < Gitlab::Database::Migration[2.2]
+ milestone '16.7'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :audit_events_streaming_http_instance_namespace_filters,
+ :namespaces,
+ column: :namespace_id,
+ on_delete: :cascade
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key_if_exists :audit_events_streaming_http_instance_namespace_filters,
+ column: :namespace_id
+ end
+ end
+end
diff --git a/db/post_migrate/20231107092912_queue_backfill_branch_protection_namespace_setting.rb b/db/post_migrate/20231107092912_queue_backfill_branch_protection_namespace_setting.rb
new file mode 100644
index 00000000000..28af287c75b
--- /dev/null
+++ b/db/post_migrate/20231107092912_queue_backfill_branch_protection_namespace_setting.rb
@@ -0,0 +1,27 @@
+# frozen_string_literal: true
+
+class QueueBackfillBranchProtectionNamespaceSetting < Gitlab::Database::Migration[2.2]
+ milestone "16.7"
+ MIGRATION = "BackfillBranchProtectionNamespaceSetting"
+ DELAY_INTERVAL = 2.minutes
+ BATCH_SIZE = 10_000
+ SUB_BATCH_SIZE = 100
+
+ disable_ddl_transaction!
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ def up
+ queue_batched_background_migration(
+ MIGRATION,
+ :namespace_settings,
+ :namespace_id,
+ job_interval: DELAY_INTERVAL,
+ batch_size: BATCH_SIZE,
+ sub_batch_size: SUB_BATCH_SIZE
+ )
+ end
+
+ def down
+ delete_batched_background_migration(MIGRATION, :namespace_settings, :namespace_id, [])
+ end
+end
diff --git a/db/schema_migrations/20231107092912 b/db/schema_migrations/20231107092912
new file mode 100644
index 00000000000..baef0aa2147
--- /dev/null
+++ b/db/schema_migrations/20231107092912
@@ -0,0 +1 @@
+f5bd273a05caa2cc662dc430cb2661321602e608054d6ef3f45dfc8cfacec152 \ No newline at end of file
diff --git a/db/schema_migrations/20231115064007 b/db/schema_migrations/20231115064007
new file mode 100644
index 00000000000..4a4cf7356cf
--- /dev/null
+++ b/db/schema_migrations/20231115064007
@@ -0,0 +1 @@
+3f8ea307440353cc193662c9c552609d09f7a58dd1d6acccb7208803f394329c \ No newline at end of file
diff --git a/db/schema_migrations/20231116115237 b/db/schema_migrations/20231116115237
new file mode 100644
index 00000000000..cfad779dc60
--- /dev/null
+++ b/db/schema_migrations/20231116115237
@@ -0,0 +1 @@
+fce9aa43da310dbbcd7d0175f531ab069548d5cc782104ab8c83f20874cc3644 \ No newline at end of file
diff --git a/db/schema_migrations/20231116115303 b/db/schema_migrations/20231116115303
new file mode 100644
index 00000000000..72afbdebbf8
--- /dev/null
+++ b/db/schema_migrations/20231116115303
@@ -0,0 +1 @@
+d5d599b967346e13f0cbdd909c33669d8a3268efc7744ca5749fab69e60ff606 \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index c008eae969b..72a8bb9ced3 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -12913,6 +12913,23 @@ CREATE SEQUENCE audit_events_streaming_http_group_namespace_filters_id_seq
ALTER SEQUENCE audit_events_streaming_http_group_namespace_filters_id_seq OWNED BY audit_events_streaming_http_group_namespace_filters.id;
+CREATE TABLE audit_events_streaming_http_instance_namespace_filters (
+ id bigint NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ audit_events_instance_external_audit_event_destination_id bigint NOT NULL,
+ namespace_id bigint NOT NULL
+);
+
+CREATE SEQUENCE audit_events_streaming_http_instance_namespace_filters_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE audit_events_streaming_http_instance_namespace_filters_id_seq OWNED BY audit_events_streaming_http_instance_namespace_filters.id;
+
CREATE TABLE audit_events_streaming_instance_event_type_filters (
id bigint NOT NULL,
created_at timestamp with time zone NOT NULL,
@@ -26354,6 +26371,8 @@ ALTER TABLE ONLY audit_events_streaming_headers ALTER COLUMN id SET DEFAULT next
ALTER TABLE ONLY audit_events_streaming_http_group_namespace_filters ALTER COLUMN id SET DEFAULT nextval('audit_events_streaming_http_group_namespace_filters_id_seq'::regclass);
+ALTER TABLE ONLY audit_events_streaming_http_instance_namespace_filters ALTER COLUMN id SET DEFAULT nextval('audit_events_streaming_http_instance_namespace_filters_id_seq'::regclass);
+
ALTER TABLE ONLY audit_events_streaming_instance_event_type_filters ALTER COLUMN id SET DEFAULT nextval('audit_events_streaming_instance_event_type_filters_id_seq'::regclass);
ALTER TABLE ONLY authentication_events ALTER COLUMN id SET DEFAULT nextval('authentication_events_id_seq'::regclass);
@@ -28212,6 +28231,9 @@ ALTER TABLE ONLY audit_events_streaming_headers
ALTER TABLE ONLY audit_events_streaming_http_group_namespace_filters
ADD CONSTRAINT audit_events_streaming_http_group_namespace_filters_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY audit_events_streaming_http_instance_namespace_filters
+ ADD CONSTRAINT audit_events_streaming_http_instance_namespace_filters_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY audit_events_streaming_instance_event_type_filters
ADD CONSTRAINT audit_events_streaming_instance_event_type_filters_pkey PRIMARY KEY (id);
@@ -31867,6 +31889,8 @@ CREATE UNIQUE INDEX index_atlassian_identities_on_extern_uid ON atlassian_identi
CREATE UNIQUE INDEX index_audit_events_external_audit_on_verification_token ON audit_events_external_audit_event_destinations USING btree (verification_token);
+CREATE INDEX index_audit_events_instance_namespace_filters_on_namespace_id ON audit_events_streaming_http_instance_namespace_filters USING btree (namespace_id);
+
CREATE INDEX index_audit_events_on_entity_id_and_entity_type_and_created_at ON ONLY audit_events USING btree (entity_id, entity_type, created_at, id);
CREATE INDEX index_authentication_events_on_provider ON authentication_events USING btree (provider);
@@ -35421,6 +35445,8 @@ CREATE UNIQUE INDEX unique_audit_events_group_namespace_filters_destination_id O
CREATE UNIQUE INDEX unique_audit_events_group_namespace_filters_namespace_id ON audit_events_streaming_http_group_namespace_filters USING btree (namespace_id);
+CREATE UNIQUE INDEX unique_audit_events_instance_namespace_filters_destination_id ON audit_events_streaming_http_instance_namespace_filters USING btree (audit_events_instance_external_audit_event_destination_id);
+
CREATE UNIQUE INDEX unique_batched_background_migrations_queued_migration_version ON batched_background_migrations USING btree (queued_migration_version);
CREATE UNIQUE INDEX unique_ci_builds_token_encrypted_and_partition_id ON ci_builds USING btree (token_encrypted, partition_id) WHERE (token_encrypted IS NOT NULL);
@@ -37321,6 +37347,9 @@ ALTER TABLE ONLY users_star_projects
ALTER TABLE ONLY alert_management_alerts
ADD CONSTRAINT fk_2358b75436 FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE SET NULL;
+ALTER TABLE ONLY audit_events_streaming_http_instance_namespace_filters
+ ADD CONSTRAINT fk_23f3ab7df0 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY import_failures
ADD CONSTRAINT fk_24b824da43 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;
@@ -37906,6 +37935,9 @@ ALTER TABLE ONLY identities
ALTER TABLE ONLY boards
ADD CONSTRAINT fk_ab0a250ff6 FOREIGN KEY (iteration_cadence_id) REFERENCES iterations_cadences(id) ON DELETE CASCADE;
+ALTER TABLE ONLY audit_events_streaming_http_instance_namespace_filters
+ ADD CONSTRAINT fk_abe44125bc FOREIGN KEY (audit_events_instance_external_audit_event_destination_id) REFERENCES audit_events_instance_external_audit_event_destinations(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY merge_requests
ADD CONSTRAINT fk_ad525e1f87 FOREIGN KEY (merge_user_id) REFERENCES users(id) ON DELETE SET NULL;