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:
Diffstat (limited to 'db')
-rw-r--r--db/docs/dora_daily_metrics.yml1
-rw-r--r--db/docs/dora_performance_scores.yml10
-rw-r--r--db/migrate/20230307212637_remove_create_learn_gitlab_worker_job_instances.rb13
-rw-r--r--db/migrate/20230323120601_create_dora_performance_scores.rb16
-rw-r--r--db/migrate/20230323191750_add_shard_settings_to_search_indices.rb8
-rw-r--r--db/migrate/20230327123333_backfill_product_analytics_data_collector_host.rb20
-rw-r--r--db/post_migrate/20230317151841_remove_from_to_state_constraint.rb21
-rw-r--r--db/post_migrate/20230322085041_remove_user_namespace_records_from_vsa_aggregation.rb26
-rw-r--r--db/schema_migrations/202303072126371
-rw-r--r--db/schema_migrations/202303171518411
-rw-r--r--db/schema_migrations/202303220850411
-rw-r--r--db/schema_migrations/202303231206011
-rw-r--r--db/schema_migrations/202303231917501
-rw-r--r--db/schema_migrations/202303271233331
-rw-r--r--db/structure.sql32
15 files changed, 152 insertions, 1 deletions
diff --git a/db/docs/dora_daily_metrics.yml b/db/docs/dora_daily_metrics.yml
index 52ffdfc7f1b..abd5e256686 100644
--- a/db/docs/dora_daily_metrics.yml
+++ b/db/docs/dora_daily_metrics.yml
@@ -4,6 +4,7 @@ classes:
- Dora::DailyMetrics
feature_categories:
- continuous_delivery
+- value_stream_management
description: Stores daily snapshots of DORA4 metrics per environment.
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/55473
milestone: '13.10'
diff --git a/db/docs/dora_performance_scores.yml b/db/docs/dora_performance_scores.yml
new file mode 100644
index 00000000000..e164cbcd91d
--- /dev/null
+++ b/db/docs/dora_performance_scores.yml
@@ -0,0 +1,10 @@
+---
+table_name: dora_performance_scores
+classes:
+- Dora::PerformanceScore
+feature_categories:
+- value_stream_management
+description: Stores monthly snapshots of DORA4 metric values per project.
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/115689
+milestone: '15.11'
+gitlab_schema: gitlab_main
diff --git a/db/migrate/20230307212637_remove_create_learn_gitlab_worker_job_instances.rb b/db/migrate/20230307212637_remove_create_learn_gitlab_worker_job_instances.rb
new file mode 100644
index 00000000000..d3b6ee2ffd8
--- /dev/null
+++ b/db/migrate/20230307212637_remove_create_learn_gitlab_worker_job_instances.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class RemoveCreateLearnGitlabWorkerJobInstances < Gitlab::Database::Migration[2.1]
+ DEPRECATED_JOB_CLASSES = %w[Onboarding::CreateLearnGitlabWorker]
+
+ def up
+ sidekiq_remove_jobs(job_klasses: DEPRECATED_JOB_CLASSES)
+ end
+
+ def down
+ # This migration removes any instances of deprecated workers and cannot be undone.
+ end
+end
diff --git a/db/migrate/20230323120601_create_dora_performance_scores.rb b/db/migrate/20230323120601_create_dora_performance_scores.rb
new file mode 100644
index 00000000000..2c4304fedb6
--- /dev/null
+++ b/db/migrate/20230323120601_create_dora_performance_scores.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+class CreateDoraPerformanceScores < Gitlab::Database::Migration[2.1]
+ def change
+ create_table :dora_performance_scores do |t|
+ t.references :project, null: false, foreign_key: { on_delete: :cascade }, index: false
+ t.date :date, null: false
+ t.integer :deployment_frequency, limit: 2
+ t.integer :lead_time_for_changes, limit: 2
+ t.integer :time_to_restore_service, limit: 2
+ t.integer :change_failure_rate, limit: 2
+
+ t.index [:project_id, :date], unique: true
+ end
+ end
+end
diff --git a/db/migrate/20230323191750_add_shard_settings_to_search_indices.rb b/db/migrate/20230323191750_add_shard_settings_to_search_indices.rb
new file mode 100644
index 00000000000..b032e3b8a61
--- /dev/null
+++ b/db/migrate/20230323191750_add_shard_settings_to_search_indices.rb
@@ -0,0 +1,8 @@
+# frozen_string_literal: true
+
+class AddShardSettingsToSearchIndices < Gitlab::Database::Migration[2.1]
+ def change
+ add_column :search_indices, :number_of_shards, :integer, default: 2, null: false
+ add_column :search_indices, :number_of_replicas, :integer, default: 1, null: false
+ end
+end
diff --git a/db/migrate/20230327123333_backfill_product_analytics_data_collector_host.rb b/db/migrate/20230327123333_backfill_product_analytics_data_collector_host.rb
new file mode 100644
index 00000000000..04041d78c3e
--- /dev/null
+++ b/db/migrate/20230327123333_backfill_product_analytics_data_collector_host.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+class BackfillProductAnalyticsDataCollectorHost < Gitlab::Database::Migration[2.1]
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ def up
+ # fills product_analytics_data_collector_host by replacing jitsu_host subdomain with collector
+ regex = "'://(.+?\\.)'"
+ replace_with = "'://collector.'"
+ execute <<~SQL
+ UPDATE application_settings
+ SET product_analytics_data_collector_host = regexp_replace(jitsu_host, #{regex}, #{replace_with}, 'g')
+ WHERE jitsu_host IS NOT NULL AND product_analytics_data_collector_host IS NULL
+ SQL
+ end
+
+ def down
+ # noop
+ end
+end
diff --git a/db/post_migrate/20230317151841_remove_from_to_state_constraint.rb b/db/post_migrate/20230317151841_remove_from_to_state_constraint.rb
new file mode 100644
index 00000000000..21913d394d1
--- /dev/null
+++ b/db/post_migrate/20230317151841_remove_from_to_state_constraint.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class RemoveFromToStateConstraint < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ def up
+ constraint_name = check_constraint_name(
+ 'vulnerability_state_transitions',
+ 'fully_qualified_table_name',
+ 'state_not_equal')
+ remove_check_constraint(:vulnerability_state_transitions, constraint_name)
+ end
+
+ def down
+ constraint_name = check_constraint_name(
+ 'vulnerability_state_transitions',
+ 'fully_qualified_table_name',
+ 'state_not_equal')
+ add_check_constraint(:vulnerability_state_transitions, '(from_state != to_state)', constraint_name)
+ end
+end
diff --git a/db/post_migrate/20230322085041_remove_user_namespace_records_from_vsa_aggregation.rb b/db/post_migrate/20230322085041_remove_user_namespace_records_from_vsa_aggregation.rb
new file mode 100644
index 00000000000..6fc23c742b9
--- /dev/null
+++ b/db/post_migrate/20230322085041_remove_user_namespace_records_from_vsa_aggregation.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+class RemoveUserNamespaceRecordsFromVsaAggregation < Gitlab::Database::Migration[2.1]
+ BATCH_SIZE = 100
+
+ disable_ddl_transaction!
+
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ def up
+ aggregations_model = define_batchable_model('analytics_cycle_analytics_aggregations')
+ namespaces_model = define_batchable_model('namespaces')
+
+ aggregations_model.each_batch(of: BATCH_SIZE) do |relation|
+ inner_query = namespaces_model
+ .where(type: 'Group')
+ .where(aggregations_model.arel_table[:group_id].eq(namespaces_model.arel_table[:id]))
+
+ relation.where('NOT EXISTS (?)', inner_query).delete_all
+ end
+ end
+
+ def down
+ # noop
+ end
+end
diff --git a/db/schema_migrations/20230307212637 b/db/schema_migrations/20230307212637
new file mode 100644
index 00000000000..40ccae95b4b
--- /dev/null
+++ b/db/schema_migrations/20230307212637
@@ -0,0 +1 @@
+7fb5c19271b7216bff37791edc542b8b7cc4826f1812f596d205248eb6a637df \ No newline at end of file
diff --git a/db/schema_migrations/20230317151841 b/db/schema_migrations/20230317151841
new file mode 100644
index 00000000000..69085045c8a
--- /dev/null
+++ b/db/schema_migrations/20230317151841
@@ -0,0 +1 @@
+95bcf074127993a57bc6aaf04b64717a2c49d7886838ab0e7194807475fcdee1 \ No newline at end of file
diff --git a/db/schema_migrations/20230322085041 b/db/schema_migrations/20230322085041
new file mode 100644
index 00000000000..6ffba798585
--- /dev/null
+++ b/db/schema_migrations/20230322085041
@@ -0,0 +1 @@
+17a8493fb1da422753efbd3bfb0d02574470eb6bf06f8302a9b360d02aa5e55d \ No newline at end of file
diff --git a/db/schema_migrations/20230323120601 b/db/schema_migrations/20230323120601
new file mode 100644
index 00000000000..1b4d275a1d0
--- /dev/null
+++ b/db/schema_migrations/20230323120601
@@ -0,0 +1 @@
+6ff846d6485dfccfef23e48fcbdf1f2ad8672371e6865bb436e39c7578ec357b \ No newline at end of file
diff --git a/db/schema_migrations/20230323191750 b/db/schema_migrations/20230323191750
new file mode 100644
index 00000000000..7aace5fdc8e
--- /dev/null
+++ b/db/schema_migrations/20230323191750
@@ -0,0 +1 @@
+b8285d96d0e769f6ec6cf0b7a7e9a88dff978029b252b915ca9caff5a364912d \ No newline at end of file
diff --git a/db/schema_migrations/20230327123333 b/db/schema_migrations/20230327123333
new file mode 100644
index 00000000000..2789700b74d
--- /dev/null
+++ b/db/schema_migrations/20230327123333
@@ -0,0 +1 @@
+3009fe920b44aed313dd4371ab06861a74333e515349f07e361a655339fc17d2 \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index a6c37efbb75..682169aff3a 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -15493,6 +15493,25 @@ CREATE SEQUENCE dora_daily_metrics_id_seq
ALTER SEQUENCE dora_daily_metrics_id_seq OWNED BY dora_daily_metrics.id;
+CREATE TABLE dora_performance_scores (
+ id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ date date NOT NULL,
+ deployment_frequency smallint,
+ lead_time_for_changes smallint,
+ time_to_restore_service smallint,
+ change_failure_rate smallint
+);
+
+CREATE SEQUENCE dora_performance_scores_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE dora_performance_scores_id_seq OWNED BY dora_performance_scores.id;
+
CREATE TABLE draft_notes (
id bigint NOT NULL,
merge_request_id integer NOT NULL,
@@ -22024,6 +22043,8 @@ CREATE TABLE search_indices (
bucket_number integer,
path text NOT NULL,
type text NOT NULL,
+ number_of_shards integer DEFAULT 2 NOT NULL,
+ number_of_replicas integer DEFAULT 1 NOT NULL,
CONSTRAINT check_75c11e6d37 CHECK ((char_length(type) <= 255)),
CONSTRAINT check_ab47e7ff85 CHECK ((char_length(path) <= 255))
);
@@ -23986,7 +24007,6 @@ CREATE TABLE vulnerability_state_transitions (
comment text,
dismissal_reason smallint,
state_changed_at_pipeline_id bigint,
- CONSTRAINT check_d1ca8ec043 CHECK ((from_state <> to_state)),
CONSTRAINT check_fe2eb6a0f3 CHECK ((char_length(comment) <= 50000))
);
@@ -24760,6 +24780,8 @@ ALTER TABLE ONLY dora_configurations ALTER COLUMN id SET DEFAULT nextval('dora_c
ALTER TABLE ONLY dora_daily_metrics ALTER COLUMN id SET DEFAULT nextval('dora_daily_metrics_id_seq'::regclass);
+ALTER TABLE ONLY dora_performance_scores ALTER COLUMN id SET DEFAULT nextval('dora_performance_scores_id_seq'::regclass);
+
ALTER TABLE ONLY draft_notes ALTER COLUMN id SET DEFAULT nextval('draft_notes_id_seq'::regclass);
ALTER TABLE ONLY elastic_index_settings ALTER COLUMN id SET DEFAULT nextval('elastic_index_settings_id_seq'::regclass);
@@ -26728,6 +26750,9 @@ ALTER TABLE ONLY dora_configurations
ALTER TABLE ONLY dora_daily_metrics
ADD CONSTRAINT dora_daily_metrics_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY dora_performance_scores
+ ADD CONSTRAINT dora_performance_scores_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY draft_notes
ADD CONSTRAINT draft_notes_pkey PRIMARY KEY (id);
@@ -30214,6 +30239,8 @@ CREATE UNIQUE INDEX index_dora_configurations_on_project_id ON dora_configuratio
CREATE UNIQUE INDEX index_dora_daily_metrics_on_environment_id_and_date ON dora_daily_metrics USING btree (environment_id, date);
+CREATE UNIQUE INDEX index_dora_performance_scores_on_project_id_and_date ON dora_performance_scores USING btree (project_id, date);
+
CREATE INDEX index_draft_notes_on_author_id ON draft_notes USING btree (author_id);
CREATE INDEX index_draft_notes_on_discussion_id ON draft_notes USING btree (discussion_id);
@@ -35604,6 +35631,9 @@ ALTER TABLE ONLY packages_dependency_links
ALTER TABLE ONLY project_auto_devops
ADD CONSTRAINT fk_rails_45436b12b2 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
+ALTER TABLE ONLY dora_performance_scores
+ ADD CONSTRAINT fk_rails_455f9acc65 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY merge_requests_closing_issues
ADD CONSTRAINT fk_rails_458eda8667 FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE;