diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 11:59:07 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 11:59:07 +0000 |
commit | 8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca (patch) | |
tree | 544930fb309b30317ae9797a9683768705d664c4 /db | |
parent | 4b1de649d0168371549608993deac953eb692019 (diff) | |
download | gitlab-ce-8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca.tar.gz |
Add latest changes from gitlab-org/gitlab@13-7-stable-eev13.7.0-rc42
Diffstat (limited to 'db')
201 files changed, 3113 insertions, 58 deletions
diff --git a/db/fixtures/development/17_cycle_analytics.rb b/db/fixtures/development/17_cycle_analytics.rb index 57993061c58..826e703a443 100644 --- a/db/fixtures/development/17_cycle_analytics.rb +++ b/db/fixtures/development/17_cycle_analytics.rb @@ -7,21 +7,21 @@ require './spec/support/helpers/test_env' # # Simple invocation always creates a new project: # -# FILTER=cycle_analytics SEED_CYCLE_ANALYTICS=1 bundle exec rake db:seed_fu +# FILTER=cycle_analytics SEED_VSA=1 bundle exec rake db:seed_fu # # Create more issues/MRs: # -# CYCLE_ANALYTICS_ISSUE_COUNT=100 FILTER=cycle_analytics SEED_CYCLE_ANALYTICS=1 bundle exec rake db:seed_fu +# VSA_ISSUE_COUNT=100 FILTER=cycle_analytics SEED_VSA=1 bundle exec rake db:seed_fu # # Run for an existing project # -# CYCLE_ANALYTICS_SEED_PROJECT_ID=10 FILTER=cycle_analytics SEED_CYCLE_ANALYTICS=1 bundle exec rake db:seed_fu +# VSA_SEED_PROJECT_ID=10 FILTER=cycle_analytics SEED_VSA=1 bundle exec rake db:seed_fu class Gitlab::Seeder::CycleAnalytics attr_reader :project, :issues, :merge_requests, :developers - FLAG = 'SEED_CYCLE_ANALYTICS' - PERF_TEST = 'CYCLE_ANALYTICS_PERF_TEST' + FLAG = 'SEED_VSA' + PERF_TEST = 'VSA_PERF_TEST' ISSUE_STAGE_MAX_DURATION_IN_HOURS = 72 PLAN_STAGE_MAX_DURATION_IN_HOURS = 48 @@ -40,7 +40,7 @@ class Gitlab::Seeder::CycleAnalytics def initialize(project: nil, perf: false) @project = project || create_new_vsm_project - @issue_count = perf ? 1000 : ENV.fetch('CYCLE_ANALYTICS_ISSUE_COUNT', 5).to_i + @issue_count = perf ? 1000 : ENV.fetch('VSA_ISSUE_COUNT', 5).to_i @issues = [] @merge_requests = [] @developers = [] @@ -195,7 +195,7 @@ class Gitlab::Seeder::CycleAnalytics end Gitlab::Seeder.quiet do - project_id = ENV['CYCLE_ANALYTICS_SEED_PROJECT_ID'] + project_id = ENV['VSA_SEED_PROJECT_ID'] project = Project.find(project_id) if project_id seeder = Gitlab::Seeder::CycleAnalytics.seeder_based_on_env(project) diff --git a/db/fixtures/development/19_environments.rb b/db/fixtures/development/19_environments.rb index 124f9d74ddd..0f9188164c9 100644 --- a/db/fixtures/development/19_environments.rb +++ b/db/fixtures/development/19_environments.rb @@ -6,7 +6,6 @@ class Gitlab::Seeder::Environments end def seed! - @project.create_mock_deployment_service!(active: true) @project.create_mock_monitoring_service!(active: true) create_master_deployments!('production') diff --git a/db/migrate/20200913115700_add_kroki_application_settings.rb b/db/migrate/20200913115700_add_kroki_application_settings.rb new file mode 100644 index 00000000000..84d490c2980 --- /dev/null +++ b/db/migrate/20200913115700_add_kroki_application_settings.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class AddKrokiApplicationSettings < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + # rubocop:disable Migration/AddLimitToTextColumns + # limit is added in 20201011005400_add_text_limit_to_application_settings_kroki_url.rb + # + def change + add_column :application_settings, :kroki_url, :text + add_column :application_settings, :kroki_enabled, :boolean, default: false, null: false + end + # rubocop:enable Migration/AddLimitToTextColumns +end diff --git a/db/migrate/20201011005400_add_text_limit_to_application_settings_kroki_url.rb b/db/migrate/20201011005400_add_text_limit_to_application_settings_kroki_url.rb new file mode 100644 index 00000000000..96427cc3454 --- /dev/null +++ b/db/migrate/20201011005400_add_text_limit_to_application_settings_kroki_url.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddTextLimitToApplicationSettingsKrokiUrl < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_text_limit :application_settings, :kroki_url, 1024 + end + + def down + # Down is required as `add_text_limit` is not reversible + # + remove_text_limit :application_settings, :kroki_url + end +end diff --git a/db/migrate/20201021155606_add_analytics_access_level_to_project_features.rb b/db/migrate/20201021155606_add_analytics_access_level_to_project_features.rb new file mode 100644 index 00000000000..faedbced06b --- /dev/null +++ b/db/migrate/20201021155606_add_analytics_access_level_to_project_features.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# See https://docs.gitlab.com/ee/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class AddAnalyticsAccessLevelToProjectFeatures < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + # Set this constant to true if this migration requires downtime. + DOWNTIME = false + + def up + with_lock_retries do + add_column :project_features, :analytics_access_level, :integer, default: 20, null: false + end + end + + def down + with_lock_retries do + remove_column :project_features, :analytics_access_level, :integer + end + end +end diff --git a/db/migrate/20201029144524_add_index_to_releases.rb b/db/migrate/20201029144524_add_index_to_releases.rb new file mode 100644 index 00000000000..fbffa1453af --- /dev/null +++ b/db/migrate/20201029144524_add_index_to_releases.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddIndexToReleases < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INDEX_NAME = 'index_releases_on_released_at' + + disable_ddl_transaction! + + def up + add_concurrent_index :releases, :released_at, name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :releases, INDEX_NAME + end +end diff --git a/db/migrate/20201030223933_add_ci_pipeline_deployments_to_plan_limits.rb b/db/migrate/20201030223933_add_ci_pipeline_deployments_to_plan_limits.rb new file mode 100644 index 00000000000..60f0ff9d6ed --- /dev/null +++ b/db/migrate/20201030223933_add_ci_pipeline_deployments_to_plan_limits.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddCiPipelineDeploymentsToPlanLimits < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + add_column :plan_limits, :ci_pipeline_deployments, :integer, default: 500, null: false + end +end diff --git a/db/migrate/20201103045515_add_issuable_metric_images.rb b/db/migrate/20201103045515_add_issuable_metric_images.rb new file mode 100644 index 00000000000..c598bb468a1 --- /dev/null +++ b/db/migrate/20201103045515_add_issuable_metric_images.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +class AddIssuableMetricImages < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + unless table_exists?(:issuable_metric_images) + with_lock_retries do + create_table :issuable_metric_images do |t| + t.references :issue, null: false, index: true, foreign_key: { on_delete: :cascade } + t.timestamps_with_timezone + t.integer :file_store, limit: 2 + t.text :file, null: false + t.text :url + end + end + end + + add_text_limit(:issuable_metric_images, :url, 255) + add_text_limit(:issuable_metric_images, :file, 255) + end + + def down + with_lock_retries do + drop_table :issuable_metric_images + end + end +end diff --git a/db/migrate/20201104142036_add_index_to_merge_request_metrics_target_project_id.rb b/db/migrate/20201104142036_add_index_to_merge_request_metrics_target_project_id.rb new file mode 100644 index 00000000000..348a3387b6f --- /dev/null +++ b/db/migrate/20201104142036_add_index_to_merge_request_metrics_target_project_id.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddIndexToMergeRequestMetricsTargetProjectId < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INDEX_NAME = 'index_mr_metrics_on_target_project_id_merged_at_time_to_merge' + + disable_ddl_transaction! + + def up + add_concurrent_index :merge_request_metrics, [:target_project_id, :merged_at, :created_at], where: 'merged_at > created_at', name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name(:merge_request_metrics, INDEX_NAME) + end +end diff --git a/db/migrate/20201106135608_remove_redundant_pipelines_index.rb b/db/migrate/20201106135608_remove_redundant_pipelines_index.rb new file mode 100644 index 00000000000..03e757c0ec1 --- /dev/null +++ b/db/migrate/20201106135608_remove_redundant_pipelines_index.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class RemoveRedundantPipelinesIndex < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + remove_concurrent_index_by_name :ci_pipelines, :index_ci_pipelines_on_project_id_and_created_at + end + + def down + add_concurrent_index :ci_pipelines, [:project_id, :created_at] + end +end diff --git a/db/migrate/20201106193452_add_converted_at_to_experiment_users.rb b/db/migrate/20201106193452_add_converted_at_to_experiment_users.rb new file mode 100644 index 00000000000..5391093516b --- /dev/null +++ b/db/migrate/20201106193452_add_converted_at_to_experiment_users.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddConvertedAtToExperimentUsers < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + add_column :experiment_users, :converted_at, :datetime_with_timezone + end +end diff --git a/db/migrate/20201109080645_create_vulnerability_remediations_table.rb b/db/migrate/20201109080645_create_vulnerability_remediations_table.rb new file mode 100644 index 00000000000..b00ce797c7d --- /dev/null +++ b/db/migrate/20201109080645_create_vulnerability_remediations_table.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +class CreateVulnerabilityRemediationsTable < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + create_table :vulnerability_remediations, if_not_exists: true do |t| + t.timestamps_with_timezone + + t.integer :file_store, limit: 2 + t.text :summary, null: false + t.text :file, null: false + end + + add_text_limit :vulnerability_remediations, :summary, 200 + add_text_limit :vulnerability_remediations, :file, 255 + end + + def down + drop_table :vulnerability_remediations + end +end diff --git a/db/migrate/20201109080646_create_vulnerability_findings_remediations_join_table.rb b/db/migrate/20201109080646_create_vulnerability_findings_remediations_join_table.rb new file mode 100644 index 00000000000..157f0de0821 --- /dev/null +++ b/db/migrate/20201109080646_create_vulnerability_findings_remediations_join_table.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class CreateVulnerabilityFindingsRemediationsJoinTable < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + create_table :vulnerability_findings_remediations do |t| + t.references :vulnerability_occurrence, index: false, foreign_key: { on_delete: :cascade } + t.references :vulnerability_remediation, index: { name: 'index_vulnerability_findings_remediations_on_remediation_id' }, foreign_key: { on_delete: :cascade } + + t.timestamps_with_timezone + + t.index [:vulnerability_occurrence_id, :vulnerability_remediation_id], unique: true, name: 'index_vulnerability_findings_remediations_on_unique_keys' + end + end +end diff --git a/db/migrate/20201110221400_create_experiment_subjects.rb b/db/migrate/20201110221400_create_experiment_subjects.rb new file mode 100644 index 00000000000..0c04d5b219f --- /dev/null +++ b/db/migrate/20201110221400_create_experiment_subjects.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +class CreateExperimentSubjects < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def up + create_table :experiment_subjects do |t| + t.references :experiment, index: true, foreign_key: { on_delete: :cascade }, null: false + t.bigint :user_id, index: true + t.bigint :group_id, index: true + t.bigint :project_id, index: true + t.integer :variant, limit: 2, null: false, default: 0 + t.timestamps_with_timezone null: false + end + + # Require exactly one of user_id, group_id, or project_id to be NOT NULL + execute <<-SQL + ALTER TABLE experiment_subjects ADD CONSTRAINT chk_has_one_subject CHECK (num_nonnulls(user_id, group_id, project_id) = 1); + SQL + end + + def down + drop_table :experiment_subjects + end +end diff --git a/db/migrate/20201111051655_add_foreign_key_to_experiment_subjects_on_user.rb b/db/migrate/20201111051655_add_foreign_key_to_experiment_subjects_on_user.rb new file mode 100644 index 00000000000..231d083dfda --- /dev/null +++ b/db/migrate/20201111051655_add_foreign_key_to_experiment_subjects_on_user.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddForeignKeyToExperimentSubjectsOnUser < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + disable_ddl_transaction! + + DOWNTIME = false + + def up + add_concurrent_foreign_key :experiment_subjects, :users, column: :user_id, on_delete: :cascade + end + + def down + with_lock_retries do + remove_foreign_key :experiment_subjects, column: :user_id + end + end +end diff --git a/db/migrate/20201111051847_add_foreign_key_to_experiment_subjects_on_group.rb b/db/migrate/20201111051847_add_foreign_key_to_experiment_subjects_on_group.rb new file mode 100644 index 00000000000..ad0d7ae027e --- /dev/null +++ b/db/migrate/20201111051847_add_foreign_key_to_experiment_subjects_on_group.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddForeignKeyToExperimentSubjectsOnGroup < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + disable_ddl_transaction! + + DOWNTIME = false + + def up + add_concurrent_foreign_key :experiment_subjects, :namespaces, column: :group_id, on_delete: :cascade + end + + def down + with_lock_retries do + remove_foreign_key :experiment_subjects, column: :group_id + end + end +end diff --git a/db/migrate/20201111051904_add_foreign_key_to_experiment_subjects_on_project.rb b/db/migrate/20201111051904_add_foreign_key_to_experiment_subjects_on_project.rb new file mode 100644 index 00000000000..a8a05292cca --- /dev/null +++ b/db/migrate/20201111051904_add_foreign_key_to_experiment_subjects_on_project.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddForeignKeyToExperimentSubjectsOnProject < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + disable_ddl_transaction! + + DOWNTIME = false + + def up + add_concurrent_foreign_key :experiment_subjects, :projects, column: :project_id, on_delete: :cascade + end + + def down + with_lock_retries do + remove_foreign_key :experiment_subjects, column: :project_id + end + end +end diff --git a/db/migrate/20201111100136_create_analytics_devops_adoption_snapshots.rb b/db/migrate/20201111100136_create_analytics_devops_adoption_snapshots.rb new file mode 100644 index 00000000000..ee029d17c94 --- /dev/null +++ b/db/migrate/20201111100136_create_analytics_devops_adoption_snapshots.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class CreateAnalyticsDevopsAdoptionSnapshots < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + create_table :analytics_devops_adoption_snapshots do |t| + t.references :segment, index: false, null: false, foreign_key: { to_table: :analytics_devops_adoption_segments, on_delete: :cascade } + t.datetime_with_timezone :recorded_at, null: false + t.boolean :issue_opened, null: false + t.boolean :merge_request_opened, null: false + t.boolean :merge_request_approved, null: false + t.boolean :runner_configured, null: false + t.boolean :pipeline_succeeded, null: false + t.boolean :deploy_succeeded, null: false + t.boolean :security_scan_succeeded, null: false + + t.index [:segment_id, :recorded_at], name: 'index_on_snapshots_segment_id_recorded_at' + end + end +end diff --git a/db/migrate/20201111115414_create_incident_management_oncall_schedules.rb b/db/migrate/20201111115414_create_incident_management_oncall_schedules.rb new file mode 100644 index 00000000000..dbb7d1c0808 --- /dev/null +++ b/db/migrate/20201111115414_create_incident_management_oncall_schedules.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +class CreateIncidentManagementOncallSchedules < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + with_lock_retries do + unless table_exists?(:incident_management_oncall_schedules) + create_table :incident_management_oncall_schedules do |t| + t.timestamps_with_timezone + t.references :project, index: true, null: false, foreign_key: { on_delete: :cascade } + t.integer :iid, null: false + t.text :name, null: false + t.text :description + t.text :timezone + + t.index %w(project_id iid), name: 'index_im_oncall_schedules_on_project_id_and_iid', unique: true, using: :btree + end + end + end + + add_text_limit :incident_management_oncall_schedules, :name, 200 + add_text_limit :incident_management_oncall_schedules, :description, 1000 + add_text_limit :incident_management_oncall_schedules, :timezone, 100 + end + + def down + with_lock_retries do + drop_table :incident_management_oncall_schedules + end + end +end diff --git a/db/migrate/20201111145317_add_relation_to_indexes_view.rb b/db/migrate/20201111145317_add_relation_to_indexes_view.rb new file mode 100644 index 00000000000..318b77c1dc6 --- /dev/null +++ b/db/migrate/20201111145317_add_relation_to_indexes_view.rb @@ -0,0 +1,58 @@ +# frozen_string_literal: true + +class AddRelationToIndexesView < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def up + execute(<<~SQL) + DROP VIEW postgres_indexes; + + CREATE VIEW postgres_indexes AS + SELECT (pg_namespace.nspname::text || '.'::text) || pg_class.relname::text AS identifier, + pg_index.indexrelid, + pg_namespace.nspname AS schema, + pg_class.relname AS name, + pg_indexes.tablename, + pg_index.indisunique AS "unique", + pg_index.indisvalid AS valid_index, + pg_class.relispartition AS partitioned, + pg_index.indisexclusion AS exclusion, + pg_index.indexprs IS NOT NULL as expression, + pg_index.indpred IS NOT NULL as partial, + pg_indexes.indexdef AS definition, + pg_relation_size(pg_class.oid::regclass) AS ondisk_size_bytes + FROM pg_index + JOIN pg_class ON pg_class.oid = pg_index.indexrelid + JOIN pg_namespace ON pg_class.relnamespace = pg_namespace.oid + JOIN pg_indexes ON pg_class.relname = pg_indexes.indexname + WHERE pg_namespace.nspname <> 'pg_catalog'::name + AND (pg_namespace.nspname = ANY (ARRAY["current_schema"(), 'gitlab_partitions_dynamic'::name, 'gitlab_partitions_static'::name])); + SQL + end + + def down + execute(<<~SQL) + DROP VIEW postgres_indexes; + + CREATE VIEW postgres_indexes AS + SELECT (pg_namespace.nspname::text || '.'::text) || pg_class.relname::text AS identifier, + pg_index.indexrelid, + pg_namespace.nspname AS schema, + pg_class.relname AS name, + pg_index.indisunique AS "unique", + pg_index.indisvalid AS valid_index, + pg_class.relispartition AS partitioned, + pg_index.indisexclusion AS exclusion, + pg_index.indexprs IS NOT NULL as expression, + pg_index.indpred IS NOT NULL as partial, + pg_indexes.indexdef AS definition, + pg_relation_size(pg_class.oid::regclass) AS ondisk_size_bytes + FROM pg_index + JOIN pg_class ON pg_class.oid = pg_index.indexrelid + JOIN pg_namespace ON pg_class.relnamespace = pg_namespace.oid + JOIN pg_indexes ON pg_class.relname = pg_indexes.indexname + WHERE pg_namespace.nspname <> 'pg_catalog'::name + AND (pg_namespace.nspname = ANY (ARRAY["current_schema"(), 'gitlab_partitions_dynamic'::name, 'gitlab_partitions_static'::name])); + SQL + end +end diff --git a/db/migrate/20201112132808_create_bulk_import_failures.rb b/db/migrate/20201112132808_create_bulk_import_failures.rb new file mode 100644 index 00000000000..cdc5a4d6ff0 --- /dev/null +++ b/db/migrate/20201112132808_create_bulk_import_failures.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +class CreateBulkImportFailures < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + with_lock_retries do + unless table_exists?(:bulk_import_failures) + create_table :bulk_import_failures do |t| + t.references :bulk_import_entity, + null: false, + index: true, + foreign_key: { on_delete: :cascade } + + t.datetime_with_timezone :created_at, null: false + t.text :pipeline_class, null: false + t.text :exception_class, null: false + t.text :exception_message, null: false + t.text :correlation_id_value, index: true + end + end + end + + add_text_limit :bulk_import_failures, :pipeline_class, 255 + add_text_limit :bulk_import_failures, :exception_class, 255 + add_text_limit :bulk_import_failures, :exception_message, 255 + add_text_limit :bulk_import_failures, :correlation_id_value, 255 + end + + def down + with_lock_retries do + drop_table :bulk_import_failures + end + end +end diff --git a/db/migrate/20201112173532_add_verification_state_to_package_files.rb b/db/migrate/20201112173532_add_verification_state_to_package_files.rb new file mode 100644 index 00000000000..61f526bd77e --- /dev/null +++ b/db/migrate/20201112173532_add_verification_state_to_package_files.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +class AddVerificationStateToPackageFiles < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + add_column :packages_package_files, :verification_state, :integer, default: 0, limit: 2, null: false + add_column :packages_package_files, :verification_started_at, :datetime_with_timezone + end +end diff --git a/db/migrate/20201112173911_add_index_on_verification_state_on_package_files.rb b/db/migrate/20201112173911_add_index_on_verification_state_on_package_files.rb new file mode 100644 index 00000000000..17e6b7d01f6 --- /dev/null +++ b/db/migrate/20201112173911_add_index_on_verification_state_on_package_files.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddIndexOnVerificationStateOnPackageFiles < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INDEX_NAME = 'index_packages_package_files_on_verification_state' + + disable_ddl_transaction! + + def up + add_concurrent_index :packages_package_files, :verification_state, name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :packages_package_files, INDEX_NAME + end +end diff --git a/db/migrate/20201112215028_add_partitioned_audit_event_indexes.rb b/db/migrate/20201112215028_add_partitioned_audit_event_indexes.rb new file mode 100644 index 00000000000..d8b2833474b --- /dev/null +++ b/db/migrate/20201112215028_add_partitioned_audit_event_indexes.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +class AddPartitionedAuditEventIndexes < ActiveRecord::Migration[6.0] + include Gitlab::Database::PartitioningMigrationHelpers + + DOWNTIME = false + + CREATED_AT_AUTHOR_ID_INDEX_NAME = 'analytics_index_audit_events_part_on_created_at_and_author_id' + ENTITY_ID_DESC_INDEX_NAME = 'idx_audit_events_part_on_entity_id_desc_author_id_created_at' + + disable_ddl_transaction! + + def up + add_concurrent_partitioned_index :audit_events_part_5fc467ac26, + [:created_at, :author_id], + name: CREATED_AT_AUTHOR_ID_INDEX_NAME + + add_concurrent_partitioned_index :audit_events_part_5fc467ac26, + [:entity_id, :entity_type, :id, :author_id, :created_at], + order: { id: :desc }, + name: ENTITY_ID_DESC_INDEX_NAME + end + + def down + remove_concurrent_partitioned_index_by_name :audit_events_part_5fc467ac26, ENTITY_ID_DESC_INDEX_NAME + + remove_concurrent_partitioned_index_by_name :audit_events_part_5fc467ac26, CREATED_AT_AUTHOR_ID_INDEX_NAME + end +end diff --git a/db/migrate/20201116090328_add_regulated_to_compliance_frameworks.rb b/db/migrate/20201116090328_add_regulated_to_compliance_frameworks.rb new file mode 100644 index 00000000000..f2e0c23ccfc --- /dev/null +++ b/db/migrate/20201116090328_add_regulated_to_compliance_frameworks.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddRegulatedToComplianceFrameworks < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + add_column(:compliance_management_frameworks, :regulated, :boolean, default: true, null: false) + end +end diff --git a/db/migrate/20201116211829_create_user_permission_export_uploads.rb b/db/migrate/20201116211829_create_user_permission_export_uploads.rb new file mode 100644 index 00000000000..d6207fe0c2c --- /dev/null +++ b/db/migrate/20201116211829_create_user_permission_export_uploads.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +class CreateUserPermissionExportUploads < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + with_lock_retries do + unless table_exists?(:user_permission_export_uploads) + create_table :user_permission_export_uploads do |t| + t.timestamps_with_timezone null: false + t.references :user, foreign_key: { on_delete: :cascade }, index: false, null: false + t.integer :file_store + t.integer :status, limit: 2, null: false, default: 0 + t.text :file + + t.index [:user_id, :status] + end + end + end + + add_text_limit :user_permission_export_uploads, :file, 255 + end + + def down + with_lock_retries do + drop_table :user_permission_export_uploads + end + end +end diff --git a/db/migrate/20201117054609_add_cloud_license_enabled_to_settings.rb b/db/migrate/20201117054609_add_cloud_license_enabled_to_settings.rb new file mode 100644 index 00000000000..4488aa376a1 --- /dev/null +++ b/db/migrate/20201117054609_add_cloud_license_enabled_to_settings.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddCloudLicenseEnabledToSettings < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + add_column :application_settings, :cloud_license_enabled, :boolean, null: false, default: false + end +end diff --git a/db/migrate/20201117075742_change_webauthn_xid_length.rb b/db/migrate/20201117075742_change_webauthn_xid_length.rb new file mode 100644 index 00000000000..2d836662e01 --- /dev/null +++ b/db/migrate/20201117075742_change_webauthn_xid_length.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class ChangeWebauthnXidLength < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_text_limit :webauthn_registrations, :credential_xid, 340, constraint_name: check_constraint_name(:webauthn_registrations, :credential_xid, 'max_length_v2') + remove_text_limit :webauthn_registrations, :credential_xid, constraint_name: check_constraint_name(:webauthn_registrations, :credential_xid, 'max_length') + end + + def down + # no-op: Danger of failling if there are records with length(credential_xid) > 255 + end +end diff --git a/db/migrate/20201117153333_add_index_on_package_size_and_project_id_to_project_statistics.rb b/db/migrate/20201117153333_add_index_on_package_size_and_project_id_to_project_statistics.rb new file mode 100644 index 00000000000..efb5cf14d3c --- /dev/null +++ b/db/migrate/20201117153333_add_index_on_package_size_and_project_id_to_project_statistics.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddIndexOnPackageSizeAndProjectIdToProjectStatistics < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INDEX_NAME = 'index_project_statistics_on_packages_size_and_project_id' + + disable_ddl_transaction! + + def up + add_concurrent_index :project_statistics, [:packages_size, :project_id], + name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :project_statistics, INDEX_NAME + end +end diff --git a/db/migrate/20201117184334_add_index_to_project_repositories_shard_id_project_id.rb b/db/migrate/20201117184334_add_index_to_project_repositories_shard_id_project_id.rb new file mode 100644 index 00000000000..25d95231ac4 --- /dev/null +++ b/db/migrate/20201117184334_add_index_to_project_repositories_shard_id_project_id.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddIndexToProjectRepositoriesShardIdProjectId < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_index :project_repositories, [:shard_id, :project_id] + end + + def down + remove_concurrent_index :project_repositories, [:shard_id, :project_id], name: 'index_project_repositories_on_shard_id_and_project_id' + end +end diff --git a/db/migrate/20201117203224_add_iteration_id_to_boards_table.rb b/db/migrate/20201117203224_add_iteration_id_to_boards_table.rb new file mode 100644 index 00000000000..18abe096604 --- /dev/null +++ b/db/migrate/20201117203224_add_iteration_id_to_boards_table.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddIterationIdToBoardsTable < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + add_column :boards, :iteration_id, :bigint + end + end + + def down + with_lock_retries do + remove_column :boards, :iteration_id + end + end +end diff --git a/db/migrate/20201117213024_add_iteration_id_index_to_boards_table.rb b/db/migrate/20201117213024_add_iteration_id_index_to_boards_table.rb new file mode 100644 index 00000000000..e038b4eacd9 --- /dev/null +++ b/db/migrate/20201117213024_add_iteration_id_index_to_boards_table.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddIterationIdIndexToBoardsTable < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INDEX_NAME = 'index_boards_on_iteration_id' + + disable_ddl_transaction! + + def up + add_concurrent_index :boards, :iteration_id, name: INDEX_NAME + end + + def down + remove_concurrent_index :boards, :iteration_id, name: INDEX_NAME + end +end diff --git a/db/migrate/20201118093135_create_namespace_onboarding_actions.rb b/db/migrate/20201118093135_create_namespace_onboarding_actions.rb new file mode 100644 index 00000000000..6b38a0dddca --- /dev/null +++ b/db/migrate/20201118093135_create_namespace_onboarding_actions.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +class CreateNamespaceOnboardingActions < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + create_table :namespace_onboarding_actions do |t| + t.references :namespace, index: true, null: false, foreign_key: { on_delete: :cascade } + t.datetime_with_timezone :created_at, null: false + t.integer :action, limit: 2, null: false + end + end + end + + def down + with_lock_retries do + drop_table :namespace_onboarding_actions + end + end +end diff --git a/db/migrate/20201119031515_add_iteration_id_to_lists.rb b/db/migrate/20201119031515_add_iteration_id_to_lists.rb new file mode 100644 index 00000000000..62e13f53e92 --- /dev/null +++ b/db/migrate/20201119031515_add_iteration_id_to_lists.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddIterationIdToLists < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + add_column :lists, :iteration_id, :bigint + end +end diff --git a/db/migrate/20201119053603_add_iteration_lists_foreign_key.rb b/db/migrate/20201119053603_add_iteration_lists_foreign_key.rb new file mode 100644 index 00000000000..8d9ec1f2e59 --- /dev/null +++ b/db/migrate/20201119053603_add_iteration_lists_foreign_key.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class AddIterationListsForeignKey < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + INDEX_NAME = 'index_lists_on_iteration_id' + + disable_ddl_transaction! + + def up + add_concurrent_index :lists, :iteration_id, name: INDEX_NAME + add_concurrent_foreign_key :lists, :sprints, column: :iteration_id, on_delete: :cascade + end + + def down + remove_foreign_key_if_exists :lists, :sprints, column: :iteration_id + remove_concurrent_index_by_name :lists, INDEX_NAME + end +end diff --git a/db/migrate/20201119125730_add_web_hooks_service_foreign_key.rb b/db/migrate/20201119125730_add_web_hooks_service_foreign_key.rb new file mode 100644 index 00000000000..d350a7de282 --- /dev/null +++ b/db/migrate/20201119125730_add_web_hooks_service_foreign_key.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +class AddWebHooksServiceForeignKey < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INDEX_NAME = 'index_web_hooks_on_service_id' + + disable_ddl_transaction! + + def up + add_concurrent_index :web_hooks, :service_id, name: INDEX_NAME + add_concurrent_foreign_key :web_hooks, :services, column: :service_id, on_delete: :cascade, validate: false + end + + def down + with_lock_retries do + remove_foreign_key_if_exists :web_hooks, column: :service_id + end + + remove_concurrent_index_by_name :web_hooks, INDEX_NAME + end +end diff --git a/db/migrate/20201119133534_add_personal_access_token_prefix_to_application_setting.rb b/db/migrate/20201119133534_add_personal_access_token_prefix_to_application_setting.rb new file mode 100644 index 00000000000..c6bb6b7d514 --- /dev/null +++ b/db/migrate/20201119133534_add_personal_access_token_prefix_to_application_setting.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +class AddPersonalAccessTokenPrefixToApplicationSetting < ActiveRecord::Migration[6.0] + DOWNTIME = false + + # rubocop:disable Migration/AddLimitToTextColumns + # limit is added in 20201119133604_add_text_limit_to_application_setting_personal_access_token_prefix + def change + add_column :application_settings, :personal_access_token_prefix, :text + end + # rubocop:enable Migration/AddLimitToTextColumns +end diff --git a/db/migrate/20201119133604_add_text_limit_to_application_setting_personal_access_token_prefix.rb b/db/migrate/20201119133604_add_text_limit_to_application_setting_personal_access_token_prefix.rb new file mode 100644 index 00000000000..a118da9e3e7 --- /dev/null +++ b/db/migrate/20201119133604_add_text_limit_to_application_setting_personal_access_token_prefix.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class AddTextLimitToApplicationSettingPersonalAccessTokenPrefix < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_text_limit :application_settings, :personal_access_token_prefix, 20 + end + + def down + remove_text_limit :application_settings, :personal_access_token_prefix + end +end diff --git a/db/migrate/20201119162801_change_services_inherit_from_id_foreign_key.rb b/db/migrate/20201119162801_change_services_inherit_from_id_foreign_key.rb new file mode 100644 index 00000000000..a7f12fcf726 --- /dev/null +++ b/db/migrate/20201119162801_change_services_inherit_from_id_foreign_key.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class ChangeServicesInheritFromIdForeignKey < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :services, :services, column: :inherit_from_id, on_delete: :cascade, name: 'fk_services_inherit_from_id' + remove_foreign_key_if_exists :services, name: 'fk_868a8e7ad6' + end + + def down + remove_foreign_key_if_exists :services, name: 'fk_services_inherit_from_id' + add_concurrent_foreign_key :services, :services, column: :inherit_from_id, on_delete: :nullify, name: 'fk_868a8e7ad6' + end +end diff --git a/db/migrate/20201119164605_add_checksum_into_vulnerability_remediations.rb b/db/migrate/20201119164605_add_checksum_into_vulnerability_remediations.rb new file mode 100644 index 00000000000..a9ac1ed0676 --- /dev/null +++ b/db/migrate/20201119164605_add_checksum_into_vulnerability_remediations.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class AddChecksumIntoVulnerabilityRemediations < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + add_column :vulnerability_remediations, :checksum, :binary, null: false, comment: 'Stores the SHA256 checksum of the attached diff file' # rubocop:disable Rails/NotNullColumn + + add_index :vulnerability_remediations, :checksum, unique: true # rubocop:disable Migration/AddIndex (Table is empty) + end +end diff --git a/db/migrate/20201119213406_change_terraform_versioning_enabled_default.rb b/db/migrate/20201119213406_change_terraform_versioning_enabled_default.rb new file mode 100644 index 00000000000..490fe481589 --- /dev/null +++ b/db/migrate/20201119213406_change_terraform_versioning_enabled_default.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class ChangeTerraformVersioningEnabledDefault < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + change_column_default :terraform_states, :versioning_enabled, from: false, to: true + end +end diff --git a/db/migrate/20201120125953_replace_unused_labels_index.rb b/db/migrate/20201120125953_replace_unused_labels_index.rb new file mode 100644 index 00000000000..afddbce618d --- /dev/null +++ b/db/migrate/20201120125953_replace_unused_labels_index.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +class ReplaceUnusedLabelsIndex < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + NEW_INDEX_NAME = 'index_labels_on_group_id_and_title_with_null_project_id' + OLD_INDEX_NAME = 'index_labels_on_group_id_and_title' + + def up + add_concurrent_index :labels, [:group_id, :title], where: 'project_id IS NULL', name: NEW_INDEX_NAME + remove_concurrent_index_by_name :labels, OLD_INDEX_NAME + end + + def down + add_concurrent_index :labels, [:group_id, :title], where: 'project_id = NULL::integer', name: OLD_INDEX_NAME + remove_concurrent_index_by_name :labels, NEW_INDEX_NAME + end +end diff --git a/db/migrate/20201123081307_add_operations_project_feature_to_metrics.rb b/db/migrate/20201123081307_add_operations_project_feature_to_metrics.rb new file mode 100644 index 00000000000..6801b49fae5 --- /dev/null +++ b/db/migrate/20201123081307_add_operations_project_feature_to_metrics.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddOperationsProjectFeatureToMetrics < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + add_column :project_features, :operations_access_level, :integer, default: 20, null: false + end + end + + def down + with_lock_retries do + remove_column :project_features, :operations_access_level + end + end +end diff --git a/db/migrate/20201123161611_add_provisioned_by_group_to_user_details.rb b/db/migrate/20201123161611_add_provisioned_by_group_to_user_details.rb new file mode 100644 index 00000000000..6e4d0e84509 --- /dev/null +++ b/db/migrate/20201123161611_add_provisioned_by_group_to_user_details.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +class AddProvisionedByGroupToUserDetails < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INDEX_NAME = 'index_user_details_on_provisioned_by_group_id' + + disable_ddl_transaction! + + def up + unless column_exists?(:user_details, :provisioned_by_group_id) + with_lock_retries { add_column(:user_details, :provisioned_by_group_id, :integer, limit: 8) } + end + + add_concurrent_index :user_details, :provisioned_by_group_id, name: INDEX_NAME + add_concurrent_foreign_key :user_details, :namespaces, column: :provisioned_by_group_id, on_delete: :nullify + end + + def down + with_lock_retries { remove_foreign_key_without_error :user_details, column: :provisioned_by_group_id } + + remove_concurrent_index_by_name :user_details, INDEX_NAME + + if column_exists?(:user_details, :provisioned_by_group_id) + with_lock_retries { remove_column(:user_details, :provisioned_by_group_id) } + end + end +end diff --git a/db/migrate/20201124030537_create_incident_management_on_call_rotations.rb b/db/migrate/20201124030537_create_incident_management_on_call_rotations.rb new file mode 100644 index 00000000000..18546d97fd5 --- /dev/null +++ b/db/migrate/20201124030537_create_incident_management_on_call_rotations.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +class CreateIncidentManagementOnCallRotations < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + unless table_exists?(:incident_management_oncall_rotations) + with_lock_retries do + create_table :incident_management_oncall_rotations do |t| + t.timestamps_with_timezone + t.references :oncall_schedule, index: false, null: false, foreign_key: { to_table: :incident_management_oncall_schedules, on_delete: :cascade } + t.integer :length, null: false + t.integer :length_unit, limit: 2, null: false + t.datetime_with_timezone :starts_at, null: false + t.text :name, null: false + + t.index %w(oncall_schedule_id id), name: 'index_inc_mgmnt_oncall_rotations_on_oncall_schedule_id_and_id', unique: true, using: :btree + t.index %w(oncall_schedule_id name), name: 'index_inc_mgmnt_oncall_rotations_on_oncall_schedule_id_and_name', unique: true, using: :btree + end + end + end + + add_text_limit :incident_management_oncall_rotations, :name, 200 + end + + def down + with_lock_retries do + drop_table :incident_management_oncall_rotations + end + end +end diff --git a/db/migrate/20201124075951_create_vulnerability_external_links.rb b/db/migrate/20201124075951_create_vulnerability_external_links.rb new file mode 100644 index 00000000000..8200b15559b --- /dev/null +++ b/db/migrate/20201124075951_create_vulnerability_external_links.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +class CreateVulnerabilityExternalLinks < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + with_lock_retries do + create_table :vulnerability_external_issue_links, if_not_exists: true do |t| + t.timestamps_with_timezone null: false + t.references :author, null: false, index: true, foreign_key: { to_table: :users, on_delete: :nullify }, type: :bigint + t.references :vulnerability, null: false, index: true, type: :bigint + t.integer :link_type, limit: 2, null: false, default: 1 # 'created' + t.integer :external_type, limit: 2, null: false, default: 1 # 'jira' + t.text :external_project_key, null: false + t.text :external_issue_key, null: false + + t.index %i[vulnerability_id external_type external_project_key external_issue_key], + name: 'idx_vulnerability_ext_issue_links_on_vulne_id_and_ext_issue', + unique: true + t.index %i[vulnerability_id link_type], + name: 'idx_vulnerability_ext_issue_links_on_vulne_id_and_link_type', + where: 'link_type = 1', + unique: true # only one 'created' link per vulnerability is allowed + end + end + + add_concurrent_foreign_key :vulnerability_external_issue_links, :vulnerabilities, column: :vulnerability_id, on_delete: :cascade + + add_text_limit :vulnerability_external_issue_links, :external_project_key, 255 + add_text_limit :vulnerability_external_issue_links, :external_issue_key, 255 + end + + def down + with_lock_retries do + drop_table :vulnerability_external_issue_links + end + end +end diff --git a/db/migrate/20201125030847_create_dependency_proxy_manifests.rb b/db/migrate/20201125030847_create_dependency_proxy_manifests.rb new file mode 100644 index 00000000000..6c1a3f23bf3 --- /dev/null +++ b/db/migrate/20201125030847_create_dependency_proxy_manifests.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +class CreateDependencyProxyManifests < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + with_lock_retries do + create_table :dependency_proxy_manifests, if_not_exists: true do |t| + t.timestamps_with_timezone + t.references :group, index: false, null: false, foreign_key: { to_table: :namespaces, on_delete: :cascade }, type: :bigint + t.bigint :size + t.integer :file_store, limit: 2 + t.text :file_name, null: false + t.text :file, null: false + t.text :digest, null: false + + t.index [:group_id, :digest], name: 'index_dependency_proxy_manifests_on_group_id_and_digest' + end + end + + add_text_limit :dependency_proxy_manifests, :file_name, 255 + add_text_limit :dependency_proxy_manifests, :file, 255 + add_text_limit :dependency_proxy_manifests, :digest, 255 + end + + def down + drop_table :dependency_proxy_manifests + end +end diff --git a/db/migrate/20201125233219_add_incident_management_on_call_participants.rb b/db/migrate/20201125233219_add_incident_management_on_call_participants.rb new file mode 100644 index 00000000000..2a9b1d8b276 --- /dev/null +++ b/db/migrate/20201125233219_add_incident_management_on_call_participants.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +class AddIncidentManagementOnCallParticipants < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + PARTICIPANT_ROTATION_INDEX_NAME = 'index_inc_mgmnt_oncall_participants_on_oncall_rotation_id' + PARTICIPANT_USER_INDEX_NAME = 'index_inc_mgmnt_oncall_participants_on_oncall_user_id' + UNIQUE_INDEX_NAME = 'index_inc_mgmnt_oncall_participants_on_user_id_and_rotation_id' + + disable_ddl_transaction! + + def up + unless table_exists?(:incident_management_oncall_participants) + with_lock_retries do + create_table :incident_management_oncall_participants do |t| + t.references :oncall_rotation, index: false, null: false, foreign_key: { to_table: :incident_management_oncall_rotations, on_delete: :cascade } + t.references :user, index: false, null: false, foreign_key: { on_delete: :cascade } + t.integer :color_palette, limit: 2, null: false + t.integer :color_weight, limit: 2, null: false + t.index :user_id, name: PARTICIPANT_USER_INDEX_NAME + t.index :oncall_rotation_id, name: PARTICIPANT_ROTATION_INDEX_NAME + t.index [:user_id, :oncall_rotation_id], unique: true, name: UNIQUE_INDEX_NAME + end + end + end + end + + def down + drop_table :incident_management_oncall_participants + end +end diff --git a/db/migrate/20201126165919_add_epic_boards.rb b/db/migrate/20201126165919_add_epic_boards.rb new file mode 100644 index 00000000000..432b839d6ea --- /dev/null +++ b/db/migrate/20201126165919_add_epic_boards.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +class AddEpicBoards < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + with_lock_retries do + create_table :boards_epic_boards do |t| + t.boolean :hide_backlog_list, default: false, null: false + t.boolean :hide_closed_list, default: false, null: false + t.references :group, index: true, foreign_key: { to_table: :namespaces, on_delete: :cascade }, null: false + t.timestamps_with_timezone + t.text :name, default: 'Development', null: false + end + end + + add_text_limit :boards_epic_boards, :name, 255 + end + + def down + with_lock_retries do + drop_table :boards_epic_boards + end + end +end diff --git a/db/migrate/20201126172030_add_feed_token_off_to_settings.rb b/db/migrate/20201126172030_add_feed_token_off_to_settings.rb new file mode 100644 index 00000000000..04e05c9bd43 --- /dev/null +++ b/db/migrate/20201126172030_add_feed_token_off_to_settings.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddFeedTokenOffToSettings < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + add_column :application_settings, :disable_feed_token, :boolean, null: false, default: false + end +end diff --git a/db/migrate/20201126190039_add_epic_board_labels.rb b/db/migrate/20201126190039_add_epic_board_labels.rb new file mode 100644 index 00000000000..519e705ce14 --- /dev/null +++ b/db/migrate/20201126190039_add_epic_board_labels.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +class AddEpicBoardLabels < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + with_lock_retries do + create_table :boards_epic_board_labels do |t| + t.references :epic_board, index: true, foreign_key: { to_table: :boards_epic_boards, on_delete: :cascade }, null: false + t.references :label, index: true, foreign_key: { on_delete: :cascade }, null: false + end + end + end + + def down + with_lock_retries do + drop_table :boards_epic_board_labels + end + end +end diff --git a/db/migrate/20201127141433_add_other_role_to_user_details.rb b/db/migrate/20201127141433_add_other_role_to_user_details.rb new file mode 100644 index 00000000000..586dbb033fd --- /dev/null +++ b/db/migrate/20201127141433_add_other_role_to_user_details.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +class AddOtherRoleToUserDetails < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + unless column_exists?(:user_details, :other_role) + with_lock_retries do + add_column :user_details, :other_role, :text + end + end + + add_text_limit :user_details, :other_role, 100 + end + + def down + with_lock_retries do + remove_column :user_details, :other_role + end + end +end diff --git a/db/migrate/20201127170848_add_index_bloat_estimate_view.rb b/db/migrate/20201127170848_add_index_bloat_estimate_view.rb new file mode 100644 index 00000000000..ab268f8569e --- /dev/null +++ b/db/migrate/20201127170848_add_index_bloat_estimate_view.rb @@ -0,0 +1,109 @@ +# frozen_string_literal: true + +class AddIndexBloatEstimateView < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def up + execute(<<~SQL) + CREATE VIEW postgres_index_bloat_estimates AS + -- Originally from: https://github.com/ioguix/pgsql-bloat-estimation/blob/master/btree/btree_bloat.sql + -- WARNING: executed with a non-superuser role, the query inspect only index on tables you are granted to read. + -- WARNING: rows with is_na = 't' are known to have bad statistics ("name" type is not supported). + -- This query is compatible with PostgreSQL 8.2 and after + SELECT nspname || '.' || idxname as identifier, + CASE WHEN relpages > est_pages_ff + THEN bs*(relpages-est_pages_ff) + ELSE 0 + END::bigint AS bloat_size_bytes + FROM ( + SELECT + coalesce(1 + + ceil(reltuples/floor((bs-pageopqdata-pagehdr)*fillfactor/(100*(4+nulldatahdrwidth)::float))), 0 + ) AS est_pages_ff, + bs, nspname, tblname, idxname, relpages, is_na + FROM ( + SELECT maxalign, bs, nspname, tblname, idxname, reltuples, relpages, idxoid, fillfactor, + ( index_tuple_hdr_bm + + maxalign - CASE -- Add padding to the index tuple header to align on MAXALIGN + WHEN index_tuple_hdr_bm%maxalign = 0 THEN maxalign + ELSE index_tuple_hdr_bm%maxalign + END + + nulldatawidth + maxalign - CASE -- Add padding to the data to align on MAXALIGN + WHEN nulldatawidth = 0 THEN 0 + WHEN nulldatawidth::integer%maxalign = 0 THEN maxalign + ELSE nulldatawidth::integer%maxalign + END + )::numeric AS nulldatahdrwidth, pagehdr, pageopqdata, is_na + FROM ( + SELECT n.nspname, i.tblname, i.idxname, i.reltuples, i.relpages, + i.idxoid, i.fillfactor, current_setting('block_size')::numeric AS bs, + CASE -- MAXALIGN: 4 on 32bits, 8 on 64bits (and mingw32 ?) + WHEN version() ~ 'mingw32' OR version() ~ '64-bit|x86_64|ppc64|ia64|amd64' THEN 8 + ELSE 4 + END AS maxalign, + /* per page header, fixed size: 20 for 7.X, 24 for others */ + 24 AS pagehdr, + /* per page btree opaque data */ + 16 AS pageopqdata, + /* per tuple header: add IndexAttributeBitMapData if some cols are null-able */ + CASE WHEN max(coalesce(s.null_frac,0)) = 0 + THEN 2 -- IndexTupleData size + ELSE 2 + (( 32 + 8 - 1 ) / 8) -- IndexTupleData size + IndexAttributeBitMapData size ( max num filed per index + 8 - 1 /8) + END AS index_tuple_hdr_bm, + /* data len: we remove null values save space using it fractionnal part from stats */ + sum( (1-coalesce(s.null_frac, 0)) * coalesce(s.avg_width, 1024)) AS nulldatawidth, + max( CASE WHEN i.atttypid = 'pg_catalog.name'::regtype THEN 1 ELSE 0 END ) > 0 AS is_na + FROM ( + SELECT ct.relname AS tblname, ct.relnamespace, ic.idxname, ic.attpos, ic.indkey, ic.indkey[ic.attpos], ic.reltuples, ic.relpages, ic.tbloid, ic.idxoid, ic.fillfactor, + coalesce(a1.attnum, a2.attnum) AS attnum, coalesce(a1.attname, a2.attname) AS attname, coalesce(a1.atttypid, a2.atttypid) AS atttypid, + CASE WHEN a1.attnum IS NULL + THEN ic.idxname + ELSE ct.relname + END AS attrelname + FROM ( + SELECT idxname, reltuples, relpages, tbloid, idxoid, fillfactor, indkey, + pg_catalog.generate_series(1,indnatts) AS attpos + FROM ( + SELECT ci.relname AS idxname, ci.reltuples, ci.relpages, i.indrelid AS tbloid, + i.indexrelid AS idxoid, + coalesce(substring( + array_to_string(ci.reloptions, ' ') + from 'fillfactor=([0-9]+)')::smallint, 90) AS fillfactor, + i.indnatts, + pg_catalog.string_to_array(pg_catalog.textin( + pg_catalog.int2vectorout(i.indkey)),' ')::int[] AS indkey + FROM pg_catalog.pg_index i + JOIN pg_catalog.pg_class ci ON ci.oid = i.indexrelid + WHERE ci.relam=(SELECT oid FROM pg_am WHERE amname = 'btree') + AND ci.relpages > 0 + ) AS idx_data + ) AS ic + JOIN pg_catalog.pg_class ct ON ct.oid = ic.tbloid + LEFT JOIN pg_catalog.pg_attribute a1 ON + ic.indkey[ic.attpos] <> 0 + AND a1.attrelid = ic.tbloid + AND a1.attnum = ic.indkey[ic.attpos] + LEFT JOIN pg_catalog.pg_attribute a2 ON + ic.indkey[ic.attpos] = 0 + AND a2.attrelid = ic.idxoid + AND a2.attnum = ic.attpos + ) i + JOIN pg_catalog.pg_namespace n ON n.oid = i.relnamespace + JOIN pg_catalog.pg_stats s ON s.schemaname = n.nspname + AND s.tablename = i.attrelname + AND s.attname = i.attname + GROUP BY 1,2,3,4,5,6,7,8,9,10,11 + ) AS rows_data_stats + ) AS rows_hdr_pdg_stats + ) AS relation_stats + WHERE nspname IN ("current_schema"(), 'gitlab_partitions_dynamic', 'gitlab_partitions_static') AND NOT is_na + ORDER BY nspname, tblname, idxname; + SQL + end + + def down + execute(<<~SQL) + DROP VIEW postgres_index_bloat_estimates + SQL + end +end diff --git a/db/migrate/20201201033202_add_verification_indexes_for_package_files.rb b/db/migrate/20201201033202_add_verification_indexes_for_package_files.rb new file mode 100644 index 00000000000..b7f55101682 --- /dev/null +++ b/db/migrate/20201201033202_add_verification_indexes_for_package_files.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +class AddVerificationIndexesForPackageFiles < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + PENDING_VERIFICATION_INDEX_NAME = "packages_packages_pending_verification" + FAILED_VERIFICATION_INDEX_NAME = "packages_packages_failed_verification" + NEEDS_VERIFICATION_INDEX_NAME = "packages_packages_needs_verification" + + disable_ddl_transaction! + + def up + add_concurrent_index :packages_package_files, :verified_at, where: "(verification_state = 0)", order: { verified_at: 'ASC NULLS FIRST' }, name: PENDING_VERIFICATION_INDEX_NAME + add_concurrent_index :packages_package_files, :verification_retry_at, where: "(verification_state = 3)", order: { verification_retry_at: 'ASC NULLS FIRST' }, name: FAILED_VERIFICATION_INDEX_NAME + add_concurrent_index :packages_package_files, :verification_state, where: "(verification_state = 0 OR verification_state = 3)", name: NEEDS_VERIFICATION_INDEX_NAME + end + + def down + remove_concurrent_index_by_name :packages_package_files, PENDING_VERIFICATION_INDEX_NAME + remove_concurrent_index_by_name :packages_package_files, FAILED_VERIFICATION_INDEX_NAME + remove_concurrent_index_by_name :packages_package_files, NEEDS_VERIFICATION_INDEX_NAME + end +end diff --git a/db/migrate/20201201034258_add_index_for_non_system_noteables.rb b/db/migrate/20201201034258_add_index_for_non_system_noteables.rb new file mode 100644 index 00000000000..5927463e767 --- /dev/null +++ b/db/migrate/20201201034258_add_index_for_non_system_noteables.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +class AddIndexForNonSystemNoteables < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + LEGACY_INDEX_NAME = "index_notes_on_noteable_id_and_noteable_type" + NEW_INDEX_NAME = "index_notes_on_noteable_id_and_noteable_type_and_system" + + def up + add_concurrent_index :notes, [:noteable_id, :noteable_type, :system], name: NEW_INDEX_NAME + + remove_concurrent_index_by_name :notes, LEGACY_INDEX_NAME + end + + def down + add_concurrent_index :notes, [:noteable_id, :noteable_type], name: LEGACY_INDEX_NAME + + remove_concurrent_index_by_name :notes, NEW_INDEX_NAME + end +end diff --git a/db/migrate/20201201161655_add_primary_key_to_elastic_search_indexed_projects.rb b/db/migrate/20201201161655_add_primary_key_to_elastic_search_indexed_projects.rb new file mode 100644 index 00000000000..cf7221693f9 --- /dev/null +++ b/db/migrate/20201201161655_add_primary_key_to_elastic_search_indexed_projects.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +class AddPrimaryKeyToElasticSearchIndexedProjects < ActiveRecord::Migration[6.0] + DOWNTIME = false + + UNIQUE_INDEX_NAME = 'index_elasticsearch_indexed_projects_on_project_id' + PRIMARY_KEY_NAME = 'elasticsearch_indexed_projects_pkey' + + def up + execute(<<~SQL) + DELETE FROM elasticsearch_indexed_projects + WHERE project_id IS NULL + SQL + + execute(<<~SQL) + ALTER TABLE elasticsearch_indexed_projects + ALTER COLUMN project_id SET NOT NULL, + ADD CONSTRAINT #{PRIMARY_KEY_NAME} PRIMARY KEY USING INDEX #{UNIQUE_INDEX_NAME} + SQL + end + + def down + add_index :elasticsearch_indexed_projects, :project_id, unique: true, name: UNIQUE_INDEX_NAME # rubocop:disable Migration/AddIndex + + execute(<<~SQL) + ALTER TABLE elasticsearch_indexed_projects + DROP CONSTRAINT #{PRIMARY_KEY_NAME}, + ALTER COLUMN project_id DROP NOT NULL + SQL + end +end diff --git a/db/migrate/20201201163227_add_finding_uuid_to_vulnerability_feedback.rb b/db/migrate/20201201163227_add_finding_uuid_to_vulnerability_feedback.rb new file mode 100644 index 00000000000..a2e13806000 --- /dev/null +++ b/db/migrate/20201201163227_add_finding_uuid_to_vulnerability_feedback.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +class AddFindingUuidToVulnerabilityFeedback < ActiveRecord::Migration[6.0] + # Set this constant to true if this migration requires downtime. + DOWNTIME = false + + def change + add_column :vulnerability_feedback, :finding_uuid, :uuid + end +end diff --git a/db/migrate/20201201175656_add_index_vulnerabilities_on_project_id_and_state_and_severity.rb b/db/migrate/20201201175656_add_index_vulnerabilities_on_project_id_and_state_and_severity.rb new file mode 100644 index 00000000000..d0e8920d7a5 --- /dev/null +++ b/db/migrate/20201201175656_add_index_vulnerabilities_on_project_id_and_state_and_severity.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddIndexVulnerabilitiesOnProjectIdAndStateAndSeverity < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INDEX_NAME = 'index_vulnerabilities_on_project_id_and_state_and_severity' + + disable_ddl_transaction! + + def up + add_concurrent_index :vulnerabilities, [:project_id, :state, :severity], name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :vulnerabilities, INDEX_NAME + end +end diff --git a/db/migrate/20201201190002_add_other_context_to_experiment_user.rb b/db/migrate/20201201190002_add_other_context_to_experiment_user.rb new file mode 100644 index 00000000000..c901f049e75 --- /dev/null +++ b/db/migrate/20201201190002_add_other_context_to_experiment_user.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddOtherContextToExperimentUser < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + add_column :experiment_users, :context, :jsonb, default: {}, null: false + end + end + + def down + with_lock_retries do + remove_column :experiment_users, :context + end + end +end diff --git a/db/migrate/20201201192112_add_primary_key_to_elastic_search_indexed_namespaces.rb b/db/migrate/20201201192112_add_primary_key_to_elastic_search_indexed_namespaces.rb new file mode 100644 index 00000000000..610cd2828ca --- /dev/null +++ b/db/migrate/20201201192112_add_primary_key_to_elastic_search_indexed_namespaces.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +class AddPrimaryKeyToElasticSearchIndexedNamespaces < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + UNIQUE_INDEX_NAME = 'index_elasticsearch_indexed_namespaces_on_namespace_id' + PRIMARY_KEY_NAME = 'elasticsearch_indexed_namespaces_pkey' + + disable_ddl_transaction! + + def up + with_lock_retries do + execute(<<~SQL) + LOCK TABLE elasticsearch_indexed_namespaces IN ACCESS EXCLUSIVE MODE; + + DELETE FROM elasticsearch_indexed_namespaces + WHERE namespace_id IS NULL; + + ALTER TABLE elasticsearch_indexed_namespaces + ADD CONSTRAINT #{PRIMARY_KEY_NAME} PRIMARY KEY USING INDEX #{UNIQUE_INDEX_NAME}; + SQL + end + end + + def down + add_concurrent_index :elasticsearch_indexed_namespaces, :namespace_id, unique: true, name: UNIQUE_INDEX_NAME + + with_lock_retries do + execute(<<~SQL) + ALTER TABLE elasticsearch_indexed_namespaces + DROP CONSTRAINT #{PRIMARY_KEY_NAME}, + ALTER COLUMN namespace_id DROP NOT NULL + SQL + end + end +end diff --git a/db/migrate/20201202003042_add_epic_board_positions.rb b/db/migrate/20201202003042_add_epic_board_positions.rb new file mode 100644 index 00000000000..528d5ed3af1 --- /dev/null +++ b/db/migrate/20201202003042_add_epic_board_positions.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +class AddEpicBoardPositions < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + create_table :boards_epic_board_positions do |t| + t.references :epic_board, foreign_key: { to_table: :boards_epic_boards, on_delete: :cascade }, null: false, index: false + t.references :epic, foreign_key: { on_delete: :cascade }, null: false, index: true + t.integer :relative_position + + t.timestamps_with_timezone null: false + + t.index [:epic_board_id, :epic_id], unique: true, name: :index_boards_epic_board_positions_on_epic_board_id_and_epic_id + end + end + end + + def down + with_lock_retries do + drop_table :boards_epic_board_positions + end + end +end diff --git a/db/migrate/20201202025644_add_column_to_security_findings.rb b/db/migrate/20201202025644_add_column_to_security_findings.rb new file mode 100644 index 00000000000..0b63b79d949 --- /dev/null +++ b/db/migrate/20201202025644_add_column_to_security_findings.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true +# +class AddColumnToSecurityFindings < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + add_column :security_findings, :uuid, :uuid + end +end diff --git a/db/migrate/20201202025937_add_index_to_security_findings_uuid.rb b/db/migrate/20201202025937_add_index_to_security_findings_uuid.rb new file mode 100644 index 00000000000..4c33809fbfc --- /dev/null +++ b/db/migrate/20201202025937_add_index_to_security_findings_uuid.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddIndexToSecurityFindingsUuid < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INDEX_NAME = 'index_security_findings_on_uuid' + + disable_ddl_transaction! + + def up + add_concurrent_index :security_findings, :uuid, name: INDEX_NAME, unique: true + end + + def down + remove_concurrent_index_by_name :security_findings, INDEX_NAME + end +end diff --git a/db/migrate/20201202133606_add_sorted_to_merge_request_diffs.rb b/db/migrate/20201202133606_add_sorted_to_merge_request_diffs.rb new file mode 100644 index 00000000000..4c0d28d70a1 --- /dev/null +++ b/db/migrate/20201202133606_add_sorted_to_merge_request_diffs.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddSortedToMergeRequestDiffs < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + add_column :merge_request_diffs, :sorted, :boolean, null: false, default: false + end + end + + def down + with_lock_retries do + remove_column :merge_request_diffs, :sorted + end + end +end diff --git a/db/migrate/20201202142751_drop_index_vulnerabilities_on_project_id.rb b/db/migrate/20201202142751_drop_index_vulnerabilities_on_project_id.rb new file mode 100644 index 00000000000..c1ca32a1978 --- /dev/null +++ b/db/migrate/20201202142751_drop_index_vulnerabilities_on_project_id.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class DropIndexVulnerabilitiesOnProjectId < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INDEX_NAME = 'index_vulnerabilities_on_project_id' + + disable_ddl_transaction! + + def up + remove_concurrent_index_by_name :vulnerabilities, INDEX_NAME + end + + def down + add_concurrent_index :vulnerabilities, :project_id, name: INDEX_NAME + end +end diff --git a/db/migrate/20201202150001_add_details_to_vulnerability_findings.rb b/db/migrate/20201202150001_add_details_to_vulnerability_findings.rb new file mode 100644 index 00000000000..b7639bdfaa3 --- /dev/null +++ b/db/migrate/20201202150001_add_details_to_vulnerability_findings.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddDetailsToVulnerabilityFindings < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + add_column :vulnerability_occurrences, :details, :jsonb, default: {}, null: false + end + end + + def down + with_lock_retries do + remove_column :vulnerability_occurrences, :details + end + end +end diff --git a/db/migrate/20201202155913_add_primary_key_to_merge_request_context_commit_diff_files.rb b/db/migrate/20201202155913_add_primary_key_to_merge_request_context_commit_diff_files.rb new file mode 100644 index 00000000000..90c7b2731c8 --- /dev/null +++ b/db/migrate/20201202155913_add_primary_key_to_merge_request_context_commit_diff_files.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +class AddPrimaryKeyToMergeRequestContextCommitDiffFiles < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + execute(<<~SQL) + DELETE FROM merge_request_context_commit_diff_files + WHERE merge_request_context_commit_id IS NULL; + + DELETE FROM merge_request_context_commit_diff_files df1 + USING merge_request_context_commit_diff_files df2 + WHERE df1.ctid < df2.ctid + AND df1.merge_request_context_commit_id = df2.merge_request_context_commit_id + AND df1.relative_order = df2.relative_order; + + ALTER TABLE merge_request_context_commit_diff_files + ADD CONSTRAINT merge_request_context_commit_diff_files_pkey PRIMARY KEY (merge_request_context_commit_id, relative_order); + SQL + end + + def down + execute(<<~SQL) + ALTER TABLE merge_request_context_commit_diff_files + DROP CONSTRAINT merge_request_context_commit_diff_files_pkey, + ALTER COLUMN merge_request_context_commit_id DROP NOT NULL + SQL + end +end diff --git a/db/migrate/20201202160105_add_group_file_name_index_to_dependency_proxy_manifests.rb b/db/migrate/20201202160105_add_group_file_name_index_to_dependency_proxy_manifests.rb new file mode 100644 index 00000000000..a0bafeedaec --- /dev/null +++ b/db/migrate/20201202160105_add_group_file_name_index_to_dependency_proxy_manifests.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +class AddGroupFileNameIndexToDependencyProxyManifests < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + NEW_INDEX = 'index_dependency_proxy_manifests_on_group_id_and_file_name' + OLD_INDEX = 'index_dependency_proxy_manifests_on_group_id_and_digest' + + def up + add_concurrent_index :dependency_proxy_manifests, [:group_id, :file_name], name: NEW_INDEX, unique: true + remove_concurrent_index_by_name :dependency_proxy_manifests, OLD_INDEX + end + + def down + add_concurrent_index :dependency_proxy_manifests, [:group_id, :digest], name: OLD_INDEX + remove_concurrent_index_by_name :dependency_proxy_manifests, NEW_INDEX + end +end diff --git a/db/migrate/20201202161021_remove_redundant_index_on_merge_request_context_commit_diff_files.rb b/db/migrate/20201202161021_remove_redundant_index_on_merge_request_context_commit_diff_files.rb new file mode 100644 index 00000000000..a9c0a079955 --- /dev/null +++ b/db/migrate/20201202161021_remove_redundant_index_on_merge_request_context_commit_diff_files.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class RemoveRedundantIndexOnMergeRequestContextCommitDiffFiles < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + remove_concurrent_index_by_name :merge_request_context_commit_diff_files, 'idx_mr_cc_diff_files_on_mr_cc_id' + end + + def down + # no-op: this index is not tracked in structure.sql, and is redundant due to idx_mr_cc_diff_files_on_mr_cc_id_and_sha + end +end diff --git a/db/migrate/20201203123524_add_domain_enum_to_alerts.rb b/db/migrate/20201203123524_add_domain_enum_to_alerts.rb new file mode 100644 index 00000000000..f1dec91a346 --- /dev/null +++ b/db/migrate/20201203123524_add_domain_enum_to_alerts.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddDomainEnumToAlerts < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + add_column :alert_management_alerts, :domain, :integer, limit: 2, default: 0 + end + end + + def down + with_lock_retries do + remove_column :alert_management_alerts, :domain, :integer, limit: 2 + end + end +end diff --git a/db/migrate/20201203144655_add_allow_to_edit_commit_to_project_settings.rb b/db/migrate/20201203144655_add_allow_to_edit_commit_to_project_settings.rb new file mode 100644 index 00000000000..efca683d748 --- /dev/null +++ b/db/migrate/20201203144655_add_allow_to_edit_commit_to_project_settings.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddAllowToEditCommitToProjectSettings < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + add_column :project_settings, :allow_editing_commit_messages, :boolean, default: false, null: false + end + end + + def down + with_lock_retries do + remove_column :project_settings, :allow_editing_commit_messages + end + end +end diff --git a/db/migrate/20201203171631_add_index_to_domain.rb b/db/migrate/20201203171631_add_index_to_domain.rb new file mode 100644 index 00000000000..dc7b9539e95 --- /dev/null +++ b/db/migrate/20201203171631_add_index_to_domain.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddIndexToDomain < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + DOWNTIME = false + INDEX_NAME = 'index_alert_management_alerts_on_domain' + + disable_ddl_transaction! + + def up + add_concurrent_index :alert_management_alerts, :domain, name: INDEX_NAME + end + + def down + remove_concurrent_index :alert_management_alerts, :domain, name: INDEX_NAME + end +end diff --git a/db/migrate/20201204085522_add_project_id_into_vulnerability_remediations.rb b/db/migrate/20201204085522_add_project_id_into_vulnerability_remediations.rb new file mode 100644 index 00000000000..6a136ab0389 --- /dev/null +++ b/db/migrate/20201204085522_add_project_id_into_vulnerability_remediations.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddProjectIdIntoVulnerabilityRemediations < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + connection.execute('DELETE FROM vulnerability_remediations') + + add_column :vulnerability_remediations, :project_id, :bigint, null: false # rubocop:disable Rails/NotNullColumn + end + + def down + with_lock_retries do + remove_column :vulnerability_remediations, :project_id + end + end +end diff --git a/db/migrate/20201204090855_add_compound_index_to_vulnerability_remediations_table.rb b/db/migrate/20201204090855_add_compound_index_to_vulnerability_remediations_table.rb new file mode 100644 index 00000000000..0b4b6e552aa --- /dev/null +++ b/db/migrate/20201204090855_add_compound_index_to_vulnerability_remediations_table.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +class AddCompoundIndexToVulnerabilityRemediationsTable < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + NEW_INDEX_NAME = 'index_vulnerability_remediations_on_project_id_and_checksum' + OLD_INDEX_NAME = 'index_vulnerability_remediations_on_checksum' + + disable_ddl_transaction! + + def up + add_concurrent_index :vulnerability_remediations, [:project_id, :checksum], unique: true, name: NEW_INDEX_NAME + add_concurrent_foreign_key :vulnerability_remediations, :projects, column: :project_id + + remove_concurrent_index_by_name :vulnerability_remediations, OLD_INDEX_NAME + end + + def down + add_concurrent_index :vulnerability_remediations, :checksum, unique: true, name: OLD_INDEX_NAME + + remove_concurrent_index_by_name :vulnerability_remediations, NEW_INDEX_NAME + + with_lock_retries do + remove_foreign_key_if_exists :vulnerability_remediations, column: :project_id + end + end +end diff --git a/db/migrate/20201204141038_add_trace_bytesize_to_ci_build_pending_states.rb b/db/migrate/20201204141038_add_trace_bytesize_to_ci_build_pending_states.rb new file mode 100644 index 00000000000..c866493e8d8 --- /dev/null +++ b/db/migrate/20201204141038_add_trace_bytesize_to_ci_build_pending_states.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddTraceBytesizeToCiBuildPendingStates < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + add_column :ci_build_pending_states, :trace_bytesize, :bigint + end +end diff --git a/db/migrate/20201204205814_add_member_events_to_web_hooks.rb b/db/migrate/20201204205814_add_member_events_to_web_hooks.rb new file mode 100644 index 00000000000..edb374f1bdd --- /dev/null +++ b/db/migrate/20201204205814_add_member_events_to_web_hooks.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddMemberEventsToWebHooks < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + add_column :web_hooks, :member_events, :boolean, null: false, default: false + end +end diff --git a/db/migrate/20201204215353_add_pull_mirror_interval_to_plan_limits.rb b/db/migrate/20201204215353_add_pull_mirror_interval_to_plan_limits.rb new file mode 100644 index 00000000000..3484e4c8afa --- /dev/null +++ b/db/migrate/20201204215353_add_pull_mirror_interval_to_plan_limits.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddPullMirrorIntervalToPlanLimits < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + add_column :plan_limits, :pull_mirror_interval_seconds, :integer, default: 300, null: false + end +end diff --git a/db/migrate/20201208081429_update_internal_ids_last_value_for_epics_renamed.rb b/db/migrate/20201208081429_update_internal_ids_last_value_for_epics_renamed.rb new file mode 100644 index 00000000000..fadc365d53c --- /dev/null +++ b/db/migrate/20201208081429_update_internal_ids_last_value_for_epics_renamed.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +class UpdateInternalIdsLastValueForEpicsRenamed < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def up + ApplicationRecord.connection.execute(<<-SQL.squish) + UPDATE internal_ids + SET last_value = epics_max_iids.maximum_iid + FROM + ( + SELECT + MAX(epics.iid) AS maximum_iid, + epics.group_id AS epics_group_id + FROM epics + GROUP BY epics.group_id + ) epics_max_iids + WHERE internal_ids.last_value < epics_max_iids.maximum_iid + AND namespace_id = epics_max_iids.epics_group_id + AND internal_ids.usage = 4 + SQL + end + + def down + # no-op + end +end diff --git a/db/migrate/20201208143911_add_approvals_created_at_index.rb b/db/migrate/20201208143911_add_approvals_created_at_index.rb new file mode 100644 index 00000000000..cfec6b257c2 --- /dev/null +++ b/db/migrate/20201208143911_add_approvals_created_at_index.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddApprovalsCreatedAtIndex < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + INDEX_NAME = 'index_approvals_on_merge_request_id_and_created_at' + + def up + add_concurrent_index :approvals, [:merge_request_id, :created_at], name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :approvals, INDEX_NAME + end +end diff --git a/db/migrate/20201208181411_remove_temporary_blocking_issues_index.rb b/db/migrate/20201208181411_remove_temporary_blocking_issues_index.rb new file mode 100644 index 00000000000..ea63d2d1ed3 --- /dev/null +++ b/db/migrate/20201208181411_remove_temporary_blocking_issues_index.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class RemoveTemporaryBlockingIssuesIndex < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + remove_concurrent_index_by_name(:issue_links, 'tmp_idx_blocking_type_links') + remove_concurrent_index_by_name(:issue_links, 'tmp_idx_blocked_by_type_links') + remove_concurrent_index_by_name(:issues, 'tmp_idx_index_issues_with_outdate_blocking_count') + end + + def down + add_concurrent_index :issue_links, [:source_id], where: 'link_type = 1', name: 'tmp_idx_blocking_type_links' + add_concurrent_index :issue_links, [:target_id], where: 'link_type = 2', name: 'tmp_idx_blocked_by_type_links' + add_concurrent_index :issues, :id, where: '(state_id = 1 AND blocking_issues_count = 0)', name: 'tmp_idx_index_issues_with_outdate_blocking_count' + end +end diff --git a/db/migrate/20201209154746_expand_ci_pipelines_index_on_ci_ref_id.rb b/db/migrate/20201209154746_expand_ci_pipelines_index_on_ci_ref_id.rb new file mode 100644 index 00000000000..b88763a30f9 --- /dev/null +++ b/db/migrate/20201209154746_expand_ci_pipelines_index_on_ci_ref_id.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +class ExpandCiPipelinesIndexOnCiRefId < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + NEW_NAME = 'index_ci_pipelines_on_ci_ref_id_and_more' + OLD_NAME = 'index_ci_pipelines_on_ci_ref_id' + + def up + add_concurrent_index :ci_pipelines, %i[ci_ref_id id source status], order: { id: :desc }, where: 'ci_ref_id IS NOT NULL', name: NEW_NAME + + remove_concurrent_index_by_name :ci_pipelines, OLD_NAME + end + + def down + add_concurrent_index :ci_pipelines, :ci_ref_id, where: 'ci_ref_id IS NOT NULL', name: OLD_NAME + + remove_concurrent_index_by_name :ci_pipelines, NEW_NAME + end +end diff --git a/db/migrate/20201210101250_add_index_projects_on_import_type_and_creator_id.rb b/db/migrate/20201210101250_add_index_projects_on_import_type_and_creator_id.rb new file mode 100644 index 00000000000..5eb8f1d658e --- /dev/null +++ b/db/migrate/20201210101250_add_index_projects_on_import_type_and_creator_id.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddIndexProjectsOnImportTypeAndCreatorId < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_index :projects, [:creator_id, :import_type, :created_at], + where: 'import_type IS NOT NULL', + name: 'index_projects_on_creator_id_import_type_and_created_at_partial' + end + + def down + remove_concurrent_index_by_name :projects, 'index_projects_on_creator_id_import_type_and_created_at_partial' + end +end diff --git a/db/migrate/20201210175044_add_index_to_snippet_on_project_id.rb b/db/migrate/20201210175044_add_index_to_snippet_on_project_id.rb new file mode 100644 index 00000000000..6de4a840409 --- /dev/null +++ b/db/migrate/20201210175044_add_index_to_snippet_on_project_id.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddIndexToSnippetOnProjectId < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + INDEX_NAME = "index_snippet_on_id_and_project_id" + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_index :snippets, [:id, :project_id], name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :snippets, INDEX_NAME + end +end diff --git a/db/migrate/20201211042306_add_deployments_finder_by_finished_at_index.rb b/db/migrate/20201211042306_add_deployments_finder_by_finished_at_index.rb new file mode 100644 index 00000000000..f937ff7a436 --- /dev/null +++ b/db/migrate/20201211042306_add_deployments_finder_by_finished_at_index.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +class AddDeploymentsFinderByFinishedAtIndex < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INDEX_NAME = "index_deployments_on_project_and_finished" + + disable_ddl_transaction! + + def up + add_concurrent_index :deployments, + [:project_id, :finished_at], + where: 'status = 2', + name: INDEX_NAME + end + + def down + remove_concurrent_index :deployments, + [:project_id, :finished_at], + where: 'status = 2', + name: INDEX_NAME + end +end diff --git a/db/migrate/20201211145950_add_bloat_estimate_to_reindex_action.rb b/db/migrate/20201211145950_add_bloat_estimate_to_reindex_action.rb new file mode 100644 index 00000000000..894cee92284 --- /dev/null +++ b/db/migrate/20201211145950_add_bloat_estimate_to_reindex_action.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddBloatEstimateToReindexAction < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + add_column :postgres_reindex_actions, :bloat_estimate_bytes_start, :bigint + end +end diff --git a/db/migrate/20201214084105_add_expiration_policy_completed_at_to_container_repositories.rb b/db/migrate/20201214084105_add_expiration_policy_completed_at_to_container_repositories.rb new file mode 100644 index 00000000000..9e1f21068c2 --- /dev/null +++ b/db/migrate/20201214084105_add_expiration_policy_completed_at_to_container_repositories.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true +class AddExpirationPolicyCompletedAtToContainerRepositories < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def up + add_column(:container_repositories, :expiration_policy_completed_at, :datetime_with_timezone) + end + + def down + remove_column(:container_repositories, :expiration_policy_completed_at) + end +end diff --git a/db/migrate/20201214113729_add_custom_mapping_columns_to_http_integrations.rb b/db/migrate/20201214113729_add_custom_mapping_columns_to_http_integrations.rb new file mode 100644 index 00000000000..dbad28280ac --- /dev/null +++ b/db/migrate/20201214113729_add_custom_mapping_columns_to_http_integrations.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +class AddCustomMappingColumnsToHttpIntegrations < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + add_column :alert_management_http_integrations, :payload_example, :jsonb, null: false, default: {} + add_column :alert_management_http_integrations, :payload_attribute_mapping, :jsonb, null: false, default: {} + end +end diff --git a/db/migrate/20201215084652_delete_mock_deployment_service_records.rb b/db/migrate/20201215084652_delete_mock_deployment_service_records.rb new file mode 100644 index 00000000000..6c601a5e852 --- /dev/null +++ b/db/migrate/20201215084652_delete_mock_deployment_service_records.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class DeleteMockDeploymentServiceRecords < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def up + if Rails.env.development? + execute("DELETE FROM services WHERE type = 'MockDeploymentService'") + end + end + + def down + # no-op + end +end diff --git a/db/migrate/20201215132151_change_unique_index_on_security_findings.rb b/db/migrate/20201215132151_change_unique_index_on_security_findings.rb new file mode 100644 index 00000000000..fe474ef3991 --- /dev/null +++ b/db/migrate/20201215132151_change_unique_index_on_security_findings.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +class ChangeUniqueIndexOnSecurityFindings < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + OLD_INDEX_NAME = 'index_security_findings_on_uuid' + NEW_INDEX_NAME = 'index_security_findings_on_uuid_and_scan_id' + + disable_ddl_transaction! + + class SecurityFinding < ActiveRecord::Base + include EachBatch + + self.table_name = 'security_findings' + end + + def up + add_concurrent_index :security_findings, [:uuid, :scan_id], unique: true, name: NEW_INDEX_NAME + + remove_concurrent_index_by_name :security_findings, OLD_INDEX_NAME + end + + def down + # It is very unlikely that we rollback this migration but just in case if we have to, + # we have to clear the table because there can be multiple records with the same UUID + # which would break the creation of unique index on the `uuid` column. + # We choose clearing the table because just removing the duplicated records would + # cause data inconsistencies. + SecurityFinding.each_batch(of: 10000) { |relation| relation.delete_all } + + add_concurrent_index :security_findings, :uuid, unique: true, name: OLD_INDEX_NAME + + remove_concurrent_index_by_name :security_findings, NEW_INDEX_NAME + end +end diff --git a/db/post_migrate/20201026185514_ensure_u2f_registrations_migrated.rb b/db/post_migrate/20201026185514_ensure_u2f_registrations_migrated.rb new file mode 100644 index 00000000000..121b9fee623 --- /dev/null +++ b/db/post_migrate/20201026185514_ensure_u2f_registrations_migrated.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +class EnsureU2fRegistrationsMigrated < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + BACKGROUND_MIGRATION_CLASS = 'MigrateU2fWebauthn' + BATCH_SIZE = 100 + DOWNTIME = false + + disable_ddl_transaction! + + class U2fRegistration < ActiveRecord::Base + include EachBatch + + self.table_name = 'u2f_registrations' + end + + def up + Gitlab::BackgroundMigration.steal(BACKGROUND_MIGRATION_CLASS) + + # Do a manual update in case we lost BG jobs. The expected record count should be 0 or very low. + U2fRegistration + .joins("LEFT JOIN webauthn_registrations ON webauthn_registrations.u2f_registration_id = u2f_registrations.id") + .where("webauthn_registrations.u2f_registration_id IS NULL") + .each_batch(of: BATCH_SIZE) do |batch, index| + batch.each do |record| + Gitlab::BackgroundMigration::MigrateU2fWebauthn.new.perform(record.id, record.id) + rescue => e + Gitlab::ErrorTracking.track_exception(e, u2f_registration_id: record.id) + end + end + end + + def down + # no-op (we can't "unsteal" migrations) + end +end diff --git a/db/post_migrate/20201030121314_schedule_update_existing_users_that_require_two_factor_auth.rb b/db/post_migrate/20201030121314_schedule_update_existing_users_that_require_two_factor_auth.rb new file mode 100644 index 00000000000..2cb7c9c5250 --- /dev/null +++ b/db/post_migrate/20201030121314_schedule_update_existing_users_that_require_two_factor_auth.rb @@ -0,0 +1,35 @@ +# # frozen_string_literal: true + +class ScheduleUpdateExistingUsersThatRequireTwoFactorAuth < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + MIGRATION = 'UpdateExistingUsersThatRequireTwoFactorAuth' + DELAY_INTERVAL = 2.minutes + BATCH_SIZE = 1000 + INDEX_NAME = 'index_users_on_require_two_factor_authentication_from_group' + + disable_ddl_transaction! + + class User < ActiveRecord::Base + include EachBatch + + self.table_name = 'users' + end + + def up + add_concurrent_index :users, + :require_two_factor_authentication_from_group, + where: 'require_two_factor_authentication_from_group = TRUE', + name: INDEX_NAME + + relation = User.where(require_two_factor_authentication_from_group: true) + + queue_background_migration_jobs_by_range_at_intervals( + relation, MIGRATION, DELAY_INTERVAL, batch_size: BATCH_SIZE) + end + + def down + remove_concurrent_index_by_name :users, INDEX_NAME + end +end diff --git a/db/post_migrate/20201112145311_add_index_on_sha_for_initial_deployments.rb b/db/post_migrate/20201112145311_add_index_on_sha_for_initial_deployments.rb new file mode 100644 index 00000000000..15debddb9cc --- /dev/null +++ b/db/post_migrate/20201112145311_add_index_on_sha_for_initial_deployments.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class AddIndexOnShaForInitialDeployments < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + NEW_INDEX_NAME = 'index_deployments_on_environment_status_sha' + OLD_INDEX_NAME = 'index_deployments_on_environment_id_and_status' + + disable_ddl_transaction! + + def up + add_concurrent_index :deployments, %i[environment_id status sha], name: NEW_INDEX_NAME + remove_concurrent_index_by_name :deployments, OLD_INDEX_NAME + end + + def down + add_concurrent_index :deployments, %i[environment_id status], name: OLD_INDEX_NAME + remove_concurrent_index_by_name :services, NEW_INDEX_NAME + end +end diff --git a/db/post_migrate/20201113105000_update_index_secure_for_api_fuzzing_telemetry.rb b/db/post_migrate/20201113105000_update_index_secure_for_api_fuzzing_telemetry.rb new file mode 100644 index 00000000000..9e8313f79f8 --- /dev/null +++ b/db/post_migrate/20201113105000_update_index_secure_for_api_fuzzing_telemetry.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +class UpdateIndexSecureForApiFuzzingTelemetry < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + disable_ddl_transaction! + + OLD_SECURE_INDEX_NAME = 'index_secure_ci_builds_on_user_id_created_at_parser_features' + NEW_SECURE_INDEX_NAME = 'index_secure_ci_builds_on_user_id_name_created_at' + + def up + add_concurrent_index(:ci_builds, + [:user_id, :name, :created_at], + where: "(((type)::text = 'Ci::Build'::text) AND ((name)::text = ANY (ARRAY[('container_scanning'::character varying)::text, ('dast'::character varying)::text, ('dependency_scanning'::character varying)::text, ('license_management'::character varying)::text, ('license_scanning'::character varying)::text, ('sast'::character varying)::text, ('coverage_fuzzing'::character varying)::text, ('apifuzzer_fuzz'::character varying)::text, ('apifuzzer_fuzz_dnd'::character varying)::text, ('secret_detection'::character varying)::text])))", + name: NEW_SECURE_INDEX_NAME) + remove_concurrent_index_by_name :ci_builds, OLD_SECURE_INDEX_NAME + end + + def down + add_concurrent_index(:ci_builds, + [:user_id, :created_at], + where: "(((type)::text = 'Ci::Build'::text) AND ((name)::text = ANY (ARRAY[('container_scanning'::character varying)::text, ('dast'::character varying)::text, ('dependency_scanning'::character varying)::text, ('license_management'::character varying)::text, ('license_scanning'::character varying)::text, ('sast'::character varying)::text, ('secret_detection'::character varying)::text])))", + name: OLD_SECURE_INDEX_NAME) + remove_concurrent_index_by_name :ci_builds, NEW_SECURE_INDEX_NAME + end +end diff --git a/db/post_migrate/20201119092319_schedule_repopulate_historical_vulnerability_statistics.rb b/db/post_migrate/20201119092319_schedule_repopulate_historical_vulnerability_statistics.rb new file mode 100644 index 00000000000..598cc4d93d0 --- /dev/null +++ b/db/post_migrate/20201119092319_schedule_repopulate_historical_vulnerability_statistics.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +class ScheduleRepopulateHistoricalVulnerabilityStatistics < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + BATCH_SIZE = 50 + DELAY_INTERVAL = 5.minutes + MIGRATION_CLASS = 'PopulateVulnerabilityHistoricalStatistics' + DAY_COUNT = 365 + + disable_ddl_transaction! + + class ProjectSetting < ActiveRecord::Base + include EachBatch + + self.table_name = 'project_settings' + + scope :has_vulnerabilities, -> { where('has_vulnerabilities IS TRUE') } + end + + def up + ProjectSetting.has_vulnerabilities.each_batch(of: BATCH_SIZE) do |batch, index| + migrate_in(index * DELAY_INTERVAL, MIGRATION_CLASS, [batch.pluck(:project_id), DAY_COUNT]) + end + end + + def down + # no-op + end +end diff --git a/db/post_migrate/20201120071303_drop_feature_filter_type_from_user_preferences.rb b/db/post_migrate/20201120071303_drop_feature_filter_type_from_user_preferences.rb new file mode 100644 index 00000000000..b00ea0aba76 --- /dev/null +++ b/db/post_migrate/20201120071303_drop_feature_filter_type_from_user_preferences.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class DropFeatureFilterTypeFromUserPreferences < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + with_lock_retries do + remove_column :user_preferences, :feature_filter_type + end + end + + def down + with_lock_retries do + add_column :user_preferences, :feature_filter_type, :bigint + end + end +end diff --git a/db/post_migrate/20201120140210_add_runner_id_and_id_desc_index_to_ci_builds.rb b/db/post_migrate/20201120140210_add_runner_id_and_id_desc_index_to_ci_builds.rb new file mode 100644 index 00000000000..5eda0e25dbe --- /dev/null +++ b/db/post_migrate/20201120140210_add_runner_id_and_id_desc_index_to_ci_builds.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class AddRunnerIdAndIdDescIndexToCiBuilds < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + NEW_INDEX = 'index_ci_builds_on_runner_id_and_id_desc' + OLD_INDEX = 'index_ci_builds_on_runner_id' + + disable_ddl_transaction! + + def up + add_concurrent_index :ci_builds, %i[runner_id id], name: NEW_INDEX, order: { id: :desc } + remove_concurrent_index_by_name :ci_builds, OLD_INDEX + end + + def down + add_concurrent_index :ci_builds, %i[runner_id], name: OLD_INDEX + remove_concurrent_index_by_name :ci_builds, NEW_INDEX + end +end diff --git a/db/post_migrate/20201124122817_populate_remaining_missing_dismissal_information_for_vulnerabilities.rb b/db/post_migrate/20201124122817_populate_remaining_missing_dismissal_information_for_vulnerabilities.rb new file mode 100644 index 00000000000..9dc41d17231 --- /dev/null +++ b/db/post_migrate/20201124122817_populate_remaining_missing_dismissal_information_for_vulnerabilities.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class PopulateRemainingMissingDismissalInformationForVulnerabilities < ActiveRecord::Migration[6.0] + DOWNTIME = false + + disable_ddl_transaction! + + def up + Gitlab::BackgroundMigration.steal('PopulateMissingVulnerabilityDismissalInformation') + + ::Gitlab::BackgroundMigration::PopulateMissingVulnerabilityDismissalInformation::Vulnerability.broken.each_batch(of: 100) do |batch, index| + vulnerability_ids = batch.pluck(:id) + + ::Gitlab::BackgroundMigration::PopulateMissingVulnerabilityDismissalInformation.new.perform(*vulnerability_ids) + end + end + + def down + # no-op + end +end diff --git a/db/post_migrate/20201124185639_remove_unused_indexes.rb b/db/post_migrate/20201124185639_remove_unused_indexes.rb new file mode 100644 index 00000000000..c4b0d8a84cc --- /dev/null +++ b/db/post_migrate/20201124185639_remove_unused_indexes.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +class RemoveUnusedIndexes < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + remove_concurrent_index_by_name :packages_package_files, "packages_packages_verification_failure_partial" + remove_concurrent_index_by_name :packages_package_files, "packages_packages_verification_checksum_partial" + remove_concurrent_index_by_name :snippet_repositories, 'snippet_repositories_verification_failure_partial' + remove_concurrent_index_by_name :snippet_repositories, 'snippet_repositories_verification_checksum_partial' + remove_concurrent_index_by_name :terraform_state_versions, 'terraform_state_versions_verification_failure_partial' + remove_concurrent_index_by_name :terraform_state_versions, 'terraform_state_versions_verification_checksum_partial' + end + + def down + add_concurrent_index :packages_package_files, :verification_failure, where: "(verification_failure IS NOT NULL)", name: "packages_packages_verification_failure_partial" + add_concurrent_index :packages_package_files, :verification_checksum, where: "(verification_checksum IS NOT NULL)", name: "packages_packages_verification_checksum_partial" + add_concurrent_index :snippet_repositories, :verification_failure, where: "(verification_failure IS NOT NULL)", name: 'snippet_repositories_verification_failure_partial' + add_concurrent_index :snippet_repositories, :verification_checksum, where: "(verification_checksum IS NOT NULL)", name: 'snippet_repositories_verification_checksum_partial' + add_concurrent_index :terraform_state_versions, :verification_failure, where: "(verification_failure IS NOT NULL)", name: 'terraform_state_versions_verification_failure_partial' + add_concurrent_index :terraform_state_versions, :verification_checksum, where: "(verification_checksum IS NOT NULL)", name: 'terraform_state_versions_verification_checksum_partial' + end +end diff --git a/db/post_migrate/20201130103926_schedule_populate_dismissed_state_for_vulnerabilities.rb b/db/post_migrate/20201130103926_schedule_populate_dismissed_state_for_vulnerabilities.rb new file mode 100644 index 00000000000..5e8da532251 --- /dev/null +++ b/db/post_migrate/20201130103926_schedule_populate_dismissed_state_for_vulnerabilities.rb @@ -0,0 +1,62 @@ +# frozen_string_literal: true + +class SchedulePopulateDismissedStateForVulnerabilities < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + TMP_INDEX_NAME = 'tmp_index_on_vulnerabilities_non_dismissed' + + DOWNTIME = false + BATCH_SIZE = 1_000 + VULNERABILITY_BATCH_SIZE = 5_000 + DELAY_INTERVAL = 3.minutes.to_i + MIGRATION_CLASS = 'PopulateDismissedStateForVulnerabilities' + + VULNERABILITY_JOIN_CONDITION = 'JOIN "vulnerability_occurrences" ON "vulnerability_occurrences"."vulnerability_id" = "vulnerabilities"."id"' + FEEDBACK_WHERE_CONDITION = <<~SQL + EXISTS (SELECT 1 FROM vulnerability_feedback + WHERE "vulnerability_occurrences"."project_id" = "vulnerability_feedback"."project_id" + AND "vulnerability_occurrences"."report_type" = "vulnerability_feedback"."category" + AND ENCODE("vulnerability_occurrences"."project_fingerprint", 'hex') = "vulnerability_feedback"."project_fingerprint" + AND "vulnerability_feedback"."feedback_type" = 0 + ) + SQL + + class Vulnerability < ActiveRecord::Base # rubocop:disable Style/Documentation + include EachBatch + + self.table_name = 'vulnerabilities' + end + + disable_ddl_transaction! + + def up + add_concurrent_index(:vulnerabilities, :id, where: 'state <> 2', name: TMP_INDEX_NAME) + + batch = [] + index = 1 + + Vulnerability.where('state <> 2').each_batch(of: VULNERABILITY_BATCH_SIZE) do |relation| + ids = relation + .joins(VULNERABILITY_JOIN_CONDITION) + .where(FEEDBACK_WHERE_CONDITION) + .pluck('vulnerabilities.id') + + ids.each do |id| + batch << id + + if batch.size == BATCH_SIZE + migrate_in(index * DELAY_INTERVAL, MIGRATION_CLASS, batch) + index += 1 + + batch.clear + end + end + end + + migrate_in(index * DELAY_INTERVAL, MIGRATION_CLASS, batch) unless batch.empty? + end + + def down + remove_concurrent_index_by_name(:vulnerabilities, TMP_INDEX_NAME) + end +end diff --git a/db/post_migrate/20201203123201_remove_orphan_service_hooks.rb b/db/post_migrate/20201203123201_remove_orphan_service_hooks.rb new file mode 100644 index 00000000000..c430e2205c2 --- /dev/null +++ b/db/post_migrate/20201203123201_remove_orphan_service_hooks.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +class RemoveOrphanServiceHooks < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + class WebHook < ActiveRecord::Base + include EachBatch + + self.table_name = 'web_hooks' + + def self.service_hooks + where(type: 'ServiceHook') + end + end + + class Service < ActiveRecord::Base + self.table_name = 'services' + end + + def up + WebHook.service_hooks.where.not(service_id: Service.select(:id)).where.not(service_id: nil).each_batch do |relation| + relation.delete_all + end + end + + def down + # no-op + end +end diff --git a/db/post_migrate/20201207151651_truncate_security_findings_table_2.rb b/db/post_migrate/20201207151651_truncate_security_findings_table_2.rb new file mode 100644 index 00000000000..2ac6941be6d --- /dev/null +++ b/db/post_migrate/20201207151651_truncate_security_findings_table_2.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +require_relative Rails.root.join('db', 'post_migrate', '20201102152945_truncate_security_findings_table.rb') + +# This is the second time we are truncating this table +# so the migration class name has choosen like this for this reason. +class TruncateSecurityFindingsTable2 < TruncateSecurityFindingsTable; end diff --git a/db/schema_migrations/20200913115700 b/db/schema_migrations/20200913115700 new file mode 100644 index 00000000000..cb0f401efee --- /dev/null +++ b/db/schema_migrations/20200913115700 @@ -0,0 +1 @@ +dd2ada53f01debcc91070525e4386db959b91881a8945e9082d0b3318ceb35cf
\ No newline at end of file diff --git a/db/schema_migrations/20201011005400 b/db/schema_migrations/20201011005400 new file mode 100644 index 00000000000..1715d21e424 --- /dev/null +++ b/db/schema_migrations/20201011005400 @@ -0,0 +1 @@ +07bfc8e9a684ae64b7d78c9d867f9bafebd46678f6f168aa87d2ad7f0e85d75e
\ No newline at end of file diff --git a/db/schema_migrations/20201021155606 b/db/schema_migrations/20201021155606 new file mode 100644 index 00000000000..958683e9bce --- /dev/null +++ b/db/schema_migrations/20201021155606 @@ -0,0 +1 @@ +d9151c8cafe7a62be9904cb05cc2a6f6e28c2910e69744df1ddd4ad587c83335
\ No newline at end of file diff --git a/db/schema_migrations/20201026185514 b/db/schema_migrations/20201026185514 new file mode 100644 index 00000000000..f6bdd06e501 --- /dev/null +++ b/db/schema_migrations/20201026185514 @@ -0,0 +1 @@ +a9ae0161c40b9c72371d6eb992bd0da8c3698e7784357faac0821e3f513e48d2
\ No newline at end of file diff --git a/db/schema_migrations/20201029144524 b/db/schema_migrations/20201029144524 new file mode 100644 index 00000000000..dd25e96ff02 --- /dev/null +++ b/db/schema_migrations/20201029144524 @@ -0,0 +1 @@ +764f08e3083985bb8e206bd25fb27209702110bb4848c8bbfc6546a2777d9157
\ No newline at end of file diff --git a/db/schema_migrations/20201030121314 b/db/schema_migrations/20201030121314 new file mode 100644 index 00000000000..b96f100cbd7 --- /dev/null +++ b/db/schema_migrations/20201030121314 @@ -0,0 +1 @@ +4875c1def91676d73f14c2fbff9318fc4ab1f26535503fd9700044b687e9714e
\ No newline at end of file diff --git a/db/schema_migrations/20201030223933 b/db/schema_migrations/20201030223933 new file mode 100644 index 00000000000..2fb5f394989 --- /dev/null +++ b/db/schema_migrations/20201030223933 @@ -0,0 +1 @@ +a3aa783f2648a95e3ff8b503ef15b8153759c74ac85b30bf94e39710824e57b0
\ No newline at end of file diff --git a/db/schema_migrations/20201103045515 b/db/schema_migrations/20201103045515 new file mode 100644 index 00000000000..31b56acb147 --- /dev/null +++ b/db/schema_migrations/20201103045515 @@ -0,0 +1 @@ +0172b71564e3d3e30c543890a4672b5a118f8053324b177fbbd9e83357ddf3a8
\ No newline at end of file diff --git a/db/schema_migrations/20201104142036 b/db/schema_migrations/20201104142036 new file mode 100644 index 00000000000..9c41c9c9724 --- /dev/null +++ b/db/schema_migrations/20201104142036 @@ -0,0 +1 @@ +bde71afbe34006eedbd97ac457df31b247fc89a572ca8900c60b16c4d6a8ef93
\ No newline at end of file diff --git a/db/schema_migrations/20201106135608 b/db/schema_migrations/20201106135608 new file mode 100644 index 00000000000..ce6570d9dbf --- /dev/null +++ b/db/schema_migrations/20201106135608 @@ -0,0 +1 @@ +52c8fb75035a08e212db52d032638a0c8f9d91306bfb8015fb3fc403a1cff1ec
\ No newline at end of file diff --git a/db/schema_migrations/20201106193452 b/db/schema_migrations/20201106193452 new file mode 100644 index 00000000000..c5ce966adfc --- /dev/null +++ b/db/schema_migrations/20201106193452 @@ -0,0 +1 @@ +dedc2eba6614c61df6e907ddd9813eea2b00fc43bccc6c3325674ad39950df62
\ No newline at end of file diff --git a/db/schema_migrations/20201109080645 b/db/schema_migrations/20201109080645 new file mode 100644 index 00000000000..403f1951b8b --- /dev/null +++ b/db/schema_migrations/20201109080645 @@ -0,0 +1 @@ +27ee3c5429dba139e6c300961172c4f90d25397e3d1e13d0654e049b63ac3325
\ No newline at end of file diff --git a/db/schema_migrations/20201109080646 b/db/schema_migrations/20201109080646 new file mode 100644 index 00000000000..ef0edcba9cf --- /dev/null +++ b/db/schema_migrations/20201109080646 @@ -0,0 +1 @@ +bdbf3cf39228c9b65b02391a9aa030bdeb06aa3fc9955e2fd53bd784bea37b66
\ No newline at end of file diff --git a/db/schema_migrations/20201110221400 b/db/schema_migrations/20201110221400 new file mode 100644 index 00000000000..703dcba863a --- /dev/null +++ b/db/schema_migrations/20201110221400 @@ -0,0 +1 @@ +9fba60d8805915fcf6af7812e2c752007ac17bb92c8a02c942c0c790d2997441
\ No newline at end of file diff --git a/db/schema_migrations/20201111051655 b/db/schema_migrations/20201111051655 new file mode 100644 index 00000000000..a2fff09e4b0 --- /dev/null +++ b/db/schema_migrations/20201111051655 @@ -0,0 +1 @@ +4340d0f6d3b660b336fdc3166a4960865c79e90f505b1173bab4e0d11c1199b3
\ No newline at end of file diff --git a/db/schema_migrations/20201111051847 b/db/schema_migrations/20201111051847 new file mode 100644 index 00000000000..6d593fc1497 --- /dev/null +++ b/db/schema_migrations/20201111051847 @@ -0,0 +1 @@ +8180908c5e577757b3f518d312cbf0ba77c65b39fa55dde487036541f49114a1
\ No newline at end of file diff --git a/db/schema_migrations/20201111051904 b/db/schema_migrations/20201111051904 new file mode 100644 index 00000000000..857f3a58788 --- /dev/null +++ b/db/schema_migrations/20201111051904 @@ -0,0 +1 @@ +c228aa5c16e63af7520dd1bd90cefb1f74ec2371af3b0e839938d8c628f70e8a
\ No newline at end of file diff --git a/db/schema_migrations/20201111100136 b/db/schema_migrations/20201111100136 new file mode 100644 index 00000000000..da41078fafb --- /dev/null +++ b/db/schema_migrations/20201111100136 @@ -0,0 +1 @@ +7a905f8e636be21e328a622d9871018903982989836e6e0def09fd2c2826691f
\ No newline at end of file diff --git a/db/schema_migrations/20201111115414 b/db/schema_migrations/20201111115414 new file mode 100644 index 00000000000..b6fc30be8df --- /dev/null +++ b/db/schema_migrations/20201111115414 @@ -0,0 +1 @@ +0efb2dcfc65da007a67a15857d0a283dad301650f999a4227aa54ea00dca24bf
\ No newline at end of file diff --git a/db/schema_migrations/20201111145317 b/db/schema_migrations/20201111145317 new file mode 100644 index 00000000000..b6b33df7645 --- /dev/null +++ b/db/schema_migrations/20201111145317 @@ -0,0 +1 @@ +51d26848722466503e43b0f41e2fa43ee6073a16b358311a0aff6d77fbb12b1d
\ No newline at end of file diff --git a/db/schema_migrations/20201112132808 b/db/schema_migrations/20201112132808 new file mode 100644 index 00000000000..d6cc9595c80 --- /dev/null +++ b/db/schema_migrations/20201112132808 @@ -0,0 +1 @@ +2b30b1ba41a49ce4a81711e6fef1dbcdaf8b76f824aaf83702cd27833815e57b
\ No newline at end of file diff --git a/db/schema_migrations/20201112145311 b/db/schema_migrations/20201112145311 new file mode 100644 index 00000000000..b6b88862a38 --- /dev/null +++ b/db/schema_migrations/20201112145311 @@ -0,0 +1 @@ +085bb21bdbe3d062b3000d63c111aab5ba75c7e049c32779cccac5c320583759
\ No newline at end of file diff --git a/db/schema_migrations/20201112173532 b/db/schema_migrations/20201112173532 new file mode 100644 index 00000000000..a0c879e5b36 --- /dev/null +++ b/db/schema_migrations/20201112173532 @@ -0,0 +1 @@ +d88a47333a4cc2b6c4aafa817c766822728d14b947a195c7c40b39e0c8b41610
\ No newline at end of file diff --git a/db/schema_migrations/20201112173911 b/db/schema_migrations/20201112173911 new file mode 100644 index 00000000000..aa98ecb7f14 --- /dev/null +++ b/db/schema_migrations/20201112173911 @@ -0,0 +1 @@ +dde78a32d53a695e82b44574458b3670dce4803ffc6f34a1216f3671cca470ed
\ No newline at end of file diff --git a/db/schema_migrations/20201112215028 b/db/schema_migrations/20201112215028 new file mode 100644 index 00000000000..07cedc7a146 --- /dev/null +++ b/db/schema_migrations/20201112215028 @@ -0,0 +1 @@ +d8d774e788eeaaecbda3cb7c5530926e74843d844bfad27b6a6e65bf5f89ac8a
\ No newline at end of file diff --git a/db/schema_migrations/20201113105000 b/db/schema_migrations/20201113105000 new file mode 100644 index 00000000000..0fe67898517 --- /dev/null +++ b/db/schema_migrations/20201113105000 @@ -0,0 +1 @@ +9f2c60df8e89f89d721f7f7917048eb914fa7c7726ec42dcb772ff7a90c54a9c
\ No newline at end of file diff --git a/db/schema_migrations/20201116090328 b/db/schema_migrations/20201116090328 new file mode 100644 index 00000000000..423eb54ff21 --- /dev/null +++ b/db/schema_migrations/20201116090328 @@ -0,0 +1 @@ +39a109d2a0daaac6e5d40b13ee48f5388b85320c1ae6214408596417794307f3
\ No newline at end of file diff --git a/db/schema_migrations/20201116211829 b/db/schema_migrations/20201116211829 new file mode 100644 index 00000000000..bc583573000 --- /dev/null +++ b/db/schema_migrations/20201116211829 @@ -0,0 +1 @@ +ecec9923058e58a5279f75dd9c2ff61263f187a1d893bb84241c57a4061dadf8
\ No newline at end of file diff --git a/db/schema_migrations/20201117054609 b/db/schema_migrations/20201117054609 new file mode 100644 index 00000000000..624c12754d3 --- /dev/null +++ b/db/schema_migrations/20201117054609 @@ -0,0 +1 @@ +119afd73a58c247522446bc9693ece5c83a25c279e4dd7dfb942f7febd5b7a82
\ No newline at end of file diff --git a/db/schema_migrations/20201117075742 b/db/schema_migrations/20201117075742 new file mode 100644 index 00000000000..b3efeee7e0b --- /dev/null +++ b/db/schema_migrations/20201117075742 @@ -0,0 +1 @@ +a39bad8b213833c84370cf64188a3ce444fd8aeeff239c29f5f2f633d94ac6bb
\ No newline at end of file diff --git a/db/schema_migrations/20201117153333 b/db/schema_migrations/20201117153333 new file mode 100644 index 00000000000..ee496f91777 --- /dev/null +++ b/db/schema_migrations/20201117153333 @@ -0,0 +1 @@ +008f3a69d23abbd513336c5a48b2448e470a9413920beeb6a1684d0c6840d6a4
\ No newline at end of file diff --git a/db/schema_migrations/20201117184334 b/db/schema_migrations/20201117184334 new file mode 100644 index 00000000000..347d6ca087c --- /dev/null +++ b/db/schema_migrations/20201117184334 @@ -0,0 +1 @@ +7988d01be5fac0f2a28cc97e309bfa16450d2e376888401fc2ad521aa0082020
\ No newline at end of file diff --git a/db/schema_migrations/20201117203224 b/db/schema_migrations/20201117203224 new file mode 100644 index 00000000000..c161bc5c404 --- /dev/null +++ b/db/schema_migrations/20201117203224 @@ -0,0 +1 @@ +4c66fd85d6c219d9bedb06c3a38610ecd2c2b1fcb668b132624d7bb76ae2a1ee
\ No newline at end of file diff --git a/db/schema_migrations/20201117213024 b/db/schema_migrations/20201117213024 new file mode 100644 index 00000000000..209e170caa0 --- /dev/null +++ b/db/schema_migrations/20201117213024 @@ -0,0 +1 @@ +13b30e906a473ead632b808dca2dea2f9fff63920c4e55b97c43d2b30955c0c2
\ No newline at end of file diff --git a/db/schema_migrations/20201118093135 b/db/schema_migrations/20201118093135 new file mode 100644 index 00000000000..7bf60967db0 --- /dev/null +++ b/db/schema_migrations/20201118093135 @@ -0,0 +1 @@ +4be52737be2bc74e666e973fa42f17a16e652cb4fa2368c7f347c3f1f8941dbb
\ No newline at end of file diff --git a/db/schema_migrations/20201119031515 b/db/schema_migrations/20201119031515 new file mode 100644 index 00000000000..3abfe9de238 --- /dev/null +++ b/db/schema_migrations/20201119031515 @@ -0,0 +1 @@ +6d2e6937c9e41975b1fd402bf2985796792a1e5f8e4f4f98bc76b65ff73c4e02
\ No newline at end of file diff --git a/db/schema_migrations/20201119053603 b/db/schema_migrations/20201119053603 new file mode 100644 index 00000000000..7555dbfb2ca --- /dev/null +++ b/db/schema_migrations/20201119053603 @@ -0,0 +1 @@ +c7567489156bbc047cf9f7827f060ad507fd5d328179f2796566a7dc54806e3e
\ No newline at end of file diff --git a/db/schema_migrations/20201119092319 b/db/schema_migrations/20201119092319 new file mode 100644 index 00000000000..c48e0fc2563 --- /dev/null +++ b/db/schema_migrations/20201119092319 @@ -0,0 +1 @@ +9ff8ddefff1df81f1eac2ccfc6f3019bb77a6129280e799c0abe54f51e09277a
\ No newline at end of file diff --git a/db/schema_migrations/20201119125730 b/db/schema_migrations/20201119125730 new file mode 100644 index 00000000000..39de483e890 --- /dev/null +++ b/db/schema_migrations/20201119125730 @@ -0,0 +1 @@ +9fb3c338c999617b40e4c63f24ea037b5b1403354b93c2117e028ad8348d96aa
\ No newline at end of file diff --git a/db/schema_migrations/20201119133534 b/db/schema_migrations/20201119133534 new file mode 100644 index 00000000000..b3999923381 --- /dev/null +++ b/db/schema_migrations/20201119133534 @@ -0,0 +1 @@ +6c8fc7904f50a792e10b5f1b0abe90ba21b1bdfd47430b3caa0df870c0a24079
\ No newline at end of file diff --git a/db/schema_migrations/20201119133604 b/db/schema_migrations/20201119133604 new file mode 100644 index 00000000000..865ce7db9e7 --- /dev/null +++ b/db/schema_migrations/20201119133604 @@ -0,0 +1 @@ +bfb8ac3b697675bd4fca53273c6c6feb2f7a5659cbdaf57b9b4adb3e189b74ad
\ No newline at end of file diff --git a/db/schema_migrations/20201119162801 b/db/schema_migrations/20201119162801 new file mode 100644 index 00000000000..b6aa67ad5f6 --- /dev/null +++ b/db/schema_migrations/20201119162801 @@ -0,0 +1 @@ +c41f4649540c23d25f0ae26c3754476409b5e77f53b96db65f2c1fd4a6caf087
\ No newline at end of file diff --git a/db/schema_migrations/20201119164605 b/db/schema_migrations/20201119164605 new file mode 100644 index 00000000000..61e4c88a241 --- /dev/null +++ b/db/schema_migrations/20201119164605 @@ -0,0 +1 @@ +5abd2cfdf96b493f8d3ecc857f850acb95e3ea30307a72c2e6f20c5feff8f5e7
\ No newline at end of file diff --git a/db/schema_migrations/20201119213406 b/db/schema_migrations/20201119213406 new file mode 100644 index 00000000000..0bd2418a6ee --- /dev/null +++ b/db/schema_migrations/20201119213406 @@ -0,0 +1 @@ +33970a1295b84040c82034041c99f13578352844c9c6cb092b5cc35913576a7e
\ No newline at end of file diff --git a/db/schema_migrations/20201120071303 b/db/schema_migrations/20201120071303 new file mode 100644 index 00000000000..23d712c9993 --- /dev/null +++ b/db/schema_migrations/20201120071303 @@ -0,0 +1 @@ +9684403a075bd1ddf3ae9290ad9a39ed24f4624d99498f8b8ed567588c15e082
\ No newline at end of file diff --git a/db/schema_migrations/20201120125953 b/db/schema_migrations/20201120125953 new file mode 100644 index 00000000000..23aca1557e0 --- /dev/null +++ b/db/schema_migrations/20201120125953 @@ -0,0 +1 @@ +8b60a6bc892f9700df81de9909595544f9f820621a210906a249428ddec9eefa
\ No newline at end of file diff --git a/db/schema_migrations/20201120140210 b/db/schema_migrations/20201120140210 new file mode 100644 index 00000000000..5a281f95f5d --- /dev/null +++ b/db/schema_migrations/20201120140210 @@ -0,0 +1 @@ +6b88d79aa8d373fa1d9aa2698a9d20c09aff14ef16af4c123abd4e7c98e41311
\ No newline at end of file diff --git a/db/schema_migrations/20201123081307 b/db/schema_migrations/20201123081307 new file mode 100644 index 00000000000..5169f80108d --- /dev/null +++ b/db/schema_migrations/20201123081307 @@ -0,0 +1 @@ +9b212f5fd6f58123f0d46249c82b2da49af9bcdd36bcc0de610c4be186b17345
\ No newline at end of file diff --git a/db/schema_migrations/20201123161611 b/db/schema_migrations/20201123161611 new file mode 100644 index 00000000000..bcd28f2b4da --- /dev/null +++ b/db/schema_migrations/20201123161611 @@ -0,0 +1 @@ +9d69938cda6db1510ed17d087cc1a582af1e5482d65e4fb457e34011e09c3469
\ No newline at end of file diff --git a/db/schema_migrations/20201124030537 b/db/schema_migrations/20201124030537 new file mode 100644 index 00000000000..6754e179ae3 --- /dev/null +++ b/db/schema_migrations/20201124030537 @@ -0,0 +1 @@ +2929b74d9b9d6e205c0e1fb2aaaffe323394058f6e583c56035a2c83b4d4ff03
\ No newline at end of file diff --git a/db/schema_migrations/20201124075951 b/db/schema_migrations/20201124075951 new file mode 100644 index 00000000000..b659c83ad21 --- /dev/null +++ b/db/schema_migrations/20201124075951 @@ -0,0 +1 @@ +6779e92fa65ff206b19bb99a5a242e3ab5fd7a8d15be89dee925d1fbb5b00632
\ No newline at end of file diff --git a/db/schema_migrations/20201124122817 b/db/schema_migrations/20201124122817 new file mode 100644 index 00000000000..d7fd2707dd3 --- /dev/null +++ b/db/schema_migrations/20201124122817 @@ -0,0 +1 @@ +1113642dfc9069dcea01ac12b1653dfcf67b3aea449538e9747d3bc857ce88d8
\ No newline at end of file diff --git a/db/schema_migrations/20201124185639 b/db/schema_migrations/20201124185639 new file mode 100644 index 00000000000..9ca03d7d837 --- /dev/null +++ b/db/schema_migrations/20201124185639 @@ -0,0 +1 @@ +dd36b2815c62ef9710d88fa92c410398a228c50a7e51d44ce02e85c9f63d648e
\ No newline at end of file diff --git a/db/schema_migrations/20201125030847 b/db/schema_migrations/20201125030847 new file mode 100644 index 00000000000..2b88d374d52 --- /dev/null +++ b/db/schema_migrations/20201125030847 @@ -0,0 +1 @@ +e19c6d019f1478e5998b2a264c5327dc82da7fde7edd19b15da70a30c5779844
\ No newline at end of file diff --git a/db/schema_migrations/20201125233219 b/db/schema_migrations/20201125233219 new file mode 100644 index 00000000000..54728b704e9 --- /dev/null +++ b/db/schema_migrations/20201125233219 @@ -0,0 +1 @@ +451d7f29392f965467f364c7b119d269551e2dc1485e8cb15ebd14753fdb6e6a
\ No newline at end of file diff --git a/db/schema_migrations/20201126165919 b/db/schema_migrations/20201126165919 new file mode 100644 index 00000000000..533273ec9a2 --- /dev/null +++ b/db/schema_migrations/20201126165919 @@ -0,0 +1 @@ +a68c609800f5bdb0a77e39f706b410477493e7b7db3af11e4b2a67534df31079
\ No newline at end of file diff --git a/db/schema_migrations/20201126172030 b/db/schema_migrations/20201126172030 new file mode 100644 index 00000000000..789a914af41 --- /dev/null +++ b/db/schema_migrations/20201126172030 @@ -0,0 +1 @@ +65dcc2a53d48acc83dbfc5276e8cfc1eee5f20ffea8355d86df1f2d5b329061b
\ No newline at end of file diff --git a/db/schema_migrations/20201126190039 b/db/schema_migrations/20201126190039 new file mode 100644 index 00000000000..0e70a7e92bf --- /dev/null +++ b/db/schema_migrations/20201126190039 @@ -0,0 +1 @@ +65935afe9b4ad195aaf31cddb915dcd62b23674e278e93ce7ff9b4ae98e32331
\ No newline at end of file diff --git a/db/schema_migrations/20201127141433 b/db/schema_migrations/20201127141433 new file mode 100644 index 00000000000..b3db67b566e --- /dev/null +++ b/db/schema_migrations/20201127141433 @@ -0,0 +1 @@ +70fae11d6a73ea8b2ad75c574716f48e9cc78a58ae23db48e74840646fd46672
\ No newline at end of file diff --git a/db/schema_migrations/20201127170848 b/db/schema_migrations/20201127170848 new file mode 100644 index 00000000000..11c7ccbb236 --- /dev/null +++ b/db/schema_migrations/20201127170848 @@ -0,0 +1 @@ +ef378c2512a2c3940016bcc82bc8885762ed1a982e38cba1c452a9063e0717e2
\ No newline at end of file diff --git a/db/schema_migrations/20201130103926 b/db/schema_migrations/20201130103926 new file mode 100644 index 00000000000..518d58860af --- /dev/null +++ b/db/schema_migrations/20201130103926 @@ -0,0 +1 @@ +27cd7e7cd01175c157e6aa666b2263bf29210277d5acd997a0619cee67870345
\ No newline at end of file diff --git a/db/schema_migrations/20201201033202 b/db/schema_migrations/20201201033202 new file mode 100644 index 00000000000..a061dc5f404 --- /dev/null +++ b/db/schema_migrations/20201201033202 @@ -0,0 +1 @@ +418481f8281f8908740d3a8378b420f4d83853aab139b3401f7e410fc97d2488
\ No newline at end of file diff --git a/db/schema_migrations/20201201034258 b/db/schema_migrations/20201201034258 new file mode 100644 index 00000000000..6cf3caf2a06 --- /dev/null +++ b/db/schema_migrations/20201201034258 @@ -0,0 +1 @@ +12cc1beb73bcc31f6546066842913284aabba22ea4e93095271c0cfdacfd0858
\ No newline at end of file diff --git a/db/schema_migrations/20201201161655 b/db/schema_migrations/20201201161655 new file mode 100644 index 00000000000..892d2bfc08d --- /dev/null +++ b/db/schema_migrations/20201201161655 @@ -0,0 +1 @@ +d9ad12dce02d6823536f3206e9c90a0da82c08089c3ce252e8ef28a59589e747
\ No newline at end of file diff --git a/db/schema_migrations/20201201163227 b/db/schema_migrations/20201201163227 new file mode 100644 index 00000000000..0366850ee2f --- /dev/null +++ b/db/schema_migrations/20201201163227 @@ -0,0 +1 @@ +cc978ac56ed177575706436c52125b51915dff97a20ed47ae0c7b16caa837313
\ No newline at end of file diff --git a/db/schema_migrations/20201201175656 b/db/schema_migrations/20201201175656 new file mode 100644 index 00000000000..52c98e28eee --- /dev/null +++ b/db/schema_migrations/20201201175656 @@ -0,0 +1 @@ +54ed18361a28d0b750cbbdb3bfb53b7e4bbe3d1d7264de51522796d3bd15f7a5
\ No newline at end of file diff --git a/db/schema_migrations/20201201190002 b/db/schema_migrations/20201201190002 new file mode 100644 index 00000000000..aac9ac34c64 --- /dev/null +++ b/db/schema_migrations/20201201190002 @@ -0,0 +1 @@ +f4ec800e68cbe092775b428d3ff85a4a84be0d55d70e59d23de390847ea3c2b7
\ No newline at end of file diff --git a/db/schema_migrations/20201201192112 b/db/schema_migrations/20201201192112 new file mode 100644 index 00000000000..26e17430dbe --- /dev/null +++ b/db/schema_migrations/20201201192112 @@ -0,0 +1 @@ +bd10ddc5e78ff2d878f3ce6a45a3e808b89e0885dcc710b87f44ede15ace372b
\ No newline at end of file diff --git a/db/schema_migrations/20201202003042 b/db/schema_migrations/20201202003042 new file mode 100644 index 00000000000..13bbfe9f8af --- /dev/null +++ b/db/schema_migrations/20201202003042 @@ -0,0 +1 @@ +779effb1db70aa8b9a24942ec3e0681064c01b69ee4731f82477c54361a670b0
\ No newline at end of file diff --git a/db/schema_migrations/20201202025644 b/db/schema_migrations/20201202025644 new file mode 100644 index 00000000000..189704a6d1e --- /dev/null +++ b/db/schema_migrations/20201202025644 @@ -0,0 +1 @@ +3b0e685327e2199e0a6721e00d1fa3c9fee3a173ce1cf5ddd99df3349a28fea9
\ No newline at end of file diff --git a/db/schema_migrations/20201202025937 b/db/schema_migrations/20201202025937 new file mode 100644 index 00000000000..eb2088259a5 --- /dev/null +++ b/db/schema_migrations/20201202025937 @@ -0,0 +1 @@ +d0706f4a60ae6f26be206aee80fdeb4a7e5c4c0b99e518140ae3cb8c47ed7a82
\ No newline at end of file diff --git a/db/schema_migrations/20201202133606 b/db/schema_migrations/20201202133606 new file mode 100644 index 00000000000..693c4fc074e --- /dev/null +++ b/db/schema_migrations/20201202133606 @@ -0,0 +1 @@ +83c7e30abb0c8f4e11faa648a4a509029aafa3230e64fe7b14d63f0a39df05ad
\ No newline at end of file diff --git a/db/schema_migrations/20201202142751 b/db/schema_migrations/20201202142751 new file mode 100644 index 00000000000..cb0013a5d70 --- /dev/null +++ b/db/schema_migrations/20201202142751 @@ -0,0 +1 @@ +cb11dc9996b1706feaa8a53f96cbaa6209a4d07b3be9e88ebc3d1e1ada561287
\ No newline at end of file diff --git a/db/schema_migrations/20201202150001 b/db/schema_migrations/20201202150001 new file mode 100644 index 00000000000..a22d35f424e --- /dev/null +++ b/db/schema_migrations/20201202150001 @@ -0,0 +1 @@ +af9d8c7cda142e2a96a289ebd7afef73367bd544a60794c9e0414c7b82bef8a2
\ No newline at end of file diff --git a/db/schema_migrations/20201202155913 b/db/schema_migrations/20201202155913 new file mode 100644 index 00000000000..7cb0055455d --- /dev/null +++ b/db/schema_migrations/20201202155913 @@ -0,0 +1 @@ +926f54b5756fa9495e71f2340823418b5679195d5720212dddda0d0c6396629e
\ No newline at end of file diff --git a/db/schema_migrations/20201202160105 b/db/schema_migrations/20201202160105 new file mode 100644 index 00000000000..ff2e6f4ddbc --- /dev/null +++ b/db/schema_migrations/20201202160105 @@ -0,0 +1 @@ +a011331d225cef852d2402add6fb2b77e7325b87d58343a9367e0dd31a32ed7f
\ No newline at end of file diff --git a/db/schema_migrations/20201202161021 b/db/schema_migrations/20201202161021 new file mode 100644 index 00000000000..eae05342e40 --- /dev/null +++ b/db/schema_migrations/20201202161021 @@ -0,0 +1 @@ +696c1d9f8cc90337549530e129e6abf4429d218f151cefaacacacb6e3f33d1c7
\ No newline at end of file diff --git a/db/schema_migrations/20201203123201 b/db/schema_migrations/20201203123201 new file mode 100644 index 00000000000..e3799665ffc --- /dev/null +++ b/db/schema_migrations/20201203123201 @@ -0,0 +1 @@ +85a642d60e92a880e0a0699f8dcca42aebe2b5363bfcc3010e647734c7cb7dec
\ No newline at end of file diff --git a/db/schema_migrations/20201203123524 b/db/schema_migrations/20201203123524 new file mode 100644 index 00000000000..27f47a237c0 --- /dev/null +++ b/db/schema_migrations/20201203123524 @@ -0,0 +1 @@ +4bb54293c339e20082a739f7724b02141d8fb3b0b140e21ac2acab6cbd2d2f01
\ No newline at end of file diff --git a/db/schema_migrations/20201203144655 b/db/schema_migrations/20201203144655 new file mode 100644 index 00000000000..50c5e928c82 --- /dev/null +++ b/db/schema_migrations/20201203144655 @@ -0,0 +1 @@ +700e5d0d5615080f7d747cc71dc437abd24a76b5783f8db7d613036142841e09
\ No newline at end of file diff --git a/db/schema_migrations/20201203171631 b/db/schema_migrations/20201203171631 new file mode 100644 index 00000000000..e93633344b9 --- /dev/null +++ b/db/schema_migrations/20201203171631 @@ -0,0 +1 @@ +3b6d3fb9c279f5e8c76921e654b188a5a5ba0fddd7ff753a03706b41f43240ed
\ No newline at end of file diff --git a/db/schema_migrations/20201204085522 b/db/schema_migrations/20201204085522 new file mode 100644 index 00000000000..21009a5d34a --- /dev/null +++ b/db/schema_migrations/20201204085522 @@ -0,0 +1 @@ +a1d8228731066fb6dfe436b4d8d034353421d1f45f3896e963f3c7f15fb09fbc
\ No newline at end of file diff --git a/db/schema_migrations/20201204090855 b/db/schema_migrations/20201204090855 new file mode 100644 index 00000000000..7e6bb71d977 --- /dev/null +++ b/db/schema_migrations/20201204090855 @@ -0,0 +1 @@ +01712e32d95578fe701738529abfa0e051ef68ed646f7a9c7f775f8a8d108578
\ No newline at end of file diff --git a/db/schema_migrations/20201204141038 b/db/schema_migrations/20201204141038 new file mode 100644 index 00000000000..c422a095eda --- /dev/null +++ b/db/schema_migrations/20201204141038 @@ -0,0 +1 @@ +9dc8d6b557198a60def4690ea06ec3dc9a29deca9082b7b03666aaed483a42f1
\ No newline at end of file diff --git a/db/schema_migrations/20201204205814 b/db/schema_migrations/20201204205814 new file mode 100644 index 00000000000..2308ba1245c --- /dev/null +++ b/db/schema_migrations/20201204205814 @@ -0,0 +1 @@ +8178b8a9acf7d2d8990bb6f7d984eb9e3b77d45cb2a8b54b56500ef6f93772ad
\ No newline at end of file diff --git a/db/schema_migrations/20201204215353 b/db/schema_migrations/20201204215353 new file mode 100644 index 00000000000..08305f419eb --- /dev/null +++ b/db/schema_migrations/20201204215353 @@ -0,0 +1 @@ +a3dd8cfe4a5d83ca370cac90acf127facf40c0fd63ae8d1d3f99418295bae148
\ No newline at end of file diff --git a/db/schema_migrations/20201207151651 b/db/schema_migrations/20201207151651 new file mode 100644 index 00000000000..92d8fbec6bd --- /dev/null +++ b/db/schema_migrations/20201207151651 @@ -0,0 +1 @@ +93def9138efddc9cd0ace5524dc5cf6cdc0221977083324c5c0ad3cf3fb75e55
\ No newline at end of file diff --git a/db/schema_migrations/20201208081429 b/db/schema_migrations/20201208081429 new file mode 100644 index 00000000000..c7156129ecc --- /dev/null +++ b/db/schema_migrations/20201208081429 @@ -0,0 +1 @@ +5c429e8090fd779ba29a8bd78d69e78d1d5d143a6fd3097a715e178fb150d877
\ No newline at end of file diff --git a/db/schema_migrations/20201208143911 b/db/schema_migrations/20201208143911 new file mode 100644 index 00000000000..b953bd502f1 --- /dev/null +++ b/db/schema_migrations/20201208143911 @@ -0,0 +1 @@ +1e55cafd8b7c5b13514a8709c05d75c8ef0bdd99ea1a5bd3d36f8d20fc0ead2b
\ No newline at end of file diff --git a/db/schema_migrations/20201208181411 b/db/schema_migrations/20201208181411 new file mode 100644 index 00000000000..951925cef9d --- /dev/null +++ b/db/schema_migrations/20201208181411 @@ -0,0 +1 @@ +7bbd0cfb98c3e051942bf062444d2586588fe029d9a9548f0e50e0fbad10a490
\ No newline at end of file diff --git a/db/schema_migrations/20201209154746 b/db/schema_migrations/20201209154746 new file mode 100644 index 00000000000..3f88f88dc50 --- /dev/null +++ b/db/schema_migrations/20201209154746 @@ -0,0 +1 @@ +98e132fd1daadca14b4313783691c523290efdc81372ec8416bcea1a597376bf
\ No newline at end of file diff --git a/db/schema_migrations/20201210101250 b/db/schema_migrations/20201210101250 new file mode 100644 index 00000000000..4657c9f264e --- /dev/null +++ b/db/schema_migrations/20201210101250 @@ -0,0 +1 @@ +734ef1c319549df72bbbfe3acf93ca05f7a6c5547a1efdcaba780195181f5f9a
\ No newline at end of file diff --git a/db/schema_migrations/20201210175044 b/db/schema_migrations/20201210175044 new file mode 100644 index 00000000000..63da0b55aed --- /dev/null +++ b/db/schema_migrations/20201210175044 @@ -0,0 +1 @@ +32f0889266a05c12f1bba6d3d8646c6cd5c27ffcc01e4cc0cb1721c495e17237
\ No newline at end of file diff --git a/db/schema_migrations/20201211042306 b/db/schema_migrations/20201211042306 new file mode 100644 index 00000000000..07d4bc66b63 --- /dev/null +++ b/db/schema_migrations/20201211042306 @@ -0,0 +1 @@ +a4d82ca9610a1426bb026c43a00791bcdae38d49ed3ca59285d5a752124a7f20
\ No newline at end of file diff --git a/db/schema_migrations/20201211145950 b/db/schema_migrations/20201211145950 new file mode 100644 index 00000000000..f3c3687bc4f --- /dev/null +++ b/db/schema_migrations/20201211145950 @@ -0,0 +1 @@ +ecf6b392f35bb0ef905144a4605bcb927ce767240e47ec3b0653a94139b987bd
\ No newline at end of file diff --git a/db/schema_migrations/20201214084105 b/db/schema_migrations/20201214084105 new file mode 100644 index 00000000000..1b5eb10e48e --- /dev/null +++ b/db/schema_migrations/20201214084105 @@ -0,0 +1 @@ +e991bf621a2eb047903f796256ee65b781e5dd34aff12449f2347480bf7791a7
\ No newline at end of file diff --git a/db/schema_migrations/20201214113729 b/db/schema_migrations/20201214113729 new file mode 100644 index 00000000000..56bc2113a34 --- /dev/null +++ b/db/schema_migrations/20201214113729 @@ -0,0 +1 @@ +9c2f6c75126172d4876db33cfd814f974a381df97a23aec21f2550ec288946c2
\ No newline at end of file diff --git a/db/schema_migrations/20201215084652 b/db/schema_migrations/20201215084652 new file mode 100644 index 00000000000..1b0cab62c8b --- /dev/null +++ b/db/schema_migrations/20201215084652 @@ -0,0 +1 @@ +8aa288d8f4a02030528e096c3aa4e109c57f4ca2515442ca0bfb3463cf9ff609
\ No newline at end of file diff --git a/db/schema_migrations/20201215132151 b/db/schema_migrations/20201215132151 new file mode 100644 index 00000000000..e051fb91e12 --- /dev/null +++ b/db/schema_migrations/20201215132151 @@ -0,0 +1 @@ +916f29e6ab89551fd785c3a8584c24b72d9002ada30d159e9ff826cb247199b5
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index f29f9178a26..105b7701409 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -8811,6 +8811,7 @@ CREATE TABLE alert_management_alerts ( payload jsonb DEFAULT '{}'::jsonb NOT NULL, prometheus_alert_id integer, environment_id integer, + domain smallint DEFAULT 0, CONSTRAINT check_2df3e2fdc1 CHECK ((char_length(monitoring_tool) <= 100)), CONSTRAINT check_5e9e57cadb CHECK ((char_length(description) <= 1000)), CONSTRAINT check_bac14dddde CHECK ((char_length(service) <= 100)), @@ -8836,6 +8837,8 @@ CREATE TABLE alert_management_http_integrations ( encrypted_token_iv text NOT NULL, endpoint_identifier text NOT NULL, name text NOT NULL, + payload_example jsonb DEFAULT '{}'::jsonb NOT NULL, + payload_attribute_mapping jsonb DEFAULT '{}'::jsonb NOT NULL, CONSTRAINT check_286943b636 CHECK ((char_length(encrypted_token_iv) <= 255)), CONSTRAINT check_392143ccf4 CHECK ((char_length(name) <= 255)), CONSTRAINT check_e270820180 CHECK ((char_length(endpoint_identifier) <= 255)), @@ -8990,6 +8993,28 @@ CREATE SEQUENCE analytics_devops_adoption_segments_id_seq ALTER SEQUENCE analytics_devops_adoption_segments_id_seq OWNED BY analytics_devops_adoption_segments.id; +CREATE TABLE analytics_devops_adoption_snapshots ( + id bigint NOT NULL, + segment_id bigint NOT NULL, + recorded_at timestamp with time zone NOT NULL, + issue_opened boolean NOT NULL, + merge_request_opened boolean NOT NULL, + merge_request_approved boolean NOT NULL, + runner_configured boolean NOT NULL, + pipeline_succeeded boolean NOT NULL, + deploy_succeeded boolean NOT NULL, + security_scan_succeeded boolean NOT NULL +); + +CREATE SEQUENCE analytics_devops_adoption_snapshots_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE analytics_devops_adoption_snapshots_id_seq OWNED BY analytics_devops_adoption_snapshots.id; + CREATE TABLE analytics_instance_statistics_measurements ( id bigint NOT NULL, count bigint NOT NULL, @@ -9320,6 +9345,8 @@ CREATE TABLE application_settings ( elasticsearch_indexed_file_size_limit_kb integer DEFAULT 1024 NOT NULL, enforce_namespace_storage_limit boolean DEFAULT false NOT NULL, container_registry_delete_tags_service_timeout integer DEFAULT 250 NOT NULL, + kroki_url character varying, + kroki_enabled boolean, elasticsearch_client_request_timeout integer DEFAULT 0 NOT NULL, gitpod_enabled boolean DEFAULT false NOT NULL, gitpod_url text DEFAULT 'https://gitpod.io/'::text, @@ -9345,10 +9372,15 @@ CREATE TABLE application_settings ( encrypted_cloud_license_auth_token text, encrypted_cloud_license_auth_token_iv text, secret_detection_revocation_token_types_url text, + cloud_license_enabled boolean DEFAULT false NOT NULL, + disable_feed_token boolean DEFAULT false NOT NULL, + personal_access_token_prefix text, CONSTRAINT app_settings_registry_exp_policies_worker_capacity_positive CHECK ((container_registry_expiration_policies_worker_capacity >= 0)), + CONSTRAINT check_17d9558205 CHECK ((char_length((kroki_url)::text) <= 1024)), CONSTRAINT check_2dba05b802 CHECK ((char_length(gitpod_url) <= 255)), CONSTRAINT check_51700b31b5 CHECK ((char_length(default_branch_name) <= 255)), CONSTRAINT check_57123c9593 CHECK ((char_length(help_page_documentation_base_url) <= 255)), + CONSTRAINT check_718b4458ae CHECK ((char_length(personal_access_token_prefix) <= 20)), CONSTRAINT check_85a39b68ff CHECK ((char_length(encrypted_ci_jwt_signing_key_iv) <= 255)), CONSTRAINT check_9a719834eb CHECK ((char_length(secret_detection_token_revocation_url) <= 255)), CONSTRAINT check_9c6c447a13 CHECK ((char_length(maintenance_mode_message) <= 255)), @@ -9820,9 +9852,63 @@ CREATE TABLE boards ( group_id integer, weight integer, hide_backlog_list boolean DEFAULT false NOT NULL, - hide_closed_list boolean DEFAULT false NOT NULL + hide_closed_list boolean DEFAULT false NOT NULL, + iteration_id bigint ); +CREATE TABLE boards_epic_board_labels ( + id bigint NOT NULL, + epic_board_id bigint NOT NULL, + label_id bigint NOT NULL +); + +CREATE SEQUENCE boards_epic_board_labels_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE boards_epic_board_labels_id_seq OWNED BY boards_epic_board_labels.id; + +CREATE TABLE boards_epic_board_positions ( + id bigint NOT NULL, + epic_board_id bigint NOT NULL, + epic_id bigint NOT NULL, + relative_position integer, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL +); + +CREATE SEQUENCE boards_epic_board_positions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE boards_epic_board_positions_id_seq OWNED BY boards_epic_board_positions.id; + +CREATE TABLE boards_epic_boards ( + id bigint NOT NULL, + hide_backlog_list boolean DEFAULT false NOT NULL, + hide_closed_list boolean DEFAULT false NOT NULL, + group_id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + name text DEFAULT 'Development'::text NOT NULL, + CONSTRAINT check_bcbbffe601 CHECK ((char_length(name) <= 255)) +); + +CREATE SEQUENCE boards_epic_boards_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE boards_epic_boards_id_seq OWNED BY boards_epic_boards.id; + CREATE TABLE boards_epic_user_preferences ( id bigint NOT NULL, board_id bigint NOT NULL, @@ -9923,6 +10009,29 @@ CREATE SEQUENCE bulk_import_entities_id_seq ALTER SEQUENCE bulk_import_entities_id_seq OWNED BY bulk_import_entities.id; +CREATE TABLE bulk_import_failures ( + id bigint NOT NULL, + bulk_import_entity_id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + pipeline_class text NOT NULL, + exception_class text NOT NULL, + exception_message text NOT NULL, + correlation_id_value text, + CONSTRAINT check_053d65c7a4 CHECK ((char_length(pipeline_class) <= 255)), + CONSTRAINT check_6eca8f972e CHECK ((char_length(exception_message) <= 255)), + CONSTRAINT check_c7dba8398e CHECK ((char_length(exception_class) <= 255)), + CONSTRAINT check_e787285882 CHECK ((char_length(correlation_id_value) <= 255)) +); + +CREATE SEQUENCE bulk_import_failures_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE bulk_import_failures_id_seq OWNED BY bulk_import_failures.id; + CREATE TABLE bulk_import_trackers ( id bigint NOT NULL, bulk_import_entity_id bigint NOT NULL, @@ -10024,7 +10133,8 @@ CREATE TABLE ci_build_pending_states ( build_id bigint NOT NULL, state smallint, failure_reason smallint, - trace_checksum bytea + trace_checksum bytea, + trace_bytesize bigint ); CREATE SEQUENCE ci_build_pending_states_id_seq @@ -11290,6 +11400,7 @@ CREATE TABLE compliance_management_frameworks ( description text NOT NULL, color text NOT NULL, namespace_id integer NOT NULL, + regulated boolean DEFAULT true NOT NULL, CONSTRAINT check_08cd34b2c2 CHECK ((char_length(color) <= 10)), CONSTRAINT check_1617e0b87e CHECK ((char_length(description) <= 255)), CONSTRAINT check_ab00bc2193 CHECK ((char_length(name) <= 255)) @@ -11326,7 +11437,8 @@ CREATE TABLE container_repositories ( updated_at timestamp without time zone NOT NULL, status smallint, expiration_policy_started_at timestamp with time zone, - expiration_policy_cleanup_status smallint DEFAULT 0 NOT NULL + expiration_policy_cleanup_status smallint DEFAULT 0 NOT NULL, + expiration_policy_completed_at timestamp with time zone ); CREATE SEQUENCE container_repositories_id_seq @@ -11567,6 +11679,30 @@ CREATE SEQUENCE dependency_proxy_group_settings_id_seq ALTER SEQUENCE dependency_proxy_group_settings_id_seq OWNED BY dependency_proxy_group_settings.id; +CREATE TABLE dependency_proxy_manifests ( + id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + group_id bigint NOT NULL, + size bigint, + file_store smallint, + file_name text NOT NULL, + file text NOT NULL, + digest text NOT NULL, + CONSTRAINT check_079b293a7b CHECK ((char_length(file) <= 255)), + CONSTRAINT check_c579e3f586 CHECK ((char_length(file_name) <= 255)), + CONSTRAINT check_f5d9996bf1 CHECK ((char_length(digest) <= 255)) +); + +CREATE SEQUENCE dependency_proxy_manifests_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE dependency_proxy_manifests_id_seq OWNED BY dependency_proxy_manifests.id; + CREATE TABLE deploy_keys_projects ( id integer NOT NULL, deploy_key_id integer NOT NULL, @@ -11820,13 +11956,13 @@ ALTER SEQUENCE elastic_reindexing_tasks_id_seq OWNED BY elastic_reindexing_tasks CREATE TABLE elasticsearch_indexed_namespaces ( created_at timestamp with time zone NOT NULL, updated_at timestamp with time zone NOT NULL, - namespace_id integer + namespace_id integer NOT NULL ); CREATE TABLE elasticsearch_indexed_projects ( created_at timestamp with time zone NOT NULL, updated_at timestamp with time zone NOT NULL, - project_id integer + project_id integer NOT NULL ); CREATE TABLE emails ( @@ -12008,13 +12144,36 @@ CREATE SEQUENCE evidences_id_seq ALTER SEQUENCE evidences_id_seq OWNED BY evidences.id; +CREATE TABLE experiment_subjects ( + id bigint NOT NULL, + experiment_id bigint NOT NULL, + user_id bigint, + group_id bigint, + project_id bigint, + variant smallint DEFAULT 0 NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + CONSTRAINT chk_has_one_subject CHECK ((num_nonnulls(user_id, group_id, project_id) = 1)) +); + +CREATE SEQUENCE experiment_subjects_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE experiment_subjects_id_seq OWNED BY experiment_subjects.id; + CREATE TABLE experiment_users ( id bigint NOT NULL, experiment_id bigint NOT NULL, user_id bigint NOT NULL, group_type smallint DEFAULT 0 NOT NULL, created_at timestamp with time zone NOT NULL, - updated_at timestamp with time zone NOT NULL + updated_at timestamp with time zone NOT NULL, + converted_at timestamp with time zone, + context jsonb DEFAULT '{}'::jsonb NOT NULL ); CREATE SEQUENCE experiment_users_id_seq @@ -12857,6 +13016,67 @@ CREATE SEQUENCE import_failures_id_seq ALTER SEQUENCE import_failures_id_seq OWNED BY import_failures.id; +CREATE TABLE incident_management_oncall_participants ( + id bigint NOT NULL, + oncall_rotation_id bigint NOT NULL, + user_id bigint NOT NULL, + color_palette smallint NOT NULL, + color_weight smallint NOT NULL +); + +CREATE SEQUENCE incident_management_oncall_participants_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE incident_management_oncall_participants_id_seq OWNED BY incident_management_oncall_participants.id; + +CREATE TABLE incident_management_oncall_rotations ( + id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + oncall_schedule_id bigint NOT NULL, + length integer NOT NULL, + length_unit smallint NOT NULL, + starts_at timestamp with time zone NOT NULL, + name text NOT NULL, + CONSTRAINT check_5209fb5d02 CHECK ((char_length(name) <= 200)) +); + +CREATE SEQUENCE incident_management_oncall_rotations_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE incident_management_oncall_rotations_id_seq OWNED BY incident_management_oncall_rotations.id; + +CREATE TABLE incident_management_oncall_schedules ( + id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + project_id bigint NOT NULL, + iid integer NOT NULL, + name text NOT NULL, + description text, + timezone text, + CONSTRAINT check_7ed1fd5aa7 CHECK ((char_length(description) <= 1000)), + CONSTRAINT check_cc77cbb103 CHECK ((char_length(timezone) <= 100)), + CONSTRAINT check_e6ef43a664 CHECK ((char_length(name) <= 200)) +); + +CREATE SEQUENCE incident_management_oncall_schedules_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE incident_management_oncall_schedules_id_seq OWNED BY incident_management_oncall_schedules.id; + CREATE TABLE index_statuses ( id integer NOT NULL, project_id integer NOT NULL, @@ -12925,6 +13145,27 @@ CREATE SEQUENCE ip_restrictions_id_seq ALTER SEQUENCE ip_restrictions_id_seq OWNED BY ip_restrictions.id; +CREATE TABLE issuable_metric_images ( + id bigint NOT NULL, + issue_id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + file_store smallint, + file text NOT NULL, + url text, + CONSTRAINT check_5b3011e234 CHECK ((char_length(url) <= 255)), + CONSTRAINT check_7ed527062f CHECK ((char_length(file) <= 255)) +); + +CREATE SEQUENCE issuable_metric_images_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE issuable_metric_images_id_seq OWNED BY issuable_metric_images.id; + CREATE TABLE issuable_severities ( id bigint NOT NULL, issue_id bigint NOT NULL, @@ -13417,7 +13658,8 @@ CREATE TABLE lists ( milestone_id integer, max_issue_count integer DEFAULT 0 NOT NULL, max_issue_weight integer DEFAULT 0 NOT NULL, - limit_metric character varying(20) + limit_metric character varying(20), + iteration_id bigint ); CREATE SEQUENCE lists_id_seq @@ -13521,7 +13763,7 @@ CREATE TABLE merge_request_context_commit_diff_files ( old_path text NOT NULL, diff text, "binary" boolean, - merge_request_context_commit_id bigint + merge_request_context_commit_id bigint NOT NULL ); CREATE TABLE merge_request_context_commits ( @@ -13611,6 +13853,7 @@ CREATE TABLE merge_request_diffs ( external_diff_store integer DEFAULT 1, stored_externally boolean, files_count smallint, + sorted boolean DEFAULT false NOT NULL, CONSTRAINT check_93ee616ac9 CHECK ((external_diff_store IS NOT NULL)) ); @@ -13868,6 +14111,22 @@ CREATE TABLE namespace_limits ( temporary_storage_increase_ends_on date ); +CREATE TABLE namespace_onboarding_actions ( + id bigint NOT NULL, + namespace_id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + action smallint NOT NULL +); + +CREATE SEQUENCE namespace_onboarding_actions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE namespace_onboarding_actions_id_seq OWNED BY namespace_onboarding_actions.id; + CREATE TABLE namespace_root_storage_statistics ( namespace_id integer NOT NULL, updated_at timestamp with time zone NOT NULL, @@ -14485,6 +14744,8 @@ CREATE TABLE packages_package_files ( verification_failure character varying(255), verification_retry_count integer, verification_checksum bytea, + verification_state smallint DEFAULT 0 NOT NULL, + verification_started_at timestamp with time zone, CONSTRAINT check_4c5e6bb0b3 CHECK ((file_store IS NOT NULL)) ); @@ -14732,7 +14993,9 @@ CREATE TABLE plan_limits ( golang_max_file_size bigint DEFAULT 104857600 NOT NULL, debian_max_file_size bigint DEFAULT '3221225472'::bigint NOT NULL, project_feature_flags integer DEFAULT 200 NOT NULL, - ci_max_artifact_size_api_fuzzing integer DEFAULT 0 NOT NULL + ci_max_artifact_size_api_fuzzing integer DEFAULT 0 NOT NULL, + ci_pipeline_deployments integer DEFAULT 500 NOT NULL, + pull_mirror_interval_seconds integer DEFAULT 300 NOT NULL ); CREATE SEQUENCE plan_limits_id_seq @@ -14778,11 +15041,124 @@ CREATE SEQUENCE pool_repositories_id_seq ALTER SEQUENCE pool_repositories_id_seq OWNED BY pool_repositories.id; +CREATE VIEW postgres_index_bloat_estimates AS + SELECT (((relation_stats.nspname)::text || '.'::text) || (relation_stats.idxname)::text) AS identifier, + ( + CASE + WHEN ((relation_stats.relpages)::double precision > relation_stats.est_pages_ff) THEN ((relation_stats.bs)::double precision * ((relation_stats.relpages)::double precision - relation_stats.est_pages_ff)) + ELSE (0)::double precision + END)::bigint AS bloat_size_bytes + FROM ( SELECT COALESCE(((1)::double precision + ceil((rows_hdr_pdg_stats.reltuples / floor((((((rows_hdr_pdg_stats.bs - (rows_hdr_pdg_stats.pageopqdata)::numeric) - (rows_hdr_pdg_stats.pagehdr)::numeric) * (rows_hdr_pdg_stats.fillfactor)::numeric))::double precision / ((100)::double precision * (((4)::numeric + rows_hdr_pdg_stats.nulldatahdrwidth))::double precision)))))), (0)::double precision) AS est_pages_ff, + rows_hdr_pdg_stats.bs, + rows_hdr_pdg_stats.nspname, + rows_hdr_pdg_stats.tblname, + rows_hdr_pdg_stats.idxname, + rows_hdr_pdg_stats.relpages, + rows_hdr_pdg_stats.is_na + FROM ( SELECT rows_data_stats.maxalign, + rows_data_stats.bs, + rows_data_stats.nspname, + rows_data_stats.tblname, + rows_data_stats.idxname, + rows_data_stats.reltuples, + rows_data_stats.relpages, + rows_data_stats.idxoid, + rows_data_stats.fillfactor, + (((((((rows_data_stats.index_tuple_hdr_bm + rows_data_stats.maxalign) - + CASE + WHEN ((rows_data_stats.index_tuple_hdr_bm % rows_data_stats.maxalign) = 0) THEN rows_data_stats.maxalign + ELSE (rows_data_stats.index_tuple_hdr_bm % rows_data_stats.maxalign) + END))::double precision + rows_data_stats.nulldatawidth) + (rows_data_stats.maxalign)::double precision) - ( + CASE + WHEN (rows_data_stats.nulldatawidth = (0)::double precision) THEN 0 + WHEN (((rows_data_stats.nulldatawidth)::integer % rows_data_stats.maxalign) = 0) THEN rows_data_stats.maxalign + ELSE ((rows_data_stats.nulldatawidth)::integer % rows_data_stats.maxalign) + END)::double precision))::numeric AS nulldatahdrwidth, + rows_data_stats.pagehdr, + rows_data_stats.pageopqdata, + rows_data_stats.is_na + FROM ( SELECT n.nspname, + i.tblname, + i.idxname, + i.reltuples, + i.relpages, + i.idxoid, + i.fillfactor, + (current_setting('block_size'::text))::numeric AS bs, + CASE + WHEN ((version() ~ 'mingw32'::text) OR (version() ~ '64-bit|x86_64|ppc64|ia64|amd64'::text)) THEN 8 + ELSE 4 + END AS maxalign, + 24 AS pagehdr, + 16 AS pageopqdata, + CASE + WHEN (max(COALESCE(s.null_frac, (0)::real)) = (0)::double precision) THEN 2 + ELSE (2 + (((32 + 8) - 1) / 8)) + END AS index_tuple_hdr_bm, + sum((((1)::double precision - COALESCE(s.null_frac, (0)::real)) * (COALESCE(s.avg_width, 1024))::double precision)) AS nulldatawidth, + (max( + CASE + WHEN (i.atttypid = ('name'::regtype)::oid) THEN 1 + ELSE 0 + END) > 0) AS is_na + FROM ((( SELECT ct.relname AS tblname, + ct.relnamespace, + ic.idxname, + ic.attpos, + ic.indkey, + ic.indkey[ic.attpos] AS indkey, + ic.reltuples, + ic.relpages, + ic.tbloid, + ic.idxoid, + ic.fillfactor, + COALESCE(a1.attnum, a2.attnum) AS attnum, + COALESCE(a1.attname, a2.attname) AS attname, + COALESCE(a1.atttypid, a2.atttypid) AS atttypid, +CASE + WHEN (a1.attnum IS NULL) THEN ic.idxname + ELSE ct.relname +END AS attrelname + FROM (((( SELECT idx_data.idxname, + idx_data.reltuples, + idx_data.relpages, + idx_data.tbloid, + idx_data.idxoid, + idx_data.fillfactor, + idx_data.indkey, + generate_series(1, (idx_data.indnatts)::integer) AS attpos + FROM ( SELECT ci.relname AS idxname, + ci.reltuples, + ci.relpages, + i_1.indrelid AS tbloid, + i_1.indexrelid AS idxoid, + COALESCE((("substring"(array_to_string(ci.reloptions, ' '::text), 'fillfactor=([0-9]+)'::text))::smallint)::integer, 90) AS fillfactor, + i_1.indnatts, + (string_to_array(textin(int2vectorout(i_1.indkey)), ' '::text))::integer[] AS indkey + FROM (pg_index i_1 + JOIN pg_class ci ON ((ci.oid = i_1.indexrelid))) + WHERE ((ci.relam = ( SELECT pg_am.oid + FROM pg_am + WHERE (pg_am.amname = 'btree'::name))) AND (ci.relpages > 0))) idx_data) ic + JOIN pg_class ct ON ((ct.oid = ic.tbloid))) + LEFT JOIN pg_attribute a1 ON (((ic.indkey[ic.attpos] <> 0) AND (a1.attrelid = ic.tbloid) AND (a1.attnum = ic.indkey[ic.attpos])))) + LEFT JOIN pg_attribute a2 ON (((ic.indkey[ic.attpos] = 0) AND (a2.attrelid = ic.idxoid) AND (a2.attnum = ic.attpos))))) i(tblname, relnamespace, idxname, attpos, indkey, indkey_1, reltuples, relpages, tbloid, idxoid, fillfactor, attnum, attname, atttypid, attrelname) + JOIN pg_namespace n ON ((n.oid = i.relnamespace))) + JOIN pg_stats s ON (((s.schemaname = n.nspname) AND (s.tablename = i.attrelname) AND (s.attname = i.attname)))) + GROUP BY n.nspname, i.tblname, i.idxname, i.reltuples, i.relpages, i.idxoid, i.fillfactor, (current_setting('block_size'::text))::numeric, + CASE + WHEN ((version() ~ 'mingw32'::text) OR (version() ~ '64-bit|x86_64|ppc64|ia64|amd64'::text)) THEN 8 + ELSE 4 + END, 24::integer, 16::integer) rows_data_stats) rows_hdr_pdg_stats) relation_stats + WHERE ((relation_stats.nspname = ANY (ARRAY["current_schema"(), 'gitlab_partitions_dynamic'::name, 'gitlab_partitions_static'::name])) AND (NOT relation_stats.is_na)) + ORDER BY relation_stats.nspname, relation_stats.tblname, relation_stats.idxname; + CREATE VIEW postgres_indexes AS SELECT (((pg_namespace.nspname)::text || '.'::text) || (pg_class.relname)::text) AS identifier, pg_index.indexrelid, pg_namespace.nspname AS schema, pg_class.relname AS name, + pg_indexes.tablename, pg_index.indisunique AS "unique", pg_index.indisvalid AS valid_index, pg_class.relispartition AS partitioned, @@ -14847,6 +15223,7 @@ CREATE TABLE postgres_reindex_actions ( ondisk_size_bytes_end bigint, state smallint DEFAULT 0 NOT NULL, index_identifier text NOT NULL, + bloat_estimate_bytes_start bigint, CONSTRAINT check_f12527622c CHECK ((char_length(index_identifier) <= 255)) ); @@ -15061,7 +15438,9 @@ CREATE TABLE project_features ( pages_access_level integer NOT NULL, forking_access_level integer, metrics_dashboard_access_level integer, - requirements_access_level integer DEFAULT 20 NOT NULL + requirements_access_level integer DEFAULT 20 NOT NULL, + operations_access_level integer DEFAULT 20 NOT NULL, + analytics_access_level integer DEFAULT 20 NOT NULL ); CREATE SEQUENCE project_features_id_seq @@ -15261,6 +15640,7 @@ CREATE TABLE project_settings ( squash_option smallint DEFAULT 3, has_confluence boolean DEFAULT false NOT NULL, has_vulnerabilities boolean DEFAULT false NOT NULL, + allow_editing_commit_messages boolean DEFAULT false NOT NULL, CONSTRAINT check_bde223416c CHECK ((show_default_award_emojis IS NOT NULL)) ); @@ -16062,6 +16442,7 @@ CREATE TABLE security_findings ( project_fingerprint text NOT NULL, deduplicated boolean DEFAULT false NOT NULL, "position" integer, + uuid uuid, CONSTRAINT check_b9508c6df8 CHECK ((char_length(project_fingerprint) <= 40)) ); @@ -16625,7 +17006,7 @@ CREATE TABLE terraform_states ( locked_by_user_id bigint, uuid character varying(32) NOT NULL, name character varying(255), - versioning_enabled boolean DEFAULT false NOT NULL + versioning_enabled boolean DEFAULT true NOT NULL ); CREATE SEQUENCE terraform_states_id_seq @@ -16821,7 +17202,10 @@ CREATE TABLE user_details ( bio_html text, cached_markdown_version integer, webauthn_xid text, - CONSTRAINT check_245664af82 CHECK ((char_length(webauthn_xid) <= 100)) + other_role text, + provisioned_by_group_id bigint, + CONSTRAINT check_245664af82 CHECK ((char_length(webauthn_xid) <= 100)), + CONSTRAINT check_b132136b01 CHECK ((char_length(other_role) <= 100)) ); CREATE SEQUENCE user_details_user_id_seq @@ -16844,6 +17228,26 @@ CREATE TABLE user_interacted_projects ( project_id integer NOT NULL ); +CREATE TABLE user_permission_export_uploads ( + id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + user_id bigint NOT NULL, + file_store integer, + status smallint DEFAULT 0 NOT NULL, + file text, + CONSTRAINT check_1956806648 CHECK ((char_length(file) <= 255)) +); + +CREATE SEQUENCE user_permission_export_uploads_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE user_permission_export_uploads_id_seq OWNED BY user_permission_export_uploads.id; + CREATE TABLE user_preferences ( id integer NOT NULL, user_id integer NOT NULL, @@ -16867,7 +17271,6 @@ CREATE TABLE user_preferences ( setup_for_company boolean, render_whitespace_in_code boolean, tab_width smallint, - feature_filter_type bigint, experience_level smallint, view_diffs_file_by_file boolean DEFAULT false NOT NULL, gitpod_enabled boolean DEFAULT false NOT NULL @@ -17142,6 +17545,29 @@ CREATE SEQUENCE vulnerability_exports_id_seq ALTER SEQUENCE vulnerability_exports_id_seq OWNED BY vulnerability_exports.id; +CREATE TABLE vulnerability_external_issue_links ( + id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + author_id bigint NOT NULL, + vulnerability_id bigint NOT NULL, + link_type smallint DEFAULT 1 NOT NULL, + external_type smallint DEFAULT 1 NOT NULL, + external_project_key text NOT NULL, + external_issue_key text NOT NULL, + CONSTRAINT check_3200604f5e CHECK ((char_length(external_issue_key) <= 255)), + CONSTRAINT check_68cffd19b0 CHECK ((char_length(external_project_key) <= 255)) +); + +CREATE SEQUENCE vulnerability_external_issue_links_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE vulnerability_external_issue_links_id_seq OWNED BY vulnerability_external_issue_links.id; + CREATE TABLE vulnerability_feedback ( id integer NOT NULL, created_at timestamp with time zone NOT NULL, @@ -17156,7 +17582,8 @@ CREATE TABLE vulnerability_feedback ( merge_request_id integer, comment_author_id integer, comment text, - comment_timestamp timestamp with time zone + comment_timestamp timestamp with time zone, + finding_uuid uuid ); CREATE SEQUENCE vulnerability_feedback_id_seq @@ -17188,6 +17615,23 @@ CREATE SEQUENCE vulnerability_finding_links_id_seq ALTER SEQUENCE vulnerability_finding_links_id_seq OWNED BY vulnerability_finding_links.id; +CREATE TABLE vulnerability_findings_remediations ( + id bigint NOT NULL, + vulnerability_occurrence_id bigint, + vulnerability_remediation_id bigint, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL +); + +CREATE SEQUENCE vulnerability_findings_remediations_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE vulnerability_findings_remediations_id_seq OWNED BY vulnerability_findings_remediations.id; + CREATE TABLE vulnerability_historical_statistics ( id bigint NOT NULL, created_at timestamp with time zone NOT NULL, @@ -17302,7 +17746,8 @@ CREATE TABLE vulnerability_occurrences ( name character varying NOT NULL, metadata_version character varying NOT NULL, raw_metadata text NOT NULL, - vulnerability_id bigint + vulnerability_id bigint, + details jsonb DEFAULT '{}'::jsonb NOT NULL ); CREATE SEQUENCE vulnerability_occurrences_id_seq @@ -17314,6 +17759,30 @@ CREATE SEQUENCE vulnerability_occurrences_id_seq ALTER SEQUENCE vulnerability_occurrences_id_seq OWNED BY vulnerability_occurrences.id; +CREATE TABLE vulnerability_remediations ( + id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + file_store smallint, + summary text NOT NULL, + file text NOT NULL, + checksum bytea NOT NULL, + project_id bigint NOT NULL, + CONSTRAINT check_ac0ccabff3 CHECK ((char_length(summary) <= 200)), + CONSTRAINT check_fe3325e3ba CHECK ((char_length(file) <= 255)) +); + +COMMENT ON COLUMN vulnerability_remediations.checksum IS 'Stores the SHA256 checksum of the attached diff file'; + +CREATE SEQUENCE vulnerability_remediations_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE vulnerability_remediations_id_seq OWNED BY vulnerability_remediations.id; + CREATE TABLE vulnerability_scanners ( id bigint NOT NULL, created_at timestamp with time zone NOT NULL, @@ -17427,7 +17896,8 @@ CREATE TABLE web_hooks ( encrypted_url_iv character varying, deployment_events boolean DEFAULT false NOT NULL, releases_events boolean DEFAULT false NOT NULL, - feature_flag_events boolean DEFAULT false NOT NULL + feature_flag_events boolean DEFAULT false NOT NULL, + member_events boolean DEFAULT false NOT NULL ); CREATE SEQUENCE web_hooks_id_seq @@ -17449,8 +17919,8 @@ CREATE TABLE webauthn_registrations ( name text NOT NULL, public_key text NOT NULL, u2f_registration_id integer, - CONSTRAINT check_242f0cc65c CHECK ((char_length(credential_xid) <= 255)), - CONSTRAINT check_2f02e74321 CHECK ((char_length(name) <= 255)) + CONSTRAINT check_2f02e74321 CHECK ((char_length(name) <= 255)), + CONSTRAINT check_e54008d9ce CHECK ((char_length(credential_xid) <= 340)) ); CREATE SEQUENCE webauthn_registrations_id_seq @@ -17598,6 +18068,8 @@ ALTER TABLE ONLY analytics_devops_adoption_segment_selections ALTER COLUMN id SE ALTER TABLE ONLY analytics_devops_adoption_segments ALTER COLUMN id SET DEFAULT nextval('analytics_devops_adoption_segments_id_seq'::regclass); +ALTER TABLE ONLY analytics_devops_adoption_snapshots ALTER COLUMN id SET DEFAULT nextval('analytics_devops_adoption_snapshots_id_seq'::regclass); + ALTER TABLE ONLY analytics_instance_statistics_measurements ALTER COLUMN id SET DEFAULT nextval('analytics_instance_statistics_measurements_id_seq'::regclass); ALTER TABLE ONLY appearances ALTER COLUMN id SET DEFAULT nextval('appearances_id_seq'::regclass); @@ -17652,6 +18124,12 @@ ALTER TABLE ONLY board_user_preferences ALTER COLUMN id SET DEFAULT nextval('boa ALTER TABLE ONLY boards ALTER COLUMN id SET DEFAULT nextval('boards_id_seq'::regclass); +ALTER TABLE ONLY boards_epic_board_labels ALTER COLUMN id SET DEFAULT nextval('boards_epic_board_labels_id_seq'::regclass); + +ALTER TABLE ONLY boards_epic_board_positions ALTER COLUMN id SET DEFAULT nextval('boards_epic_board_positions_id_seq'::regclass); + +ALTER TABLE ONLY boards_epic_boards ALTER COLUMN id SET DEFAULT nextval('boards_epic_boards_id_seq'::regclass); + ALTER TABLE ONLY boards_epic_user_preferences ALTER COLUMN id SET DEFAULT nextval('boards_epic_user_preferences_id_seq'::regclass); ALTER TABLE ONLY broadcast_messages ALTER COLUMN id SET DEFAULT nextval('broadcast_messages_id_seq'::regclass); @@ -17660,6 +18138,8 @@ ALTER TABLE ONLY bulk_import_configurations ALTER COLUMN id SET DEFAULT nextval( ALTER TABLE ONLY bulk_import_entities ALTER COLUMN id SET DEFAULT nextval('bulk_import_entities_id_seq'::regclass); +ALTER TABLE ONLY bulk_import_failures ALTER COLUMN id SET DEFAULT nextval('bulk_import_failures_id_seq'::regclass); + ALTER TABLE ONLY bulk_import_trackers ALTER COLUMN id SET DEFAULT nextval('bulk_import_trackers_id_seq'::regclass); ALTER TABLE ONLY bulk_imports ALTER COLUMN id SET DEFAULT nextval('bulk_imports_id_seq'::regclass); @@ -17812,6 +18292,8 @@ ALTER TABLE ONLY dependency_proxy_blobs ALTER COLUMN id SET DEFAULT nextval('dep ALTER TABLE ONLY dependency_proxy_group_settings ALTER COLUMN id SET DEFAULT nextval('dependency_proxy_group_settings_id_seq'::regclass); +ALTER TABLE ONLY dependency_proxy_manifests ALTER COLUMN id SET DEFAULT nextval('dependency_proxy_manifests_id_seq'::regclass); + ALTER TABLE ONLY deploy_keys_projects ALTER COLUMN id SET DEFAULT nextval('deploy_keys_projects_id_seq'::regclass); ALTER TABLE ONLY deploy_tokens ALTER COLUMN id SET DEFAULT nextval('deploy_tokens_id_seq'::regclass); @@ -17850,6 +18332,8 @@ ALTER TABLE ONLY events ALTER COLUMN id SET DEFAULT nextval('events_id_seq'::reg ALTER TABLE ONLY evidences ALTER COLUMN id SET DEFAULT nextval('evidences_id_seq'::regclass); +ALTER TABLE ONLY experiment_subjects ALTER COLUMN id SET DEFAULT nextval('experiment_subjects_id_seq'::regclass); + ALTER TABLE ONLY experiment_users ALTER COLUMN id SET DEFAULT nextval('experiment_users_id_seq'::regclass); ALTER TABLE ONLY experiments ALTER COLUMN id SET DEFAULT nextval('experiments_id_seq'::regclass); @@ -17932,6 +18416,12 @@ ALTER TABLE ONLY import_export_uploads ALTER COLUMN id SET DEFAULT nextval('impo ALTER TABLE ONLY import_failures ALTER COLUMN id SET DEFAULT nextval('import_failures_id_seq'::regclass); +ALTER TABLE ONLY incident_management_oncall_participants ALTER COLUMN id SET DEFAULT nextval('incident_management_oncall_participants_id_seq'::regclass); + +ALTER TABLE ONLY incident_management_oncall_rotations ALTER COLUMN id SET DEFAULT nextval('incident_management_oncall_rotations_id_seq'::regclass); + +ALTER TABLE ONLY incident_management_oncall_schedules ALTER COLUMN id SET DEFAULT nextval('incident_management_oncall_schedules_id_seq'::regclass); + ALTER TABLE ONLY index_statuses ALTER COLUMN id SET DEFAULT nextval('index_statuses_id_seq'::regclass); ALTER TABLE ONLY insights ALTER COLUMN id SET DEFAULT nextval('insights_id_seq'::regclass); @@ -17940,6 +18430,8 @@ ALTER TABLE ONLY internal_ids ALTER COLUMN id SET DEFAULT nextval('internal_ids_ ALTER TABLE ONLY ip_restrictions ALTER COLUMN id SET DEFAULT nextval('ip_restrictions_id_seq'::regclass); +ALTER TABLE ONLY issuable_metric_images ALTER COLUMN id SET DEFAULT nextval('issuable_metric_images_id_seq'::regclass); + ALTER TABLE ONLY issuable_severities ALTER COLUMN id SET DEFAULT nextval('issuable_severities_id_seq'::regclass); ALTER TABLE ONLY issuable_slas ALTER COLUMN id SET DEFAULT nextval('issuable_slas_id_seq'::regclass); @@ -18018,6 +18510,8 @@ ALTER TABLE ONLY metrics_users_starred_dashboards ALTER COLUMN id SET DEFAULT ne ALTER TABLE ONLY milestones ALTER COLUMN id SET DEFAULT nextval('milestones_id_seq'::regclass); +ALTER TABLE ONLY namespace_onboarding_actions ALTER COLUMN id SET DEFAULT nextval('namespace_onboarding_actions_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); @@ -18274,6 +18768,8 @@ ALTER TABLE ONLY user_custom_attributes ALTER COLUMN id SET DEFAULT nextval('use ALTER TABLE ONLY user_details ALTER COLUMN user_id SET DEFAULT nextval('user_details_user_id_seq'::regclass); +ALTER TABLE ONLY user_permission_export_uploads ALTER COLUMN id SET DEFAULT nextval('user_permission_export_uploads_id_seq'::regclass); + ALTER TABLE ONLY user_preferences ALTER COLUMN id SET DEFAULT nextval('user_preferences_id_seq'::regclass); ALTER TABLE ONLY user_statuses ALTER COLUMN user_id SET DEFAULT nextval('user_statuses_user_id_seq'::regclass); @@ -18292,10 +18788,14 @@ ALTER TABLE ONLY vulnerabilities ALTER COLUMN id SET DEFAULT nextval('vulnerabil ALTER TABLE ONLY vulnerability_exports ALTER COLUMN id SET DEFAULT nextval('vulnerability_exports_id_seq'::regclass); +ALTER TABLE ONLY vulnerability_external_issue_links ALTER COLUMN id SET DEFAULT nextval('vulnerability_external_issue_links_id_seq'::regclass); + ALTER TABLE ONLY vulnerability_feedback ALTER COLUMN id SET DEFAULT nextval('vulnerability_feedback_id_seq'::regclass); ALTER TABLE ONLY vulnerability_finding_links ALTER COLUMN id SET DEFAULT nextval('vulnerability_finding_links_id_seq'::regclass); +ALTER TABLE ONLY vulnerability_findings_remediations ALTER COLUMN id SET DEFAULT nextval('vulnerability_findings_remediations_id_seq'::regclass); + ALTER TABLE ONLY vulnerability_historical_statistics ALTER COLUMN id SET DEFAULT nextval('vulnerability_historical_statistics_id_seq'::regclass); ALTER TABLE ONLY vulnerability_identifiers ALTER COLUMN id SET DEFAULT nextval('vulnerability_identifiers_id_seq'::regclass); @@ -18308,6 +18808,8 @@ ALTER TABLE ONLY vulnerability_occurrence_pipelines ALTER COLUMN id SET DEFAULT ALTER TABLE ONLY vulnerability_occurrences ALTER COLUMN id SET DEFAULT nextval('vulnerability_occurrences_id_seq'::regclass); +ALTER TABLE ONLY vulnerability_remediations ALTER COLUMN id SET DEFAULT nextval('vulnerability_remediations_id_seq'::regclass); + ALTER TABLE ONLY vulnerability_scanners ALTER COLUMN id SET DEFAULT nextval('vulnerability_scanners_id_seq'::regclass); ALTER TABLE ONLY vulnerability_statistics ALTER COLUMN id SET DEFAULT nextval('vulnerability_statistics_id_seq'::regclass); @@ -18563,6 +19065,9 @@ ALTER TABLE ONLY analytics_devops_adoption_segment_selections ALTER TABLE ONLY analytics_devops_adoption_segments ADD CONSTRAINT analytics_devops_adoption_segments_pkey PRIMARY KEY (id); +ALTER TABLE ONLY analytics_devops_adoption_snapshots + ADD CONSTRAINT analytics_devops_adoption_snapshots_pkey PRIMARY KEY (id); + ALTER TABLE ONLY analytics_instance_statistics_measurements ADD CONSTRAINT analytics_instance_statistics_measurements_pkey PRIMARY KEY (id); @@ -18659,6 +19164,15 @@ ALTER TABLE ONLY board_project_recent_visits ALTER TABLE ONLY board_user_preferences ADD CONSTRAINT board_user_preferences_pkey PRIMARY KEY (id); +ALTER TABLE ONLY boards_epic_board_labels + ADD CONSTRAINT boards_epic_board_labels_pkey PRIMARY KEY (id); + +ALTER TABLE ONLY boards_epic_board_positions + ADD CONSTRAINT boards_epic_board_positions_pkey PRIMARY KEY (id); + +ALTER TABLE ONLY boards_epic_boards + ADD CONSTRAINT boards_epic_boards_pkey PRIMARY KEY (id); + ALTER TABLE ONLY boards_epic_user_preferences ADD CONSTRAINT boards_epic_user_preferences_pkey PRIMARY KEY (id); @@ -18674,6 +19188,9 @@ ALTER TABLE ONLY bulk_import_configurations ALTER TABLE ONLY bulk_import_entities ADD CONSTRAINT bulk_import_entities_pkey PRIMARY KEY (id); +ALTER TABLE ONLY bulk_import_failures + ADD CONSTRAINT bulk_import_failures_pkey PRIMARY KEY (id); + ALTER TABLE ONLY bulk_import_trackers ADD CONSTRAINT bulk_import_trackers_pkey PRIMARY KEY (id); @@ -18914,6 +19431,9 @@ ALTER TABLE ONLY dependency_proxy_blobs ALTER TABLE ONLY dependency_proxy_group_settings ADD CONSTRAINT dependency_proxy_group_settings_pkey PRIMARY KEY (id); +ALTER TABLE ONLY dependency_proxy_manifests + ADD CONSTRAINT dependency_proxy_manifests_pkey PRIMARY KEY (id); + ALTER TABLE ONLY deploy_keys_projects ADD CONSTRAINT deploy_keys_projects_pkey PRIMARY KEY (id); @@ -18953,6 +19473,12 @@ ALTER TABLE ONLY draft_notes ALTER TABLE ONLY elastic_reindexing_tasks ADD CONSTRAINT elastic_reindexing_tasks_pkey PRIMARY KEY (id); +ALTER TABLE ONLY elasticsearch_indexed_namespaces + ADD CONSTRAINT elasticsearch_indexed_namespaces_pkey PRIMARY KEY (namespace_id); + +ALTER TABLE ONLY elasticsearch_indexed_projects + ADD CONSTRAINT elasticsearch_indexed_projects_pkey PRIMARY KEY (project_id); + ALTER TABLE ONLY emails ADD CONSTRAINT emails_pkey PRIMARY KEY (id); @@ -18977,6 +19503,9 @@ ALTER TABLE ONLY events ALTER TABLE ONLY evidences ADD CONSTRAINT evidences_pkey PRIMARY KEY (id); +ALTER TABLE ONLY experiment_subjects + ADD CONSTRAINT experiment_subjects_pkey PRIMARY KEY (id); + ALTER TABLE ONLY experiment_users ADD CONSTRAINT experiment_users_pkey PRIMARY KEY (id); @@ -19106,6 +19635,15 @@ ALTER TABLE ONLY import_export_uploads ALTER TABLE ONLY import_failures ADD CONSTRAINT import_failures_pkey PRIMARY KEY (id); +ALTER TABLE ONLY incident_management_oncall_participants + ADD CONSTRAINT incident_management_oncall_participants_pkey PRIMARY KEY (id); + +ALTER TABLE ONLY incident_management_oncall_rotations + ADD CONSTRAINT incident_management_oncall_rotations_pkey PRIMARY KEY (id); + +ALTER TABLE ONLY incident_management_oncall_schedules + ADD CONSTRAINT incident_management_oncall_schedules_pkey PRIMARY KEY (id); + ALTER TABLE ONLY index_statuses ADD CONSTRAINT index_statuses_pkey PRIMARY KEY (id); @@ -19118,6 +19656,9 @@ ALTER TABLE ONLY internal_ids ALTER TABLE ONLY ip_restrictions ADD CONSTRAINT ip_restrictions_pkey PRIMARY KEY (id); +ALTER TABLE ONLY issuable_metric_images + ADD CONSTRAINT issuable_metric_images_pkey PRIMARY KEY (id); + ALTER TABLE ONLY issuable_severities ADD CONSTRAINT issuable_severities_pkey PRIMARY KEY (id); @@ -19214,6 +19755,9 @@ ALTER TABLE ONLY merge_request_blocks ALTER TABLE ONLY merge_request_cleanup_schedules ADD CONSTRAINT merge_request_cleanup_schedules_pkey PRIMARY KEY (merge_request_id); +ALTER TABLE ONLY merge_request_context_commit_diff_files + ADD CONSTRAINT merge_request_context_commit_diff_files_pkey PRIMARY KEY (merge_request_context_commit_id, relative_order); + ALTER TABLE ONLY merge_request_context_commits ADD CONSTRAINT merge_request_context_commits_pkey PRIMARY KEY (id); @@ -19265,6 +19809,9 @@ ALTER TABLE ONLY namespace_aggregation_schedules ALTER TABLE ONLY namespace_limits ADD CONSTRAINT namespace_limits_pkey PRIMARY KEY (namespace_id); +ALTER TABLE ONLY namespace_onboarding_actions + ADD CONSTRAINT namespace_onboarding_actions_pkey PRIMARY KEY (id); + ALTER TABLE ONLY namespace_root_storage_statistics ADD CONSTRAINT namespace_root_storage_statistics_pkey PRIMARY KEY (namespace_id); @@ -19715,6 +20262,9 @@ ALTER TABLE ONLY user_highest_roles ALTER TABLE ONLY user_interacted_projects ADD CONSTRAINT user_interacted_projects_pkey PRIMARY KEY (project_id, user_id); +ALTER TABLE ONLY user_permission_export_uploads + ADD CONSTRAINT user_permission_export_uploads_pkey PRIMARY KEY (id); + ALTER TABLE ONLY user_preferences ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (id); @@ -19745,12 +20295,18 @@ ALTER TABLE ONLY vulnerabilities ALTER TABLE ONLY vulnerability_exports ADD CONSTRAINT vulnerability_exports_pkey PRIMARY KEY (id); +ALTER TABLE ONLY vulnerability_external_issue_links + ADD CONSTRAINT vulnerability_external_issue_links_pkey PRIMARY KEY (id); + ALTER TABLE ONLY vulnerability_feedback ADD CONSTRAINT vulnerability_feedback_pkey PRIMARY KEY (id); ALTER TABLE ONLY vulnerability_finding_links ADD CONSTRAINT vulnerability_finding_links_pkey PRIMARY KEY (id); +ALTER TABLE ONLY vulnerability_findings_remediations + ADD CONSTRAINT vulnerability_findings_remediations_pkey PRIMARY KEY (id); + ALTER TABLE ONLY vulnerability_historical_statistics ADD CONSTRAINT vulnerability_historical_statistics_pkey PRIMARY KEY (id); @@ -19769,6 +20325,9 @@ ALTER TABLE ONLY vulnerability_occurrence_pipelines ALTER TABLE ONLY vulnerability_occurrences ADD CONSTRAINT vulnerability_occurrences_pkey PRIMARY KEY (id); +ALTER TABLE ONLY vulnerability_remediations + ADD CONSTRAINT vulnerability_remediations_pkey PRIMARY KEY (id); + ALTER TABLE ONLY vulnerability_scanners ADD CONSTRAINT vulnerability_scanners_pkey PRIMARY KEY (id); @@ -19939,6 +20498,8 @@ CREATE INDEX active_billable_users ON users USING btree (id) WHERE (((state)::te CREATE INDEX analytics_index_audit_events_on_created_at_and_author_id ON audit_events USING btree (created_at, author_id); +CREATE INDEX analytics_index_audit_events_part_on_created_at_and_author_id ON ONLY audit_events_part_5fc467ac26 USING btree (created_at, author_id); + CREATE INDEX analytics_index_events_on_created_at_and_author_id ON events USING btree (created_at, author_id); CREATE INDEX analytics_repository_languages_on_project_id ON analytics_language_trend_repository_languages USING btree (project_id); @@ -19983,6 +20544,8 @@ CREATE INDEX finding_links_on_vulnerability_occurrence_id ON vulnerability_findi CREATE INDEX idx_audit_events_on_entity_id_desc_author_id_created_at ON audit_events USING btree (entity_id, entity_type, id DESC, author_id, created_at); +CREATE INDEX idx_audit_events_part_on_entity_id_desc_author_id_created_at ON ONLY audit_events_part_5fc467ac26 USING btree (entity_id, entity_type, id DESC, author_id, created_at); + CREATE INDEX idx_ci_pipelines_artifacts_locked ON ci_pipelines USING btree (ci_ref_id, id) WHERE (locked = 1); CREATE INDEX idx_container_exp_policies_on_project_id_next_run_at_enabled ON container_expiration_policies USING btree (project_id, next_run_at, enabled); @@ -20067,6 +20630,10 @@ CREATE INDEX idx_security_scans_on_scan_type ON security_scans USING btree (scan CREATE UNIQUE INDEX idx_serverless_domain_cluster_on_clusters_applications_knative ON serverless_domain_cluster USING btree (clusters_applications_knative_id); +CREATE UNIQUE INDEX idx_vulnerability_ext_issue_links_on_vulne_id_and_ext_issue ON vulnerability_external_issue_links USING btree (vulnerability_id, external_type, external_project_key, external_issue_key); + +CREATE UNIQUE INDEX idx_vulnerability_ext_issue_links_on_vulne_id_and_link_type ON vulnerability_external_issue_links USING btree (vulnerability_id, link_type) WHERE (link_type = 1); + CREATE UNIQUE INDEX idx_vulnerability_issue_links_on_vulnerability_id_and_issue_id ON vulnerability_issue_links USING btree (vulnerability_id, issue_id); CREATE UNIQUE INDEX idx_vulnerability_issue_links_on_vulnerability_id_and_link_type ON vulnerability_issue_links USING btree (vulnerability_id, link_type) WHERE (link_type = 2); @@ -20077,6 +20644,8 @@ CREATE INDEX index_alert_assignees_on_alert_id ON alert_management_alert_assigne CREATE UNIQUE INDEX index_alert_assignees_on_user_id_and_alert_id ON alert_management_alert_assignees USING btree (user_id, alert_id); +CREATE INDEX index_alert_management_alerts_on_domain ON alert_management_alerts USING btree (domain); + CREATE INDEX index_alert_management_alerts_on_environment_id ON alert_management_alerts USING btree (environment_id) WHERE (environment_id IS NOT NULL); CREATE INDEX index_alert_management_alerts_on_issue_id ON alert_management_alerts USING btree (issue_id); @@ -20177,6 +20746,8 @@ CREATE INDEX index_approval_rules_code_owners_rule_type ON approval_merge_reques CREATE INDEX index_approvals_on_merge_request_id ON approvals USING btree (merge_request_id); +CREATE INDEX index_approvals_on_merge_request_id_and_created_at ON approvals USING btree (merge_request_id, created_at); + CREATE UNIQUE INDEX index_approvals_on_user_id_and_merge_request_id ON approvals USING btree (user_id, merge_request_id); CREATE INDEX index_approver_groups_on_group_id ON approver_groups USING btree (group_id); @@ -20243,6 +20814,16 @@ CREATE INDEX index_board_user_preferences_on_user_id ON board_user_preferences U CREATE UNIQUE INDEX index_board_user_preferences_on_user_id_and_board_id ON board_user_preferences USING btree (user_id, board_id); +CREATE INDEX index_boards_epic_board_labels_on_epic_board_id ON boards_epic_board_labels USING btree (epic_board_id); + +CREATE INDEX index_boards_epic_board_labels_on_label_id ON boards_epic_board_labels USING btree (label_id); + +CREATE UNIQUE INDEX index_boards_epic_board_positions_on_epic_board_id_and_epic_id ON boards_epic_board_positions USING btree (epic_board_id, epic_id); + +CREATE INDEX index_boards_epic_board_positions_on_epic_id ON boards_epic_board_positions USING btree (epic_id); + +CREATE INDEX index_boards_epic_boards_on_group_id ON boards_epic_boards USING btree (group_id); + CREATE INDEX index_boards_epic_user_preferences_on_board_id ON boards_epic_user_preferences USING btree (board_id); CREATE UNIQUE INDEX index_boards_epic_user_preferences_on_board_user_epic_unique ON boards_epic_user_preferences USING btree (board_id, user_id, epic_id); @@ -20253,6 +20834,8 @@ CREATE INDEX index_boards_epic_user_preferences_on_user_id ON boards_epic_user_p CREATE INDEX index_boards_on_group_id ON boards USING btree (group_id); +CREATE INDEX index_boards_on_iteration_id ON boards USING btree (iteration_id); + CREATE INDEX index_boards_on_milestone_id ON boards USING btree (milestone_id); CREATE INDEX index_boards_on_project_id ON boards USING btree (project_id); @@ -20269,6 +20852,10 @@ CREATE INDEX index_bulk_import_entities_on_parent_id ON bulk_import_entities USI CREATE INDEX index_bulk_import_entities_on_project_id ON bulk_import_entities USING btree (project_id); +CREATE INDEX index_bulk_import_failures_on_bulk_import_entity_id ON bulk_import_failures USING btree (bulk_import_entity_id); + +CREATE INDEX index_bulk_import_failures_on_correlation_id_value ON bulk_import_failures USING btree (correlation_id_value); + CREATE INDEX index_bulk_imports_on_user_id ON bulk_imports USING btree (user_id); CREATE UNIQUE INDEX index_chat_names_on_service_id_and_team_id_and_chat_id ON chat_names USING btree (service_id, team_id, chat_id); @@ -20323,7 +20910,7 @@ CREATE INDEX index_ci_builds_on_protected ON ci_builds USING btree (protected); CREATE INDEX index_ci_builds_on_queued_at ON ci_builds USING btree (queued_at); -CREATE INDEX index_ci_builds_on_runner_id ON ci_builds USING btree (runner_id); +CREATE INDEX index_ci_builds_on_runner_id_and_id_desc ON ci_builds USING btree (runner_id, id DESC); CREATE INDEX index_ci_builds_on_stage_id ON ci_builds USING btree (stage_id); @@ -20405,7 +20992,7 @@ CREATE INDEX index_ci_pipelines_for_ondemand_dast_scans ON ci_pipelines USING bt CREATE INDEX index_ci_pipelines_on_auto_canceled_by_id ON ci_pipelines USING btree (auto_canceled_by_id); -CREATE INDEX index_ci_pipelines_on_ci_ref_id ON ci_pipelines USING btree (ci_ref_id) WHERE (ci_ref_id IS NOT NULL); +CREATE INDEX index_ci_pipelines_on_ci_ref_id_and_more ON ci_pipelines USING btree (ci_ref_id, id DESC, source, status) WHERE (ci_ref_id IS NOT NULL); CREATE INDEX index_ci_pipelines_on_external_pull_request_id ON ci_pipelines USING btree (external_pull_request_id) WHERE (external_pull_request_id IS NOT NULL); @@ -20413,8 +21000,6 @@ CREATE INDEX index_ci_pipelines_on_merge_request_id ON ci_pipelines USING btree CREATE INDEX index_ci_pipelines_on_pipeline_schedule_id ON ci_pipelines USING btree (pipeline_schedule_id); -CREATE INDEX index_ci_pipelines_on_project_id_and_created_at ON ci_pipelines USING btree (project_id, created_at); - CREATE INDEX index_ci_pipelines_on_project_id_and_id_desc ON ci_pipelines USING btree (project_id, id DESC); CREATE UNIQUE INDEX index_ci_pipelines_on_project_id_and_iid ON ci_pipelines USING btree (project_id, iid) WHERE (iid IS NOT NULL); @@ -20621,6 +21206,8 @@ CREATE INDEX index_dependency_proxy_blobs_on_group_id_and_file_name ON dependenc CREATE INDEX index_dependency_proxy_group_settings_on_group_id ON dependency_proxy_group_settings USING btree (group_id); +CREATE UNIQUE INDEX index_dependency_proxy_manifests_on_group_id_and_file_name ON dependency_proxy_manifests USING btree (group_id, file_name); + CREATE INDEX index_deploy_key_id_on_protected_branch_push_access_levels ON protected_branch_push_access_levels USING btree (deploy_key_id); CREATE INDEX index_deploy_keys_projects_on_deploy_key_id ON deploy_keys_projects USING btree (deploy_key_id); @@ -20647,12 +21234,14 @@ CREATE INDEX index_deployments_on_environment_id_and_id ON deployments USING btr CREATE INDEX index_deployments_on_environment_id_and_iid_and_project_id ON deployments USING btree (environment_id, iid, project_id); -CREATE INDEX index_deployments_on_environment_id_and_status ON deployments USING btree (environment_id, status); +CREATE INDEX index_deployments_on_environment_status_sha ON deployments USING btree (environment_id, status, sha); CREATE INDEX index_deployments_on_id_and_status_and_created_at ON deployments USING btree (id, status, created_at); CREATE INDEX index_deployments_on_id_where_cluster_id_present ON deployments USING btree (id) WHERE (cluster_id IS NOT NULL); +CREATE INDEX index_deployments_on_project_and_finished ON deployments USING btree (project_id, finished_at) WHERE (status = 2); + CREATE INDEX index_deployments_on_project_id_and_id ON deployments USING btree (project_id, id DESC); CREATE UNIQUE INDEX index_deployments_on_project_id_and_iid ON deployments USING btree (project_id, iid); @@ -20711,10 +21300,6 @@ CREATE INDEX index_elastic_reindexing_tasks_on_state ON elastic_reindexing_tasks CREATE INDEX index_elasticsearch_indexed_namespaces_on_created_at ON elasticsearch_indexed_namespaces USING btree (created_at); -CREATE UNIQUE INDEX index_elasticsearch_indexed_namespaces_on_namespace_id ON elasticsearch_indexed_namespaces USING btree (namespace_id); - -CREATE UNIQUE INDEX index_elasticsearch_indexed_projects_on_project_id ON elasticsearch_indexed_projects USING btree (project_id); - CREATE UNIQUE INDEX index_emails_on_confirmation_token ON emails USING btree (confirmation_token); CREATE UNIQUE INDEX index_emails_on_email ON emails USING btree (email); @@ -20799,6 +21384,14 @@ CREATE UNIQUE INDEX index_events_on_target_type_and_target_id_and_fingerprint ON CREATE INDEX index_evidences_on_release_id ON evidences USING btree (release_id); +CREATE INDEX index_experiment_subjects_on_experiment_id ON experiment_subjects USING btree (experiment_id); + +CREATE INDEX index_experiment_subjects_on_group_id ON experiment_subjects USING btree (group_id); + +CREATE INDEX index_experiment_subjects_on_project_id ON experiment_subjects USING btree (project_id); + +CREATE INDEX index_experiment_subjects_on_user_id ON experiment_subjects USING btree (user_id); + CREATE INDEX index_experiment_users_on_experiment_id ON experiment_users USING btree (experiment_id); CREATE INDEX index_experiment_users_on_user_id ON experiment_users USING btree (user_id); @@ -20971,6 +21564,8 @@ CREATE INDEX index_identities_on_saml_provider_id ON identities USING btree (sam CREATE INDEX index_identities_on_user_id ON identities USING btree (user_id); +CREATE UNIQUE INDEX index_im_oncall_schedules_on_project_id_and_iid ON incident_management_oncall_schedules USING btree (project_id, iid); + CREATE UNIQUE INDEX index_import_export_uploads_on_group_id ON import_export_uploads USING btree (group_id) WHERE (group_id IS NOT NULL); CREATE INDEX index_import_export_uploads_on_project_id ON import_export_uploads USING btree (project_id); @@ -20987,6 +21582,18 @@ CREATE INDEX index_import_failures_on_project_id_not_null ON import_failures USI CREATE INDEX index_imported_projects_on_import_type_creator_id_created_at ON projects USING btree (import_type, creator_id, created_at) WHERE (import_type IS NOT NULL); +CREATE INDEX index_inc_mgmnt_oncall_participants_on_oncall_rotation_id ON incident_management_oncall_participants USING btree (oncall_rotation_id); + +CREATE INDEX index_inc_mgmnt_oncall_participants_on_oncall_user_id ON incident_management_oncall_participants USING btree (user_id); + +CREATE UNIQUE INDEX index_inc_mgmnt_oncall_participants_on_user_id_and_rotation_id ON incident_management_oncall_participants USING btree (user_id, oncall_rotation_id); + +CREATE UNIQUE INDEX index_inc_mgmnt_oncall_rotations_on_oncall_schedule_id_and_id ON incident_management_oncall_rotations USING btree (oncall_schedule_id, id); + +CREATE UNIQUE INDEX index_inc_mgmnt_oncall_rotations_on_oncall_schedule_id_and_name ON incident_management_oncall_rotations USING btree (oncall_schedule_id, name); + +CREATE INDEX index_incident_management_oncall_schedules_on_project_id ON incident_management_oncall_schedules USING btree (project_id); + CREATE UNIQUE INDEX index_index_statuses_on_project_id ON index_statuses USING btree (project_id); CREATE INDEX index_insights_on_namespace_id ON insights USING btree (namespace_id); @@ -21003,6 +21610,8 @@ CREATE UNIQUE INDEX index_internal_ids_on_usage_and_project_id ON internal_ids U CREATE INDEX index_ip_restrictions_on_group_id ON ip_restrictions USING btree (group_id); +CREATE INDEX index_issuable_metric_images_on_issue_id ON issuable_metric_images USING btree (issue_id); + CREATE UNIQUE INDEX index_issuable_severities_on_issue_id ON issuable_severities USING btree (issue_id); CREATE UNIQUE INDEX index_issuable_slas_on_issue_id ON issuable_slas USING btree (issue_id); @@ -21101,7 +21710,7 @@ CREATE UNIQUE INDEX index_label_priorities_on_project_id_and_label_id ON label_p CREATE UNIQUE INDEX index_labels_on_group_id_and_project_id_and_title ON labels USING btree (group_id, project_id, title); -CREATE INDEX index_labels_on_group_id_and_title ON labels USING btree (group_id, title) WHERE (project_id = NULL::integer); +CREATE INDEX index_labels_on_group_id_and_title_with_null_project_id ON labels USING btree (group_id, title) WHERE (project_id IS NULL); CREATE INDEX index_labels_on_project_id ON labels USING btree (project_id); @@ -21133,6 +21742,8 @@ CREATE UNIQUE INDEX index_list_user_preferences_on_user_id_and_list_id ON list_u CREATE UNIQUE INDEX index_lists_on_board_id_and_label_id ON lists USING btree (board_id, label_id); +CREATE INDEX index_lists_on_iteration_id ON lists USING btree (iteration_id); + CREATE INDEX index_lists_on_label_id ON lists USING btree (label_id); CREATE INDEX index_lists_on_list_type ON lists USING btree (list_type); @@ -21285,8 +21896,12 @@ CREATE UNIQUE INDEX index_mr_context_commits_on_merge_request_id_and_sha ON merg CREATE INDEX index_mr_metrics_on_target_project_id_merged_at_nulls_last ON merge_request_metrics USING btree (target_project_id, merged_at DESC NULLS LAST, id DESC); +CREATE INDEX index_mr_metrics_on_target_project_id_merged_at_time_to_merge ON merge_request_metrics USING btree (target_project_id, merged_at, created_at) WHERE (merged_at > created_at); + CREATE UNIQUE INDEX index_namespace_aggregation_schedules_on_namespace_id ON namespace_aggregation_schedules USING btree (namespace_id); +CREATE INDEX index_namespace_onboarding_actions_on_namespace_id ON namespace_onboarding_actions USING btree (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); @@ -21341,7 +21956,7 @@ CREATE INDEX index_notes_on_line_code ON notes USING btree (line_code); CREATE INDEX index_notes_on_note_trigram ON notes USING gin (note gin_trgm_ops); -CREATE INDEX index_notes_on_noteable_id_and_noteable_type ON notes USING btree (noteable_id, noteable_type); +CREATE INDEX index_notes_on_noteable_id_and_noteable_type_and_system ON notes USING btree (noteable_id, noteable_type, system); CREATE INDEX index_notes_on_project_id_and_id_and_system_false ON notes USING btree (project_id, id) WHERE (NOT system); @@ -21397,6 +22012,8 @@ CREATE UNIQUE INDEX index_on_segment_selections_project_id_segment_id ON analyti CREATE INDEX index_on_segment_selections_segment_id ON analytics_devops_adoption_segment_selections USING btree (segment_id); +CREATE INDEX index_on_snapshots_segment_id_recorded_at ON analytics_devops_adoption_snapshots USING btree (segment_id, recorded_at); + CREATE INDEX index_on_users_lower_email ON users USING btree (lower((email)::text)); CREATE INDEX index_on_users_lower_username ON users USING btree (lower((username)::text)); @@ -21453,6 +22070,8 @@ CREATE INDEX index_packages_package_files_on_file_store ON packages_package_file CREATE INDEX index_packages_package_files_on_package_id_and_file_name ON packages_package_files USING btree (package_id, file_name); +CREATE INDEX index_packages_package_files_on_verification_state ON packages_package_files USING btree (verification_state); + CREATE INDEX index_packages_packages_on_creator_id ON packages_packages USING btree (creator_id); CREATE INDEX index_packages_packages_on_id_and_created_at ON packages_packages USING btree (id, created_at); @@ -21603,6 +22222,8 @@ CREATE UNIQUE INDEX index_project_repositories_on_project_id ON project_reposito CREATE INDEX index_project_repositories_on_shard_id ON project_repositories USING btree (shard_id); +CREATE INDEX index_project_repositories_on_shard_id_and_project_id ON project_repositories USING btree (shard_id, project_id); + CREATE UNIQUE INDEX index_project_repository_states_on_project_id ON project_repository_states USING btree (project_id); CREATE INDEX index_project_repository_storage_moves_on_project_id ON project_repository_storage_moves USING btree (project_id); @@ -21613,6 +22234,8 @@ CREATE UNIQUE INDEX index_project_settings_on_push_rule_id ON project_settings U CREATE INDEX index_project_statistics_on_namespace_id ON project_statistics USING btree (namespace_id); +CREATE INDEX index_project_statistics_on_packages_size_and_project_id ON project_statistics USING btree (packages_size, project_id); + CREATE UNIQUE INDEX index_project_statistics_on_project_id ON project_statistics USING btree (project_id); CREATE INDEX index_project_statistics_on_repository_size_and_project_id ON project_statistics USING btree (repository_size, project_id); @@ -21657,6 +22280,8 @@ CREATE INDEX index_projects_on_creator_id_and_created_at_and_id ON projects USIN CREATE INDEX index_projects_on_creator_id_and_id ON projects USING btree (creator_id, id); +CREATE INDEX index_projects_on_creator_id_import_type_and_created_at_partial ON projects USING btree (creator_id, import_type, created_at) WHERE (import_type IS NOT NULL); + CREATE INDEX index_projects_on_description_trigram ON projects USING gin (description gin_trgm_ops); CREATE INDEX index_projects_on_id_and_archived_and_pending_delete ON projects USING btree (id) WHERE ((archived = false) AND (pending_delete = false)); @@ -21789,6 +22414,8 @@ CREATE INDEX index_releases_on_author_id ON releases USING btree (author_id); CREATE INDEX index_releases_on_project_id_and_tag ON releases USING btree (project_id, tag); +CREATE INDEX index_releases_on_released_at ON releases USING btree (released_at); + CREATE INDEX index_remote_mirrors_on_last_successful_update_at ON remote_mirrors USING btree (last_successful_update_at); CREATE INDEX index_remote_mirrors_on_project_id ON remote_mirrors USING btree (project_id); @@ -21891,7 +22518,7 @@ CREATE UNIQUE INDEX index_scim_identities_on_user_id_and_group_id ON scim_identi CREATE UNIQUE INDEX index_scim_oauth_access_tokens_on_group_id_and_token_encrypted ON scim_oauth_access_tokens USING btree (group_id, token_encrypted); -CREATE INDEX index_secure_ci_builds_on_user_id_created_at_parser_features ON ci_builds USING btree (user_id, created_at) WHERE (((type)::text = 'Ci::Build'::text) AND ((name)::text = ANY (ARRAY[('container_scanning'::character varying)::text, ('dast'::character varying)::text, ('dependency_scanning'::character varying)::text, ('license_management'::character varying)::text, ('license_scanning'::character varying)::text, ('sast'::character varying)::text, ('coverage_fuzzing'::character varying)::text, ('secret_detection'::character varying)::text]))); +CREATE INDEX index_secure_ci_builds_on_user_id_name_created_at ON ci_builds USING btree (user_id, name, created_at) WHERE (((type)::text = 'Ci::Build'::text) AND ((name)::text = ANY (ARRAY[('container_scanning'::character varying)::text, ('dast'::character varying)::text, ('dependency_scanning'::character varying)::text, ('license_management'::character varying)::text, ('license_scanning'::character varying)::text, ('sast'::character varying)::text, ('coverage_fuzzing'::character varying)::text, ('apifuzzer_fuzz'::character varying)::text, ('apifuzzer_fuzz_dnd'::character varying)::text, ('secret_detection'::character varying)::text]))); CREATE INDEX index_security_ci_builds_on_name_and_id_parser_features ON ci_builds USING btree (name, id) WHERE (((name)::text = ANY (ARRAY[('container_scanning'::character varying)::text, ('dast'::character varying)::text, ('dependency_scanning'::character varying)::text, ('license_management'::character varying)::text, ('sast'::character varying)::text, ('secret_detection'::character varying)::text, ('coverage_fuzzing'::character varying)::text, ('license_scanning'::character varying)::text])) AND ((type)::text = 'Ci::Build'::text)); @@ -21907,6 +22534,8 @@ CREATE INDEX index_security_findings_on_scanner_id ON security_findings USING bt CREATE INDEX index_security_findings_on_severity ON security_findings USING btree (severity); +CREATE UNIQUE INDEX index_security_findings_on_uuid_and_scan_id ON security_findings USING btree (uuid, scan_id); + CREATE INDEX index_self_managed_prometheus_alert_events_on_environment_id ON self_managed_prometheus_alert_events USING btree (environment_id); CREATE INDEX index_sent_notifications_on_noteable_type_noteable_id ON sent_notifications USING btree (noteable_id) WHERE ((noteable_type)::text = 'Issue'::text); @@ -21949,6 +22578,8 @@ CREATE UNIQUE INDEX index_smartcard_identities_on_subject_and_issuer ON smartcar CREATE INDEX index_smartcard_identities_on_user_id ON smartcard_identities USING btree (user_id); +CREATE INDEX index_snippet_on_id_and_project_id ON snippets USING btree (id, project_id); + CREATE UNIQUE INDEX index_snippet_repositories_on_disk_path ON snippet_repositories USING btree (disk_path); CREATE INDEX index_snippet_repositories_on_shard_id ON snippet_repositories USING btree (shard_id); @@ -22109,12 +22740,16 @@ CREATE INDEX index_user_custom_attributes_on_key_and_value ON user_custom_attrib CREATE UNIQUE INDEX index_user_custom_attributes_on_user_id_and_key ON user_custom_attributes USING btree (user_id, key); +CREATE INDEX index_user_details_on_provisioned_by_group_id ON user_details USING btree (provisioned_by_group_id); + CREATE UNIQUE INDEX index_user_details_on_user_id ON user_details USING btree (user_id); CREATE INDEX index_user_highest_roles_on_user_id_and_highest_access_level ON user_highest_roles USING btree (user_id, highest_access_level); CREATE INDEX index_user_interacted_projects_on_user_id ON user_interacted_projects USING btree (user_id); +CREATE INDEX index_user_permission_export_uploads_on_user_id_and_status ON user_permission_export_uploads USING btree (user_id, status); + CREATE INDEX index_user_preferences_on_gitpod_enabled ON user_preferences USING btree (gitpod_enabled); CREATE UNIQUE INDEX index_user_preferences_on_user_id ON user_preferences USING btree (user_id); @@ -22149,6 +22784,8 @@ CREATE INDEX index_users_on_name_trigram ON users USING gin (name gin_trgm_ops); CREATE INDEX index_users_on_public_email ON users USING btree (public_email) WHERE ((public_email)::text <> ''::text); +CREATE INDEX index_users_on_require_two_factor_authentication_from_group ON users USING btree (require_two_factor_authentication_from_group) WHERE (require_two_factor_authentication_from_group = true); + CREATE UNIQUE INDEX index_users_on_reset_password_token ON users USING btree (reset_password_token); CREATE INDEX index_users_on_state ON users USING btree (state); @@ -22193,7 +22830,7 @@ CREATE INDEX index_vulnerabilities_on_last_edited_by_id ON vulnerabilities USING CREATE INDEX index_vulnerabilities_on_milestone_id ON vulnerabilities USING btree (milestone_id); -CREATE INDEX index_vulnerabilities_on_project_id ON vulnerabilities USING btree (project_id); +CREATE INDEX index_vulnerabilities_on_project_id_and_state_and_severity ON vulnerabilities USING btree (project_id, state, severity); CREATE INDEX index_vulnerabilities_on_resolved_by_id ON vulnerabilities USING btree (resolved_by_id); @@ -22213,6 +22850,10 @@ CREATE INDEX index_vulnerability_exports_on_group_id_not_null ON vulnerability_e CREATE INDEX index_vulnerability_exports_on_project_id_not_null ON vulnerability_exports USING btree (project_id) WHERE (project_id IS NOT NULL); +CREATE INDEX index_vulnerability_external_issue_links_on_author_id ON vulnerability_external_issue_links USING btree (author_id); + +CREATE INDEX index_vulnerability_external_issue_links_on_vulnerability_id ON vulnerability_external_issue_links USING btree (vulnerability_id); + CREATE INDEX index_vulnerability_feedback_on_author_id ON vulnerability_feedback USING btree (author_id); CREATE INDEX index_vulnerability_feedback_on_comment_author_id ON vulnerability_feedback USING btree (comment_author_id); @@ -22225,6 +22866,10 @@ CREATE INDEX index_vulnerability_feedback_on_merge_request_id ON vulnerability_f CREATE INDEX index_vulnerability_feedback_on_pipeline_id ON vulnerability_feedback USING btree (pipeline_id); +CREATE INDEX index_vulnerability_findings_remediations_on_remediation_id ON vulnerability_findings_remediations USING btree (vulnerability_remediation_id); + +CREATE UNIQUE INDEX index_vulnerability_findings_remediations_on_unique_keys ON vulnerability_findings_remediations USING btree (vulnerability_occurrence_id, vulnerability_remediation_id); + CREATE INDEX index_vulnerability_historical_statistics_on_date_and_id ON vulnerability_historical_statistics USING btree (date, id); CREATE UNIQUE INDEX index_vulnerability_identifiers_on_project_id_and_fingerprint ON vulnerability_identifiers USING btree (project_id, fingerprint); @@ -22251,6 +22896,8 @@ CREATE UNIQUE INDEX index_vulnerability_occurrences_on_uuid ON vulnerability_occ CREATE INDEX index_vulnerability_occurrences_on_vulnerability_id ON vulnerability_occurrences USING btree (vulnerability_id); +CREATE UNIQUE INDEX index_vulnerability_remediations_on_project_id_and_checksum ON vulnerability_remediations USING btree (project_id, checksum); + CREATE UNIQUE INDEX index_vulnerability_scanners_on_project_id_and_external_id ON vulnerability_scanners USING btree (project_id, external_id); CREATE INDEX index_vulnerability_statistics_on_letter_grade ON vulnerability_statistics USING btree (letter_grade); @@ -22271,6 +22918,8 @@ CREATE INDEX index_web_hooks_on_group_id ON web_hooks USING btree (group_id) WHE CREATE INDEX index_web_hooks_on_project_id ON web_hooks USING btree (project_id); +CREATE INDEX index_web_hooks_on_service_id ON web_hooks USING btree (service_id); + CREATE INDEX index_web_hooks_on_type ON web_hooks USING btree (type); CREATE UNIQUE INDEX index_webauthn_registrations_on_credential_xid ON webauthn_registrations USING btree (credential_xid); @@ -22329,9 +22978,11 @@ CREATE UNIQUE INDEX one_canonical_wiki_page_slug_per_metadata ON wiki_page_slugs CREATE INDEX package_name_index ON packages_packages USING btree (name); -CREATE INDEX packages_packages_verification_checksum_partial ON packages_package_files USING btree (verification_checksum) WHERE (verification_checksum IS NOT NULL); +CREATE INDEX packages_packages_failed_verification ON packages_package_files USING btree (verification_retry_at NULLS FIRST) WHERE (verification_state = 3); + +CREATE INDEX packages_packages_needs_verification ON packages_package_files USING btree (verification_state) WHERE ((verification_state = 0) OR (verification_state = 3)); -CREATE INDEX packages_packages_verification_failure_partial ON packages_package_files USING btree (verification_failure) WHERE (verification_failure IS NOT NULL); +CREATE INDEX packages_packages_pending_verification ON packages_package_files USING btree (verified_at NULLS FIRST) WHERE (verification_state = 0); CREATE INDEX partial_index_ci_builds_on_scheduled_at_with_scheduled_jobs ON ci_builds USING btree (scheduled_at) WHERE ((scheduled_at IS NOT NULL) AND ((type)::text = 'Ci::Build'::text) AND ((status)::text = 'scheduled'::text)); @@ -22339,10 +22990,6 @@ CREATE INDEX partial_index_deployments_for_legacy_successful_deployments ON depl CREATE INDEX partial_index_deployments_for_project_id_and_tag ON deployments USING btree (project_id) WHERE (tag IS TRUE); -CREATE INDEX snippet_repositories_verification_checksum_partial ON snippet_repositories USING btree (verification_checksum) WHERE (verification_checksum IS NOT NULL); - -CREATE INDEX snippet_repositories_verification_failure_partial ON snippet_repositories USING btree (verification_failure) WHERE (verification_failure IS NOT NULL); - CREATE UNIQUE INDEX snippet_user_mentions_on_snippet_id_and_note_id_index ON snippet_user_mentions USING btree (snippet_id, note_id); CREATE UNIQUE INDEX snippet_user_mentions_on_snippet_id_index ON snippet_user_mentions USING btree (snippet_id) WHERE (note_id IS NULL); @@ -22353,20 +23000,12 @@ CREATE INDEX temporary_index_vulnerabilities_on_id ON vulnerabilities USING btre CREATE UNIQUE INDEX term_agreements_unique_index ON term_agreements USING btree (user_id, term_id); -CREATE INDEX terraform_state_versions_verification_checksum_partial ON terraform_state_versions USING btree (verification_checksum) WHERE (verification_checksum IS NOT NULL); - -CREATE INDEX terraform_state_versions_verification_failure_partial ON terraform_state_versions USING btree (verification_failure) WHERE (verification_failure IS NOT NULL); - CREATE INDEX tmp_build_stage_position_index ON ci_builds USING btree (stage_id, stage_idx) WHERE (stage_idx IS NOT NULL); -CREATE INDEX tmp_idx_blocked_by_type_links ON issue_links USING btree (target_id) WHERE (link_type = 2); - -CREATE INDEX tmp_idx_blocking_type_links ON issue_links USING btree (source_id) WHERE (link_type = 1); - -CREATE INDEX tmp_idx_index_issues_with_outdate_blocking_count ON issues USING btree (id) WHERE ((state_id = 1) AND (blocking_issues_count = 0)); - CREATE INDEX tmp_index_for_email_unconfirmation_migration ON emails USING btree (id) WHERE (confirmed_at IS NOT NULL); +CREATE INDEX tmp_index_on_vulnerabilities_non_dismissed ON vulnerabilities USING btree (id) WHERE (state <> 2); + CREATE UNIQUE INDEX unique_merge_request_metrics_by_merge_request_id ON merge_request_metrics USING btree (merge_request_id); CREATE UNIQUE INDEX vulnerability_feedback_unique_idx ON vulnerability_feedback USING btree (project_id, category, feedback_type, project_fingerprint); @@ -22700,6 +23339,9 @@ ALTER TABLE ONLY project_features ALTER TABLE ONLY ci_pipelines ADD CONSTRAINT fk_190998ef09 FOREIGN KEY (external_pull_request_id) REFERENCES external_pull_requests(id) ON DELETE SET NULL; +ALTER TABLE ONLY user_details + ADD CONSTRAINT fk_190e4fcc88 FOREIGN KEY (provisioned_by_group_id) REFERENCES namespaces(id) ON DELETE SET NULL; + ALTER TABLE ONLY vulnerabilities ADD CONSTRAINT fk_1d37cddf91 FOREIGN KEY (epic_id) REFERENCES epics(id) ON DELETE SET NULL; @@ -22754,6 +23396,9 @@ ALTER TABLE ONLY notes ALTER TABLE ONLY members ADD CONSTRAINT fk_2e88fb7ce9 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE; +ALTER TABLE ONLY lists + ADD CONSTRAINT fk_30f2a831f4 FOREIGN KEY (iteration_id) REFERENCES sprints(id) ON DELETE CASCADE; + ALTER TABLE ONLY approvals ADD CONSTRAINT fk_310d714958 FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE; @@ -22940,9 +23585,6 @@ ALTER TABLE ONLY merge_request_diffs ALTER TABLE ONLY ci_pipelines ADD CONSTRAINT fk_86635dbd80 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; -ALTER TABLE ONLY services - ADD CONSTRAINT fk_868a8e7ad6 FOREIGN KEY (inherit_from_id) REFERENCES services(id) ON DELETE SET NULL; - ALTER TABLE ONLY geo_event_log ADD CONSTRAINT fk_86c84214ec FOREIGN KEY (repository_renamed_event_id) REFERENCES geo_repository_renamed_events(id) ON DELETE CASCADE; @@ -22952,6 +23594,9 @@ ALTER TABLE ONLY packages_package_files ALTER TABLE ONLY ci_builds ADD CONSTRAINT fk_87f4cefcda FOREIGN KEY (upstream_pipeline_id) REFERENCES ci_pipelines(id) ON DELETE CASCADE; +ALTER TABLE ONLY experiment_subjects + ADD CONSTRAINT fk_88489af1b1 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE; + ALTER TABLE ONLY vulnerabilities ADD CONSTRAINT fk_88b4d546ef FOREIGN KEY (start_date_sourcing_milestone_id) REFERENCES milestones(id) ON DELETE SET NULL; @@ -23138,6 +23783,9 @@ ALTER TABLE ONLY issues ALTER TABLE ONLY issue_links ADD CONSTRAINT fk_c900194ff2 FOREIGN KEY (source_id) REFERENCES issues(id) ON DELETE CASCADE; +ALTER TABLE ONLY experiment_subjects + ADD CONSTRAINT fk_ccc28f8ceb FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; + ALTER TABLE ONLY todos ADD CONSTRAINT fk_ccf0373936 FOREIGN KEY (author_id) REFERENCES users(id) ON DELETE CASCADE; @@ -23156,6 +23804,9 @@ ALTER TABLE ONLY environments ALTER TABLE ONLY ci_builds ADD CONSTRAINT fk_d3130c9a7f FOREIGN KEY (commit_id) REFERENCES ci_pipelines(id) ON DELETE CASCADE; +ALTER TABLE ONLY web_hooks + ADD CONSTRAINT fk_d47999a98a FOREIGN KEY (service_id) REFERENCES services(id) ON DELETE CASCADE NOT VALID; + ALTER TABLE ONLY ci_sources_pipelines ADD CONSTRAINT fk_d4e29af7d7 FOREIGN KEY (source_pipeline_id) REFERENCES ci_pipelines(id) ON DELETE CASCADE; @@ -23195,6 +23846,9 @@ ALTER TABLE ONLY analytics_devops_adoption_segment_selections ALTER TABLE ONLY issues ADD CONSTRAINT fk_df75a7c8b8 FOREIGN KEY (promoted_to_epic_id) REFERENCES epics(id) ON DELETE SET NULL; +ALTER TABLE ONLY experiment_subjects + ADD CONSTRAINT fk_dfc3e211d4 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE; + ALTER TABLE ONLY ci_resources ADD CONSTRAINT fk_e169a8e3d5 FOREIGN KEY (build_id) REFERENCES ci_builds(id) ON DELETE SET NULL; @@ -23252,6 +23906,9 @@ ALTER TABLE ONLY emails ALTER TABLE ONLY clusters ADD CONSTRAINT fk_f05c5e5a42 FOREIGN KEY (management_project_id) REFERENCES projects(id) ON DELETE SET NULL; +ALTER TABLE ONLY vulnerability_external_issue_links + ADD CONSTRAINT fk_f07bb8233d FOREIGN KEY (vulnerability_id) REFERENCES vulnerabilities(id) ON DELETE CASCADE; + ALTER TABLE ONLY epics ADD CONSTRAINT fk_f081aa4489 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE; @@ -23276,6 +23933,9 @@ ALTER TABLE ONLY ci_stages ALTER TABLE ONLY system_note_metadata ADD CONSTRAINT fk_fbd87415c9 FOREIGN KEY (description_version_id) REFERENCES description_versions(id) ON DELETE SET NULL; +ALTER TABLE ONLY vulnerability_remediations + ADD CONSTRAINT fk_fc61a535a0 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; + ALTER TABLE ONLY merge_requests ADD CONSTRAINT fk_fd82eae0b9 FOREIGN KEY (head_pipeline_id) REFERENCES ci_pipelines(id) ON DELETE SET NULL; @@ -23318,6 +23978,9 @@ ALTER TABLE ONLY namespace_statistics ALTER TABLE ONLY clusters_applications_elastic_stacks ADD CONSTRAINT fk_rails_026f219f46 FOREIGN KEY (cluster_id) REFERENCES clusters(id) ON DELETE CASCADE; +ALTER TABLE ONLY incident_management_oncall_participants + ADD CONSTRAINT fk_rails_032b12996a FOREIGN KEY (oncall_rotation_id) REFERENCES incident_management_oncall_rotations(id) ON DELETE CASCADE; + ALTER TABLE ONLY events ADD CONSTRAINT fk_rails_0434b48643 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; @@ -23432,6 +24095,9 @@ ALTER TABLE ONLY cluster_providers_aws ALTER TABLE ONLY grafana_integrations ADD CONSTRAINT fk_rails_18d0e2b564 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; +ALTER TABLE ONLY bulk_import_failures + ADD CONSTRAINT fk_rails_1964240b8c FOREIGN KEY (bulk_import_entity_id) REFERENCES bulk_import_entities(id) ON DELETE CASCADE; + ALTER TABLE ONLY group_wiki_repositories ADD CONSTRAINT fk_rails_19755e374b FOREIGN KEY (shard_id) REFERENCES shards(id) ON DELETE RESTRICT; @@ -23441,6 +24107,9 @@ ALTER TABLE ONLY open_project_tracker_data ALTER TABLE ONLY gpg_signatures ADD CONSTRAINT fk_rails_19d4f1c6f9 FOREIGN KEY (gpg_key_subkey_id) REFERENCES gpg_key_subkeys(id) ON DELETE SET NULL; +ALTER TABLE ONLY incident_management_oncall_schedules + ADD CONSTRAINT fk_rails_19e83fdd65 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; + ALTER TABLE ONLY vulnerability_user_mentions ADD CONSTRAINT fk_rails_1a41c485cd FOREIGN KEY (vulnerability_id) REFERENCES vulnerabilities(id) ON DELETE CASCADE; @@ -23459,6 +24128,9 @@ ALTER TABLE ONLY approver_groups ALTER TABLE ONLY packages_tags ADD CONSTRAINT fk_rails_1dfc868911 FOREIGN KEY (package_id) REFERENCES packages_packages(id) ON DELETE CASCADE; +ALTER TABLE ONLY boards_epic_board_positions + ADD CONSTRAINT fk_rails_1ecfd9f2de FOREIGN KEY (epic_id) REFERENCES epics(id) ON DELETE CASCADE; + ALTER TABLE ONLY geo_repository_created_events ADD CONSTRAINT fk_rails_1f49e46a61 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; @@ -23486,6 +24158,12 @@ ALTER TABLE ONLY saml_group_links ALTER TABLE ONLY group_custom_attributes ADD CONSTRAINT fk_rails_246e0db83a FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE; +ALTER TABLE ONLY incident_management_oncall_rotations + ADD CONSTRAINT fk_rails_256e0bc604 FOREIGN KEY (oncall_schedule_id) REFERENCES incident_management_oncall_schedules(id) ON DELETE CASCADE; + +ALTER TABLE ONLY analytics_devops_adoption_snapshots + ADD CONSTRAINT fk_rails_25da9a92c0 FOREIGN KEY (segment_id) REFERENCES analytics_devops_adoption_segments(id) ON DELETE CASCADE; + ALTER TABLE ONLY cluster_agents ADD CONSTRAINT fk_rails_25e9fc2d5d FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; @@ -23504,6 +24182,9 @@ ALTER TABLE ONLY project_alerting_settings ALTER TABLE ONLY dast_site_validations ADD CONSTRAINT fk_rails_285c617324 FOREIGN KEY (dast_site_token_id) REFERENCES dast_site_tokens(id) ON DELETE CASCADE; +ALTER TABLE ONLY vulnerability_findings_remediations + ADD CONSTRAINT fk_rails_28a8d0cf93 FOREIGN KEY (vulnerability_occurrence_id) REFERENCES vulnerability_occurrences(id) ON DELETE CASCADE; + ALTER TABLE ONLY resource_state_events ADD CONSTRAINT fk_rails_29af06892a FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE; @@ -23519,6 +24200,9 @@ ALTER TABLE ONLY group_group_links ALTER TABLE ONLY geo_repository_updated_events ADD CONSTRAINT fk_rails_2b70854c08 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; +ALTER TABLE ONLY boards_epic_board_labels + ADD CONSTRAINT fk_rails_2bedeb8799 FOREIGN KEY (label_id) REFERENCES labels(id) ON DELETE CASCADE; + ALTER TABLE ONLY protected_branch_unprotect_access_levels ADD CONSTRAINT fk_rails_2d2aba21ef FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE; @@ -23654,6 +24338,9 @@ ALTER TABLE ONLY merge_request_assignees ALTER TABLE ONLY packages_dependency_links ADD CONSTRAINT fk_rails_4437bf4070 FOREIGN KEY (dependency_id) REFERENCES packages_dependencies(id) ON DELETE CASCADE; +ALTER TABLE ONLY namespace_onboarding_actions + ADD CONSTRAINT fk_rails_4504f6875a FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE; + ALTER TABLE ONLY project_auto_devops ADD CONSTRAINT fk_rails_45436b12b2 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; @@ -23744,6 +24431,9 @@ ALTER TABLE ONLY clusters_applications_knative ALTER TABLE ONLY terraform_states ADD CONSTRAINT fk_rails_558901b030 FOREIGN KEY (locked_by_user_id) REFERENCES users(id); +ALTER TABLE ONLY issuable_metric_images + ADD CONSTRAINT fk_rails_56417a5a7f FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE; + ALTER TABLE ONLY group_deploy_keys ADD CONSTRAINT fk_rails_5682fc07f8 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE RESTRICT; @@ -23801,6 +24491,9 @@ ALTER TABLE ONLY resource_weight_events ALTER TABLE ONLY approval_project_rules ADD CONSTRAINT fk_rails_5fb4dd100b FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; +ALTER TABLE ONLY incident_management_oncall_participants + ADD CONSTRAINT fk_rails_5fe86ea341 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE; + ALTER TABLE ONLY user_highest_roles ADD CONSTRAINT fk_rails_60f6c325a6 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE; @@ -23864,6 +24557,9 @@ ALTER TABLE ONLY web_hook_logs ALTER TABLE ONLY jira_imports ADD CONSTRAINT fk_rails_675d38c03b FOREIGN KEY (label_id) REFERENCES labels(id) ON DELETE SET NULL; +ALTER TABLE ONLY vulnerability_findings_remediations + ADD CONSTRAINT fk_rails_681c85ae0f FOREIGN KEY (vulnerability_remediation_id) REFERENCES vulnerability_remediations(id) ON DELETE CASCADE; + ALTER TABLE ONLY resource_iteration_events ADD CONSTRAINT fk_rails_6830c13ac1 FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE; @@ -23915,6 +24611,9 @@ ALTER TABLE ONLY slack_integrations ALTER TABLE ONLY custom_emoji ADD CONSTRAINT fk_rails_745925b412 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE; +ALTER TABLE ONLY boards_epic_board_labels + ADD CONSTRAINT fk_rails_7471128a8e FOREIGN KEY (epic_board_id) REFERENCES boards_epic_boards(id) ON DELETE CASCADE; + ALTER TABLE ONLY dast_site_profiles ADD CONSTRAINT fk_rails_747dc64abc FOREIGN KEY (dast_site_id) REFERENCES dast_sites(id) ON DELETE CASCADE; @@ -23999,6 +24698,9 @@ ALTER TABLE ONLY clusters_applications_crossplane ALTER TABLE ONLY packages_package_file_build_infos ADD CONSTRAINT fk_rails_871ca3ae21 FOREIGN KEY (package_file_id) REFERENCES packages_package_files(id) ON DELETE CASCADE; +ALTER TABLE ONLY boards_epic_boards + ADD CONSTRAINT fk_rails_874c573878 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE; + ALTER TABLE ONLY ci_runner_namespaces ADD CONSTRAINT fk_rails_8767676b7a FOREIGN KEY (runner_id) REFERENCES ci_runners(id) ON DELETE CASCADE; @@ -24167,9 +24869,15 @@ ALTER TABLE ONLY user_preferences ALTER TABLE ONLY sentry_issues ADD CONSTRAINT fk_rails_a6a9612965 FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE; +ALTER TABLE ONLY user_permission_export_uploads + ADD CONSTRAINT fk_rails_a7130085e3 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE; + ALTER TABLE ONLY repository_languages ADD CONSTRAINT fk_rails_a750ec87a8 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; +ALTER TABLE ONLY dependency_proxy_manifests + ADD CONSTRAINT fk_rails_a758021fb0 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE; + ALTER TABLE ONLY resource_milestone_events ADD CONSTRAINT fk_rails_a788026e85 FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE; @@ -24356,6 +25064,9 @@ ALTER TABLE ONLY gpg_signatures ALTER TABLE ONLY board_group_recent_visits ADD CONSTRAINT fk_rails_ca04c38720 FOREIGN KEY (board_id) REFERENCES boards(id) ON DELETE CASCADE; +ALTER TABLE ONLY boards_epic_board_positions + ADD CONSTRAINT fk_rails_cb4563dd6e FOREIGN KEY (epic_board_id) REFERENCES boards_epic_boards(id) ON DELETE CASCADE; + ALTER TABLE ONLY vulnerability_finding_links ADD CONSTRAINT fk_rails_cbdfde27ce FOREIGN KEY (vulnerability_occurrence_id) REFERENCES vulnerability_occurrences(id) ON DELETE CASCADE; @@ -24452,6 +25163,9 @@ ALTER TABLE ONLY vulnerability_occurrence_identifiers ALTER TABLE ONLY serverless_domain_cluster ADD CONSTRAINT fk_rails_e59e868733 FOREIGN KEY (clusters_applications_knative_id) REFERENCES clusters_applications_knative(id) ON DELETE CASCADE; +ALTER TABLE ONLY vulnerability_external_issue_links + ADD CONSTRAINT fk_rails_e5ba7f7b13 FOREIGN KEY (author_id) REFERENCES users(id) ON DELETE SET NULL; + ALTER TABLE ONLY approval_merge_request_rule_sources ADD CONSTRAINT fk_rails_e605a04f76 FOREIGN KEY (approval_merge_request_rule_id) REFERENCES approval_merge_request_rules(id) ON DELETE CASCADE; @@ -24497,6 +25211,9 @@ ALTER TABLE ONLY snippet_statistics ALTER TABLE ONLY project_security_settings ADD CONSTRAINT fk_rails_ed4abe1338 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; +ALTER TABLE ONLY experiment_subjects + ADD CONSTRAINT fk_rails_ede5754774 FOREIGN KEY (experiment_id) REFERENCES experiments(id) ON DELETE CASCADE; + ALTER TABLE ONLY ci_daily_build_group_report_results ADD CONSTRAINT fk_rails_ee072d13b3 FOREIGN KEY (last_pipeline_id) REFERENCES ci_pipelines(id) ON DELETE CASCADE; @@ -24590,6 +25307,9 @@ ALTER TABLE ONLY resource_label_events ALTER TABLE ONLY ci_builds_metadata ADD CONSTRAINT fk_rails_ffcf702a02 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; +ALTER TABLE ONLY services + ADD CONSTRAINT fk_services_inherit_from_id FOREIGN KEY (inherit_from_id) REFERENCES services(id) ON DELETE CASCADE; + ALTER TABLE ONLY timelogs ADD CONSTRAINT fk_timelogs_issues_issue_id FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE; |