summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-11-04 09:11:46 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-11-04 09:11:46 +0000
commit9f0d27648937cb04d685ca9207f5c45f3ac98010 (patch)
tree00c30674524f01538edbb4c0aaddbfa96b78f3a3 /db
parent0250f48d9fc064b902d37e58f09715df0e1dd4e5 (diff)
downloadgitlab-ce-9f0d27648937cb04d685ca9207f5c45f3ac98010.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r--db/docs/namespace_commit_emails.yml9
-rw-r--r--db/migrate/20221021213216_create_namespace_commit_emails.rb14
-rw-r--r--db/migrate/20221022213505_add_namespace_commit_emails_namespace_fk.rb15
-rw-r--r--db/migrate/20221022213521_add_namespace_commit_emails_email_fk.rb15
-rw-r--r--db/schema_migrations/202210212132161
-rw-r--r--db/schema_migrations/202210222135051
-rw-r--r--db/schema_migrations/202210222135211
-rw-r--r--db/structure.sql38
8 files changed, 94 insertions, 0 deletions
diff --git a/db/docs/namespace_commit_emails.yml b/db/docs/namespace_commit_emails.yml
new file mode 100644
index 00000000000..d7e192f97f4
--- /dev/null
+++ b/db/docs/namespace_commit_emails.yml
@@ -0,0 +1,9 @@
+---
+table_name: namespace_commit_emails
+classes:
+- Users::NamespaceCommitEmail
+feature_categories:
+- source_code_management
+description: User default email for commits from the GitLab UI
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/101832
+milestone: '15.6'
diff --git a/db/migrate/20221021213216_create_namespace_commit_emails.rb b/db/migrate/20221021213216_create_namespace_commit_emails.rb
new file mode 100644
index 00000000000..07811bf7b75
--- /dev/null
+++ b/db/migrate/20221021213216_create_namespace_commit_emails.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+class CreateNamespaceCommitEmails < Gitlab::Database::Migration[2.0]
+ def change
+ create_table :namespace_commit_emails do |t|
+ t.references :user, index: false, null: false, foreign_key: { on_delete: :cascade }
+ t.references :namespace, null: false
+ t.references :email, null: false
+ t.timestamps_with_timezone null: false
+
+ t.index [:user_id, :namespace_id], unique: true
+ end
+ end
+end
diff --git a/db/migrate/20221022213505_add_namespace_commit_emails_namespace_fk.rb b/db/migrate/20221022213505_add_namespace_commit_emails_namespace_fk.rb
new file mode 100644
index 00000000000..0c543b03397
--- /dev/null
+++ b/db/migrate/20221022213505_add_namespace_commit_emails_namespace_fk.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddNamespaceCommitEmailsNamespaceFk < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :namespace_commit_emails, :namespaces, column: :namespace_id, on_delete: :cascade
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key :namespace_commit_emails, column: :namespace_id
+ end
+ end
+end
diff --git a/db/migrate/20221022213521_add_namespace_commit_emails_email_fk.rb b/db/migrate/20221022213521_add_namespace_commit_emails_email_fk.rb
new file mode 100644
index 00000000000..9dbde26475c
--- /dev/null
+++ b/db/migrate/20221022213521_add_namespace_commit_emails_email_fk.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddNamespaceCommitEmailsEmailFk < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :namespace_commit_emails, :emails, column: :email_id, on_delete: :cascade
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key :namespace_commit_emails, column: :email_id
+ end
+ end
+end
diff --git a/db/schema_migrations/20221021213216 b/db/schema_migrations/20221021213216
new file mode 100644
index 00000000000..900a4f6701e
--- /dev/null
+++ b/db/schema_migrations/20221021213216
@@ -0,0 +1 @@
+defe6e66c98648ea7fb77d8001392bc707ec022f639d346c42d23fad10958856 \ No newline at end of file
diff --git a/db/schema_migrations/20221022213505 b/db/schema_migrations/20221022213505
new file mode 100644
index 00000000000..4cf0b87eedf
--- /dev/null
+++ b/db/schema_migrations/20221022213505
@@ -0,0 +1 @@
+c48015b2ff6ad4b58bffaf5342247d890f6bd2388c467751654bc705f5eb53ed \ No newline at end of file
diff --git a/db/schema_migrations/20221022213521 b/db/schema_migrations/20221022213521
new file mode 100644
index 00000000000..c3bb483debf
--- /dev/null
+++ b/db/schema_migrations/20221022213521
@@ -0,0 +1 @@
+739952c72f82b804b84d73107264804202ad102b425008d4dcb029c1f02e2118 \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index 9dc33fab3fa..57b94946643 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -17951,6 +17951,24 @@ CREATE TABLE namespace_ci_cd_settings (
allow_stale_runner_pruning boolean DEFAULT false NOT NULL
);
+CREATE TABLE namespace_commit_emails (
+ id bigint NOT NULL,
+ user_id bigint NOT NULL,
+ namespace_id bigint NOT NULL,
+ email_id bigint NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL
+);
+
+CREATE SEQUENCE namespace_commit_emails_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE namespace_commit_emails_id_seq OWNED BY namespace_commit_emails.id;
+
CREATE TABLE namespace_details (
namespace_id bigint NOT NULL,
created_at timestamp with time zone,
@@ -23974,6 +23992,8 @@ ALTER TABLE ONLY namespace_admin_notes ALTER COLUMN id SET DEFAULT nextval('name
ALTER TABLE ONLY namespace_bans ALTER COLUMN id SET DEFAULT nextval('namespace_bans_id_seq'::regclass);
+ALTER TABLE ONLY namespace_commit_emails ALTER COLUMN id SET DEFAULT nextval('namespace_commit_emails_id_seq'::regclass);
+
ALTER TABLE ONLY namespace_statistics ALTER COLUMN id SET DEFAULT nextval('namespace_statistics_id_seq'::regclass);
ALTER TABLE ONLY namespaces ALTER COLUMN id SET DEFAULT nextval('namespaces_id_seq'::regclass);
@@ -26037,6 +26057,9 @@ ALTER TABLE ONLY namespace_bans
ALTER TABLE ONLY namespace_ci_cd_settings
ADD CONSTRAINT namespace_ci_cd_settings_pkey PRIMARY KEY (namespace_id);
+ALTER TABLE ONLY namespace_commit_emails
+ ADD CONSTRAINT namespace_commit_emails_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY namespace_details
ADD CONSTRAINT namespace_details_pkey PRIMARY KEY (namespace_id);
@@ -29679,6 +29702,12 @@ CREATE UNIQUE INDEX index_namespace_bans_on_namespace_id_and_user_id ON namespac
CREATE INDEX index_namespace_bans_on_user_id ON namespace_bans USING btree (user_id);
+CREATE INDEX index_namespace_commit_emails_on_email_id ON namespace_commit_emails USING btree (email_id);
+
+CREATE INDEX index_namespace_commit_emails_on_namespace_id ON namespace_commit_emails USING btree (namespace_id);
+
+CREATE UNIQUE INDEX index_namespace_commit_emails_on_user_id_and_namespace_id ON namespace_commit_emails USING btree (user_id, namespace_id);
+
CREATE UNIQUE INDEX index_namespace_root_storage_statistics_on_namespace_id ON namespace_root_storage_statistics USING btree (namespace_id);
CREATE UNIQUE INDEX index_namespace_statistics_on_namespace_id ON namespace_statistics USING btree (namespace_id);
@@ -32849,6 +32878,9 @@ ALTER TABLE ONLY user_namespace_callouts
ALTER TABLE ONLY sbom_occurrences
ADD CONSTRAINT fk_4b88e5b255 FOREIGN KEY (component_version_id) REFERENCES sbom_component_versions(id) ON DELETE CASCADE;
+ALTER TABLE ONLY namespace_commit_emails
+ ADD CONSTRAINT fk_4d6ba63ba5 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY vulnerability_reads
ADD CONSTRAINT fk_4f593f6c62 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;
@@ -33233,6 +33265,9 @@ ALTER TABLE ONLY issue_assignees
ALTER TABLE ONLY agent_project_authorizations
ADD CONSTRAINT fk_b7fe9b4777 FOREIGN KEY (agent_id) REFERENCES cluster_agents(id) ON DELETE CASCADE;
+ALTER TABLE ONLY namespace_commit_emails
+ ADD CONSTRAINT fk_b8d89d555e FOREIGN KEY (email_id) REFERENCES emails(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY ci_trigger_requests
ADD CONSTRAINT fk_b8ec8b7245 FOREIGN KEY (trigger_id) REFERENCES ci_triggers(id) ON DELETE CASCADE;
@@ -34937,6 +34972,9 @@ ALTER TABLE ONLY packages_debian_project_distributions
ALTER TABLE ONLY incident_management_oncall_shifts
ADD CONSTRAINT fk_rails_df4feb286a FOREIGN KEY (rotation_id) REFERENCES incident_management_oncall_rotations(id) ON DELETE CASCADE;
+ALTER TABLE ONLY namespace_commit_emails
+ ADD CONSTRAINT fk_rails_dfa4c104f5 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY analytics_cycle_analytics_group_stages
ADD CONSTRAINT fk_rails_dfb37c880d FOREIGN KEY (end_event_label_id) REFERENCES labels(id) ON DELETE CASCADE;