diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-06 03:14:55 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-06 03:14:55 +0300 |
commit | d39c778244590f478537df87ed01dde2705350a8 (patch) | |
tree | 5792def7c7c01effeeea50eb7fba02d0a53b0169 /db | |
parent | b7d0ee2a31d4d8b8037c07cb1df7c123d2e754b5 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r-- | db/docs/resource_link_events.yml | 10 | ||||
-rw-r--r-- | db/migrate/20230313031351_create_resource_link_events.rb | 15 | ||||
-rw-r--r-- | db/migrate/20230329085754_add_foreign_key_to_resource_link_events_on_user.rb | 15 | ||||
-rw-r--r-- | db/migrate/20230403164454_add_fork_storage_size_columns_to_root_storage_statistics.rb | 11 | ||||
-rw-r--r-- | db/schema_migrations/20230313031351 | 1 | ||||
-rw-r--r-- | db/schema_migrations/20230329085754 | 1 | ||||
-rw-r--r-- | db/schema_migrations/20230403164454 | 1 | ||||
-rw-r--r-- | db/structure.sql | 43 |
8 files changed, 96 insertions, 1 deletions
diff --git a/db/docs/resource_link_events.yml b/db/docs/resource_link_events.yml new file mode 100644 index 00000000000..cfa04aa522c --- /dev/null +++ b/db/docs/resource_link_events.yml @@ -0,0 +1,10 @@ +--- +table_name: resource_link_events +classes: +- WorkItems::ResourceLinkEvent +feature_categories: +- planning_analytics +description: Records the change of parent link on work items along with timestamps +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/114394 +milestone: '15.11' +gitlab_schema: gitlab_main diff --git a/db/migrate/20230313031351_create_resource_link_events.rb b/db/migrate/20230313031351_create_resource_link_events.rb new file mode 100644 index 00000000000..03f00c9416b --- /dev/null +++ b/db/migrate/20230313031351_create_resource_link_events.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class CreateResourceLinkEvents < Gitlab::Database::Migration[2.1] + def change + create_table :resource_link_events do |t| + t.integer :action, limit: 2, null: false + t.bigint :user_id, null: false + t.references :issue, index: true, null: false, foreign_key: { on_delete: :cascade } + t.references :child_work_item, index: true, null: false, foreign_key: { to_table: :issues, on_delete: :cascade } + t.datetime_with_timezone :created_at, null: false + + t.index :user_id + end + end +end diff --git a/db/migrate/20230329085754_add_foreign_key_to_resource_link_events_on_user.rb b/db/migrate/20230329085754_add_foreign_key_to_resource_link_events_on_user.rb new file mode 100644 index 00000000000..6a167f232ae --- /dev/null +++ b/db/migrate/20230329085754_add_foreign_key_to_resource_link_events_on_user.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class AddForeignKeyToResourceLinkEventsOnUser < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :resource_link_events, :users, column: :user_id, on_delete: :nullify, validate: true + end + + def down + with_lock_retries do + remove_foreign_key_if_exists :resource_link_events, column: :user_id + end + end +end diff --git a/db/migrate/20230403164454_add_fork_storage_size_columns_to_root_storage_statistics.rb b/db/migrate/20230403164454_add_fork_storage_size_columns_to_root_storage_statistics.rb new file mode 100644 index 00000000000..3428fba669f --- /dev/null +++ b/db/migrate/20230403164454_add_fork_storage_size_columns_to_root_storage_statistics.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class AddForkStorageSizeColumnsToRootStorageStatistics < Gitlab::Database::Migration[2.1] + enable_lock_retries! + + def change + add_column :namespace_root_storage_statistics, :public_forks_storage_size, :bigint, default: 0, null: false + add_column :namespace_root_storage_statistics, :internal_forks_storage_size, :bigint, default: 0, null: false + add_column :namespace_root_storage_statistics, :private_forks_storage_size, :bigint, default: 0, null: false + end +end diff --git a/db/schema_migrations/20230313031351 b/db/schema_migrations/20230313031351 new file mode 100644 index 00000000000..37a57006cae --- /dev/null +++ b/db/schema_migrations/20230313031351 @@ -0,0 +1 @@ +44dc97ac36a6edcd0c0dba76f6b60204b72c005da7bd793af4ac7832d949bd0b
\ No newline at end of file diff --git a/db/schema_migrations/20230329085754 b/db/schema_migrations/20230329085754 new file mode 100644 index 00000000000..fd2687b225f --- /dev/null +++ b/db/schema_migrations/20230329085754 @@ -0,0 +1 @@ +52c5c662dc46313dece9ed9228af5ea2734f0fc4872ba0f6a762e77437b9564e
\ No newline at end of file diff --git a/db/schema_migrations/20230403164454 b/db/schema_migrations/20230403164454 new file mode 100644 index 00000000000..0283a3b1612 --- /dev/null +++ b/db/schema_migrations/20230403164454 @@ -0,0 +1 @@ +ff04f9ef9bb479b85223e361b96c921e25b436a86a0041627b595c3635848a5b
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 0266b37c320..06e4541147b 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -18623,7 +18623,10 @@ CREATE TABLE namespace_root_storage_statistics ( dependency_proxy_size bigint DEFAULT 0 NOT NULL, notification_level smallint DEFAULT 100 NOT NULL, container_registry_size bigint DEFAULT 0 NOT NULL, - registry_size_estimated boolean DEFAULT false NOT NULL + registry_size_estimated boolean DEFAULT false NOT NULL, + public_forks_storage_size bigint DEFAULT 0 NOT NULL, + internal_forks_storage_size bigint DEFAULT 0 NOT NULL, + private_forks_storage_size bigint DEFAULT 0 NOT NULL ); CREATE TABLE namespace_settings ( @@ -21740,6 +21743,24 @@ CREATE SEQUENCE resource_label_events_id_seq ALTER SEQUENCE resource_label_events_id_seq OWNED BY resource_label_events.id; +CREATE TABLE resource_link_events ( + id bigint NOT NULL, + action smallint NOT NULL, + user_id bigint NOT NULL, + issue_id bigint NOT NULL, + child_work_item_id bigint NOT NULL, + created_at timestamp with time zone NOT NULL +); + +CREATE SEQUENCE resource_link_events_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE resource_link_events_id_seq OWNED BY resource_link_events.id; + CREATE TABLE resource_milestone_events ( id bigint NOT NULL, user_id bigint, @@ -25341,6 +25362,8 @@ ALTER TABLE ONLY resource_iteration_events ALTER COLUMN id SET DEFAULT nextval(' ALTER TABLE ONLY resource_label_events ALTER COLUMN id SET DEFAULT nextval('resource_label_events_id_seq'::regclass); +ALTER TABLE ONLY resource_link_events ALTER COLUMN id SET DEFAULT nextval('resource_link_events_id_seq'::regclass); + ALTER TABLE ONLY resource_milestone_events ALTER COLUMN id SET DEFAULT nextval('resource_milestone_events_id_seq'::regclass); ALTER TABLE ONLY resource_state_events ALTER COLUMN id SET DEFAULT nextval('resource_state_events_id_seq'::regclass); @@ -27703,6 +27726,9 @@ ALTER TABLE ONLY resource_iteration_events ALTER TABLE ONLY resource_label_events ADD CONSTRAINT resource_label_events_pkey PRIMARY KEY (id); +ALTER TABLE ONLY resource_link_events + ADD CONSTRAINT resource_link_events_pkey PRIMARY KEY (id); + ALTER TABLE ONLY resource_milestone_events ADD CONSTRAINT resource_milestone_events_pkey PRIMARY KEY (id); @@ -31928,6 +31954,12 @@ CREATE INDEX index_resource_label_events_on_merge_request_id_label_id_action ON CREATE INDEX index_resource_label_events_on_user_id ON resource_label_events USING btree (user_id); +CREATE INDEX index_resource_link_events_on_child_work_item_id ON resource_link_events USING btree (child_work_item_id); + +CREATE INDEX index_resource_link_events_on_issue_id ON resource_link_events USING btree (issue_id); + +CREATE INDEX index_resource_link_events_on_user_id ON resource_link_events USING btree (user_id); + CREATE INDEX index_resource_milestone_events_created_at ON resource_milestone_events USING btree (created_at); CREATE INDEX index_resource_milestone_events_on_issue_id ON resource_milestone_events USING btree (issue_id); @@ -34950,6 +34982,9 @@ ALTER TABLE ONLY namespace_bans ALTER TABLE ONLY gitlab_subscriptions ADD CONSTRAINT fk_bd0c4019c3 FOREIGN KEY (hosted_plan_id) REFERENCES plans(id) ON DELETE CASCADE; +ALTER TABLE ONLY resource_link_events + ADD CONSTRAINT fk_bd4ae15ce4 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL; + ALTER TABLE ONLY metrics_users_starred_dashboards ADD CONSTRAINT fk_bd6ae32fac FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE; @@ -35310,6 +35345,9 @@ ALTER TABLE ONLY audit_events_external_audit_event_destinations ALTER TABLE ONLY operations_user_lists ADD CONSTRAINT fk_rails_0c716e079b FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; +ALTER TABLE ONLY resource_link_events + ADD CONSTRAINT fk_rails_0cea73eba5 FOREIGN KEY (child_work_item_id) REFERENCES issues(id) ON DELETE CASCADE; + ALTER TABLE ONLY geo_node_statuses ADD CONSTRAINT fk_rails_0ecc699c2a FOREIGN KEY (geo_node_id) REFERENCES geo_nodes(id) ON DELETE CASCADE; @@ -36696,6 +36734,9 @@ ALTER TABLE ONLY merge_request_reviewers ALTER TABLE ONLY ci_running_builds ADD CONSTRAINT fk_rails_da45cfa165_p FOREIGN KEY (partition_id, build_id) REFERENCES ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE; +ALTER TABLE ONLY resource_link_events + ADD CONSTRAINT fk_rails_da5dd8a56f FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE; + ALTER TABLE ONLY jira_imports ADD CONSTRAINT fk_rails_da617096ce FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL; |