diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-02 09:10:45 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-02 09:10:45 +0300 |
commit | f58c22e1cd553626dbfa4f347afb86544865cfbe (patch) | |
tree | 8560435de95970b2b7e3c4ca5106c9e61049c8e1 /db | |
parent | 34beb8cec33a0ea1a296ecc9d1e5025d61624bcd (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r-- | db/docs/instance_audit_events_streaming_headers.yml | 10 | ||||
-rw-r--r-- | db/migrate/20230516175449_create_instance_audit_events_streaming_headers.rb | 20 | ||||
-rw-r--r-- | db/migrate/20230601035558_add_unconfirmed_user_deletion_to_application_settings.rb | 8 | ||||
-rw-r--r-- | db/schema_migrations/20230516175449 | 1 | ||||
-rw-r--r-- | db/schema_migrations/20230601035558 | 1 | ||||
-rw-r--r-- | db/structure.sql | 34 |
6 files changed, 74 insertions, 0 deletions
diff --git a/db/docs/instance_audit_events_streaming_headers.yml b/db/docs/instance_audit_events_streaming_headers.yml new file mode 100644 index 00000000000..40db0ead3bf --- /dev/null +++ b/db/docs/instance_audit_events_streaming_headers.yml @@ -0,0 +1,10 @@ +--- +table_name: instance_audit_events_streaming_headers +classes: + - AuditEvents::Streaming::InstanceHeader +feature_categories: + - audit_events +description: Represents a HTTP header sent with streaming audit events to instance level destinations +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/88063 +milestone: '16.1' +gitlab_schema: gitlab_main diff --git a/db/migrate/20230516175449_create_instance_audit_events_streaming_headers.rb b/db/migrate/20230516175449_create_instance_audit_events_streaming_headers.rb new file mode 100644 index 00000000000..2fcf583c3ce --- /dev/null +++ b/db/migrate/20230516175449_create_instance_audit_events_streaming_headers.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class CreateInstanceAuditEventsStreamingHeaders < Gitlab::Database::Migration[2.1] + INDEX_NAME = 'idx_headers_instance_external_audit_event_destination_id' + UNIQ_INDEX_NAME = 'idx_instance_external_audit_event_destination_id_key_uniq' + + def change + create_table :instance_audit_events_streaming_headers do |t| + t.timestamps_with_timezone null: false + t.references :instance_external_audit_event_destination, + null: false, + index: { name: INDEX_NAME }, + foreign_key: { to_table: 'audit_events_instance_external_audit_event_destinations', on_delete: :cascade } + t.text :key, null: false, limit: 255 + t.text :value, null: false, limit: 255 + + t.index [:instance_external_audit_event_destination_id, :key], unique: true, name: UNIQ_INDEX_NAME + end + end +end diff --git a/db/migrate/20230601035558_add_unconfirmed_user_deletion_to_application_settings.rb b/db/migrate/20230601035558_add_unconfirmed_user_deletion_to_application_settings.rb new file mode 100644 index 00000000000..edb9242feaa --- /dev/null +++ b/db/migrate/20230601035558_add_unconfirmed_user_deletion_to_application_settings.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +class AddUnconfirmedUserDeletionToApplicationSettings < Gitlab::Database::Migration[2.1] + def change + add_column :application_settings, :delete_unconfirmed_users, :boolean, default: false, null: false + add_column :application_settings, :unconfirmed_users_delete_after_days, :integer, default: 7, null: false + end +end diff --git a/db/schema_migrations/20230516175449 b/db/schema_migrations/20230516175449 new file mode 100644 index 00000000000..d52db116a5e --- /dev/null +++ b/db/schema_migrations/20230516175449 @@ -0,0 +1 @@ +7c9152abad40bce13c5a1dd3931c9a81a892f516bc07ec4fa9414b9ae35496a2
\ No newline at end of file diff --git a/db/schema_migrations/20230601035558 b/db/schema_migrations/20230601035558 new file mode 100644 index 00000000000..ca8db670ce6 --- /dev/null +++ b/db/schema_migrations/20230601035558 @@ -0,0 +1 @@ +fd3d95427744b03f8bf58a5b172ad05f26ef6d1855440c39524b9e9d92617c3a
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 78185f381d4..7f46cc56198 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -11848,6 +11848,8 @@ CREATE TABLE application_settings ( encrypted_vertex_ai_credentials_iv bytea, vertex_ai_project text, instance_level_code_suggestions_enabled boolean DEFAULT false NOT NULL, + delete_unconfirmed_users boolean DEFAULT false NOT NULL, + unconfirmed_users_delete_after_days integer DEFAULT 7 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)), @@ -17084,6 +17086,26 @@ CREATE SEQUENCE insights_id_seq ALTER SEQUENCE insights_id_seq OWNED BY insights.id; +CREATE TABLE instance_audit_events_streaming_headers ( + id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + instance_external_audit_event_destination_id bigint NOT NULL, + key text NOT NULL, + value text NOT NULL, + CONSTRAINT check_d52adbbabb CHECK ((char_length(value) <= 255)), + CONSTRAINT check_e92010d531 CHECK ((char_length(key) <= 255)) +); + +CREATE SEQUENCE instance_audit_events_streaming_headers_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE instance_audit_events_streaming_headers_id_seq OWNED BY instance_audit_events_streaming_headers.id; + CREATE TABLE integrations ( id integer NOT NULL, project_id integer, @@ -25280,6 +25302,8 @@ ALTER TABLE ONLY index_statuses ALTER COLUMN id SET DEFAULT nextval('index_statu ALTER TABLE ONLY insights ALTER COLUMN id SET DEFAULT nextval('insights_id_seq'::regclass); +ALTER TABLE ONLY instance_audit_events_streaming_headers ALTER COLUMN id SET DEFAULT nextval('instance_audit_events_streaming_headers_id_seq'::regclass); + ALTER TABLE ONLY integrations ALTER COLUMN id SET DEFAULT nextval('integrations_id_seq'::regclass); ALTER TABLE ONLY internal_ids ALTER COLUMN id SET DEFAULT nextval('internal_ids_id_seq'::regclass); @@ -27368,6 +27392,9 @@ ALTER TABLE ONLY index_statuses ALTER TABLE ONLY insights ADD CONSTRAINT insights_pkey PRIMARY KEY (id); +ALTER TABLE ONLY instance_audit_events_streaming_headers + ADD CONSTRAINT instance_audit_events_streaming_headers_pkey PRIMARY KEY (id); + ALTER TABLE ONLY integrations ADD CONSTRAINT integrations_pkey PRIMARY KEY (id); @@ -29517,12 +29544,16 @@ CREATE UNIQUE INDEX idx_environment_merge_requests_unique_index ON deployment_me CREATE UNIQUE INDEX idx_external_audit_event_destination_id_key_uniq ON audit_events_streaming_headers USING btree (key, external_audit_event_destination_id); +CREATE INDEX idx_headers_instance_external_audit_event_destination_id ON instance_audit_events_streaming_headers USING btree (instance_external_audit_event_destination_id); + CREATE INDEX idx_installable_conan_pkgs_on_project_id_id ON packages_packages USING btree (project_id, id) WHERE ((package_type = 3) AND (status = ANY (ARRAY[0, 1]))); CREATE INDEX idx_installable_helm_pkgs_on_project_id_id ON packages_packages USING btree (project_id, id); CREATE INDEX idx_installable_npm_pkgs_on_project_id_name_version_id ON packages_packages USING btree (project_id, name, version, id) WHERE ((package_type = 2) AND (status = 0)); +CREATE UNIQUE INDEX idx_instance_external_audit_event_destination_id_key_uniq ON instance_audit_events_streaming_headers USING btree (instance_external_audit_event_destination_id, key); + CREATE INDEX idx_issues_on_health_status_not_null ON issues USING btree (health_status) WHERE (health_status IS NOT NULL); CREATE INDEX idx_issues_on_project_id_and_created_at_and_id_and_state_id ON issues USING btree (project_id, created_at, id, state_id); @@ -37208,6 +37239,9 @@ ALTER TABLE ONLY board_user_preferences ALTER TABLE ONLY vulnerability_occurrence_pipelines ADD CONSTRAINT fk_rails_dc3ae04693 FOREIGN KEY (occurrence_id) REFERENCES vulnerability_occurrences(id) ON DELETE CASCADE; +ALTER TABLE ONLY instance_audit_events_streaming_headers + ADD CONSTRAINT fk_rails_dc933c1f3c FOREIGN KEY (instance_external_audit_event_destination_id) REFERENCES audit_events_instance_external_audit_event_destinations(id) ON DELETE CASCADE; + ALTER TABLE ONLY deployment_merge_requests ADD CONSTRAINT fk_rails_dcbce9f4df FOREIGN KEY (deployment_id) REFERENCES deployments(id) ON DELETE CASCADE; |