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>2021-02-17 18:09:21 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-02-17 18:09:21 +0300
commitc982bb363b3a0390a274197f410a1609a4667760 (patch)
tree8be9521106e8e9af432d179f03c5b3af11a0e207 /db
parent75a4eaade04ee758bb3b253f27bf1c20c67991f0 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20201228110136_create_iterations_cadence.rb29
-rw-r--r--db/migrate/20201228110238_add_iterations_cadence_to_sprints.rb22
-rw-r--r--db/post_migrate/20201231133921_schedule_set_default_iteration_cadences.rb30
-rw-r--r--db/schema_migrations/202012281101361
-rw-r--r--db/schema_migrations/202012281102381
-rw-r--r--db/schema_migrations/202012311339211
-rw-r--r--db/structure.sql40
7 files changed, 124 insertions, 0 deletions
diff --git a/db/migrate/20201228110136_create_iterations_cadence.rb b/db/migrate/20201228110136_create_iterations_cadence.rb
new file mode 100644
index 00000000000..95601ab4b29
--- /dev/null
+++ b/db/migrate/20201228110136_create_iterations_cadence.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+class CreateIterationsCadence < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ create_table_with_constraints :iterations_cadences do |t|
+ t.references :group, null: false, foreign_key: { to_table: :namespaces, on_delete: :cascade }
+ t.timestamps_with_timezone null: false
+ t.date :start_date, null: false
+ t.date :last_run_date
+ t.integer :duration_in_weeks
+ t.integer :iterations_in_advance
+ t.boolean :active, default: true, null: false
+ t.boolean :automatic, default: true, null: false
+ t.text :title, null: false
+
+ t.text_limit :title, 255
+ end
+ end
+
+ def down
+ drop_table :iterations_cadences if table_exists?(:iterations_cadences)
+ end
+end
diff --git a/db/migrate/20201228110238_add_iterations_cadence_to_sprints.rb b/db/migrate/20201228110238_add_iterations_cadence_to_sprints.rb
new file mode 100644
index 00000000000..9d9026a265b
--- /dev/null
+++ b/db/migrate/20201228110238_add_iterations_cadence_to_sprints.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+class AddIterationsCadenceToSprints < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_sprints_iterations_cadence_id'
+
+ def up
+ add_column :sprints, :iterations_cadence_id, :integer unless column_exists?(:sprints, :iterations_cadence_id)
+
+ add_concurrent_index :sprints, :iterations_cadence_id, name: INDEX_NAME
+ add_concurrent_foreign_key :sprints, :iterations_cadences, column: :iterations_cadence_id, on_delete: :cascade
+ end
+
+ def down
+ remove_column :sprints, :iterations_cadence_id if column_exists?(:sprints, :iterations_cadence_id)
+ end
+end
diff --git a/db/post_migrate/20201231133921_schedule_set_default_iteration_cadences.rb b/db/post_migrate/20201231133921_schedule_set_default_iteration_cadences.rb
new file mode 100644
index 00000000000..2de47915a2f
--- /dev/null
+++ b/db/post_migrate/20201231133921_schedule_set_default_iteration_cadences.rb
@@ -0,0 +1,30 @@
+# frozen_string_literal: true
+
+class ScheduleSetDefaultIterationCadences < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ BATCH_SIZE = 1_000
+ DELAY_INTERVAL = 2.minutes.to_i
+ MIGRATION_CLASS = 'SetDefaultIterationCadences'
+
+ class Iteration < ActiveRecord::Base # rubocop:disable Style/Documentation
+ include EachBatch
+
+ self.table_name = 'sprints'
+ end
+
+ disable_ddl_transaction!
+
+ def up
+ Iteration.select(:group_id).distinct.each_batch(of: BATCH_SIZE, column: :group_id) do |batch, index|
+ group_ids = batch.pluck(:group_id)
+
+ migrate_in(index * DELAY_INTERVAL, MIGRATION_CLASS, group_ids)
+ end
+ end
+
+ def down
+ # Not needed
+ end
+end
diff --git a/db/schema_migrations/20201228110136 b/db/schema_migrations/20201228110136
new file mode 100644
index 00000000000..51496856ff9
--- /dev/null
+++ b/db/schema_migrations/20201228110136
@@ -0,0 +1 @@
+6488e3542276042f302d79533e3e84c43a4ef471535137bcef11e73a0e4d961f \ No newline at end of file
diff --git a/db/schema_migrations/20201228110238 b/db/schema_migrations/20201228110238
new file mode 100644
index 00000000000..300b53bacee
--- /dev/null
+++ b/db/schema_migrations/20201228110238
@@ -0,0 +1 @@
+7be98c4f62df9fd837f7a547916dd5481c0b4da2d4fc6680b104b2a998be1eed \ No newline at end of file
diff --git a/db/schema_migrations/20201231133921 b/db/schema_migrations/20201231133921
new file mode 100644
index 00000000000..40f792eac8f
--- /dev/null
+++ b/db/schema_migrations/20201231133921
@@ -0,0 +1 @@
+26bf4abb73a53f71fbcb8b5cd1ae1e1539ec59e7052b3bbed95ab1de3fda3de7 \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index 97a2850fd5c..0c69654f13e 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -13544,6 +13544,30 @@ CREATE TABLE issues_self_managed_prometheus_alert_events (
updated_at timestamp with time zone NOT NULL
);
+CREATE TABLE iterations_cadences (
+ id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ start_date date NOT NULL,
+ last_run_date date,
+ duration_in_weeks integer,
+ iterations_in_advance integer,
+ active boolean DEFAULT true NOT NULL,
+ automatic boolean DEFAULT true NOT NULL,
+ title text NOT NULL,
+ CONSTRAINT check_fedff82d3b CHECK ((char_length(title) <= 255))
+);
+
+CREATE SEQUENCE iterations_cadences_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE iterations_cadences_id_seq OWNED BY iterations_cadences.id;
+
CREATE TABLE jira_connect_installations (
id bigint NOT NULL,
client_key character varying,
@@ -17357,6 +17381,7 @@ CREATE TABLE sprints (
description text,
description_html text,
state_enum smallint DEFAULT 1 NOT NULL,
+ iterations_cadence_id integer,
CONSTRAINT sprints_must_belong_to_project_or_group CHECK ((((project_id <> NULL::bigint) AND (group_id IS NULL)) OR ((group_id <> NULL::bigint) AND (project_id IS NULL)))),
CONSTRAINT sprints_title CHECK ((char_length(title) <= 255))
);
@@ -19068,6 +19093,8 @@ ALTER TABLE ONLY issue_user_mentions ALTER COLUMN id SET DEFAULT nextval('issue_
ALTER TABLE ONLY issues ALTER COLUMN id SET DEFAULT nextval('issues_id_seq'::regclass);
+ALTER TABLE ONLY iterations_cadences ALTER COLUMN id SET DEFAULT nextval('iterations_cadences_id_seq'::regclass);
+
ALTER TABLE ONLY jira_connect_installations ALTER COLUMN id SET DEFAULT nextval('jira_connect_installations_id_seq'::regclass);
ALTER TABLE ONLY jira_connect_subscriptions ALTER COLUMN id SET DEFAULT nextval('jira_connect_subscriptions_id_seq'::regclass);
@@ -20368,6 +20395,9 @@ ALTER TABLE ONLY sprints
ALTER TABLE ONLY sprints
ADD CONSTRAINT iteration_start_and_due_daterange_project_id_constraint EXCLUDE USING gist (project_id WITH =, daterange(start_date, due_date, '[]'::text) WITH &&) WHERE ((project_id IS NOT NULL));
+ALTER TABLE ONLY iterations_cadences
+ ADD CONSTRAINT iterations_cadences_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY jira_connect_installations
ADD CONSTRAINT jira_connect_installations_pkey PRIMARY KEY (id);
@@ -22441,6 +22471,8 @@ CREATE INDEX index_issues_on_updated_at ON issues USING btree (updated_at);
CREATE INDEX index_issues_on_updated_by_id ON issues USING btree (updated_by_id) WHERE (updated_by_id IS NOT NULL);
+CREATE INDEX index_iterations_cadences_on_group_id ON iterations_cadences USING btree (group_id);
+
CREATE UNIQUE INDEX index_jira_connect_installations_on_client_key ON jira_connect_installations USING btree (client_key);
CREATE INDEX index_jira_connect_subscriptions_on_namespace_id ON jira_connect_subscriptions USING btree (namespace_id);
@@ -23431,6 +23463,8 @@ CREATE UNIQUE INDEX index_sop_configs_on_project_id ON security_orchestration_po
CREATE UNIQUE INDEX index_sop_configs_on_security_policy_management_project_id ON security_orchestration_policy_configurations USING btree (security_policy_management_project_id);
+CREATE INDEX index_sprints_iterations_cadence_id ON sprints USING btree (iterations_cadence_id);
+
CREATE INDEX index_sprints_on_description_trigram ON sprints USING gin (description gin_trgm_ops);
CREATE INDEX index_sprints_on_due_date ON sprints USING btree (due_date);
@@ -24268,6 +24302,9 @@ ALTER TABLE ONLY namespaces
ALTER TABLE ONLY epics
ADD CONSTRAINT fk_3654b61b03 FOREIGN KEY (author_id) REFERENCES users(id) ON DELETE CASCADE;
+ALTER TABLE ONLY sprints
+ ADD CONSTRAINT fk_365d1db505 FOREIGN KEY (iterations_cadence_id) REFERENCES iterations_cadences(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY push_event_payloads
ADD CONSTRAINT fk_36c74129da FOREIGN KEY (event_id) REFERENCES events(id) ON DELETE CASCADE;
@@ -26143,6 +26180,9 @@ ALTER TABLE ONLY alert_management_alert_user_mentions
ALTER TABLE ONLY snippet_statistics
ADD CONSTRAINT fk_rails_ebc283ccf1 FOREIGN KEY (snippet_id) REFERENCES snippets(id) ON DELETE CASCADE;
+ALTER TABLE ONLY iterations_cadences
+ ADD CONSTRAINT fk_rails_ece400c55a FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY dast_profiles
ADD CONSTRAINT fk_rails_ed1e66fbbf FOREIGN KEY (dast_site_profile_id) REFERENCES dast_site_profiles(id) ON DELETE CASCADE;