diff options
Diffstat (limited to 'db')
211 files changed, 2964 insertions, 99 deletions
diff --git a/db/fixtures/development/25_api_personal_access_token.rb b/db/fixtures/development/25_api_personal_access_token.rb index 9b0427b3a88..1413f468be1 100644 --- a/db/fixtures/development/25_api_personal_access_token.rb +++ b/db/fixtures/development/25_api_personal_access_token.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require './spec/support/sidekiq_middleware' - # Create an api access token for root user with the value: token = 'ypCa3Dzb23o5nvsixwPA' scopes = Gitlab::Auth.all_available_scopes diff --git a/db/fixtures/development/30_composer_packages.rb b/db/fixtures/development/30_composer_packages.rb new file mode 100644 index 00000000000..fa8c648de9e --- /dev/null +++ b/db/fixtures/development/30_composer_packages.rb @@ -0,0 +1,121 @@ +# frozen_string_literal: true + +require './spec/support/sidekiq_middleware' + +class Gitlab::Seeder::ComposerPackages + def group + @group ||= Group.find_by(path: 'composer') + + unless @group + @group = Group.create!( + name: 'Composer', + path: 'composer', + description: FFaker::Lorem.sentence + ) + + @group.add_owner(user) + @group.create_namespace_settings + end + + @group + end + + def user + @user ||= User.first + end + + def create_real_project!(url) + project_path = url.split('/').last + + project_path.gsub!(".git", "") + + project = group.projects.find_by(name: project_path.titleize) + + return project if project.present? + + params = { + import_url: url, + namespace_id: group.id, + name: project_path.titleize, + description: FFaker::Lorem.sentence, + visibility_level: Gitlab::VisibilityLevel.values.sample, + skip_disk_validation: true + } + + Sidekiq::Worker.skipping_transaction_check do + project = ::Projects::CreateService.new(user, params).execute + + # Seed-Fu runs this entire fixture in a transaction, so the `after_commit` + # hook won't run until after the fixture is loaded. That is too late + # since the Sidekiq::Testing block has already exited. Force clearing + # the `after_commit` queue to ensure the job is run now. + project.send(:_run_after_commit_queue) + project.import_state.send(:_run_after_commit_queue) + + # Expire repository cache after import to ensure + # valid_repo? call below returns a correct answer + project.repository.expire_all_method_caches + end + + if project.valid? && project.valid_repo? + print '.' + return project + else + puts project.errors.full_messages + print 'F' + return nil + end + end +end + +COMPOSER_PACKAGES = { + 'https://github.com/php-fig/log.git' => [ + { branch: 'master' }, + { tag: 'v1.5.2' } + ], + 'https://github.com/ryssbowh/craft-themes.git' => [ + { tag: '1.0.2' } + ], + 'https://github.com/php-fig/http-message.git' => [ + { tag: '1.0.1' } + ], + 'https://github.com/doctrine/instantiator.git' => [ + { branch: '1.4.x' } + ] +}.freeze + +Gitlab::Seeder.quiet do + flag = 'SEED_COMPOSER' + + unless ENV[flag] + puts "Use the `#{flag}` environment variable to seed composer packages" + next + end + + Sidekiq::Testing.inline! do + COMPOSER_PACKAGES.each do |path, versions| + project = Gitlab::Seeder::ComposerPackages.new.create_real_project!(path) + + versions.each do |version| + params = {} + + if version[:branch] + params[:branch] = project.repository.find_branch(version[:branch]) + elsif version[:tag] + params[:tag] = project.repository.find_tag(version[:tag]) + end + + if params[:branch].nil? && params[:tag].nil? + puts "version #{version.inspect} not found" + next + end + + ::Packages::Composer::CreatePackageService + .new(project, project.owner, params) + .execute + + puts "version #{version.inspect} created!" + end + end + end +end diff --git a/db/migrate/20190225152525_add_auto_dev_ops_enabled_to_namespaces.rb b/db/migrate/20190225152525_add_auto_dev_ops_enabled_to_namespaces.rb index 93e7a84fb02..e4757b6bada 100644 --- a/db/migrate/20190225152525_add_auto_dev_ops_enabled_to_namespaces.rb +++ b/db/migrate/20190225152525_add_auto_dev_ops_enabled_to_namespaces.rb @@ -4,6 +4,6 @@ class AddAutoDevOpsEnabledToNamespaces < ActiveRecord::Migration[5.0] DOWNTIME = false def change - add_column :namespaces, :auto_devops_enabled, :boolean + add_column :namespaces, :auto_devops_enabled, :boolean # rubocop:disable Migration/AddColumnsToWideTables end end diff --git a/db/migrate/20190325080727_truncate_user_fullname.rb b/db/migrate/20190325080727_truncate_user_fullname.rb index e5f88671eef..29255d173d8 100644 --- a/db/migrate/20190325080727_truncate_user_fullname.rb +++ b/db/migrate/20190325080727_truncate_user_fullname.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # rubocop:disable Migration/UpdateLargeTable class TruncateUserFullname < ActiveRecord::Migration[5.0] include Gitlab::Database::MigrationHelpers diff --git a/db/migrate/20190606014128_add_last_ci_minutes_notification_at_to_namespaces.rb b/db/migrate/20190606014128_add_last_ci_minutes_notification_at_to_namespaces.rb index c264a23cda0..53b2e9f01fe 100644 --- a/db/migrate/20190606014128_add_last_ci_minutes_notification_at_to_namespaces.rb +++ b/db/migrate/20190606014128_add_last_ci_minutes_notification_at_to_namespaces.rb @@ -7,6 +7,6 @@ class AddLastCiMinutesNotificationAtToNamespaces < ActiveRecord::Migration[5.1] DOWNTIME = false def change - add_column :namespaces, :last_ci_minutes_notification_at, :datetime_with_timezone + add_column :namespaces, :last_ci_minutes_notification_at, :datetime_with_timezone # rubocop:disable Migration/AddColumnsToWideTables end end diff --git a/db/migrate/20190621022810_add_last_ci_minutes_usage_notification_level_to_namespaces.rb b/db/migrate/20190621022810_add_last_ci_minutes_usage_notification_level_to_namespaces.rb index 1611340284c..02e06703acc 100644 --- a/db/migrate/20190621022810_add_last_ci_minutes_usage_notification_level_to_namespaces.rb +++ b/db/migrate/20190621022810_add_last_ci_minutes_usage_notification_level_to_namespaces.rb @@ -4,6 +4,6 @@ class AddLastCiMinutesUsageNotificationLevelToNamespaces < ActiveRecord::Migrati DOWNTIME = false def change - add_column :namespaces, :last_ci_minutes_usage_notification_level, :integer + add_column :namespaces, :last_ci_minutes_usage_notification_level, :integer # rubocop:disable Migration/AddColumnsToWideTables end end diff --git a/db/migrate/20190626175626_add_group_creation_level_to_namespaces.rb b/db/migrate/20190626175626_add_group_creation_level_to_namespaces.rb index 3b75c92e518..6fcadc0c82c 100644 --- a/db/migrate/20190626175626_add_group_creation_level_to_namespaces.rb +++ b/db/migrate/20190626175626_add_group_creation_level_to_namespaces.rb @@ -6,7 +6,7 @@ class AddGroupCreationLevelToNamespaces < ActiveRecord::Migration[5.1] DOWNTIME = false def up - add_column(:namespaces, :subgroup_creation_level, :integer) + add_column(:namespaces, :subgroup_creation_level, :integer) # rubocop:disable Migration/AddColumnsToWideTables change_column_default(:namespaces, :subgroup_creation_level, ::Gitlab::Access::MAINTAINER_SUBGROUP_ACCESS) diff --git a/db/migrate/20190715215549_add_group_emails_disabled.rb b/db/migrate/20190715215549_add_group_emails_disabled.rb index d3fd4d2d923..63a815cb880 100644 --- a/db/migrate/20190715215549_add_group_emails_disabled.rb +++ b/db/migrate/20190715215549_add_group_emails_disabled.rb @@ -4,6 +4,6 @@ class AddGroupEmailsDisabled < ActiveRecord::Migration[5.2] DOWNTIME = false def change - add_column :namespaces, :emails_disabled, :boolean + add_column :namespaces, :emails_disabled, :boolean # rubocop:disable Migration/AddColumnsToWideTables end end diff --git a/db/migrate/20190828110802_add_not_null_constraints_to_prometheus_metrics_y_label_and_unit.rb b/db/migrate/20190828110802_add_not_null_constraints_to_prometheus_metrics_y_label_and_unit.rb index 6f3650ca966..1b238907af6 100644 --- a/db/migrate/20190828110802_add_not_null_constraints_to_prometheus_metrics_y_label_and_unit.rb +++ b/db/migrate/20190828110802_add_not_null_constraints_to_prometheus_metrics_y_label_and_unit.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddNotNullConstraintsToPrometheusMetricsYLabelAndUnit < ActiveRecord::Migration[5.2] DOWNTIME = false diff --git a/db/migrate/20190828172831_create_package_tag.rb b/db/migrate/20190828172831_create_package_tag.rb index 3d26b7ce602..a70b71db51d 100644 --- a/db/migrate/20190828172831_create_package_tag.rb +++ b/db/migrate/20190828172831_create_package_tag.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # frozen_string_literal: true . class CreatePackageTag < ActiveRecord::Migration[5.2] diff --git a/db/migrate/20190911115109_add_namespaces_max_pages_size.rb b/db/migrate/20190911115109_add_namespaces_max_pages_size.rb index c14dfa74a5a..d3054714188 100644 --- a/db/migrate/20190911115109_add_namespaces_max_pages_size.rb +++ b/db/migrate/20190911115109_add_namespaces_max_pages_size.rb @@ -4,6 +4,6 @@ class AddNamespacesMaxPagesSize < ActiveRecord::Migration[5.2] DOWNTIME = false def change - add_column :namespaces, :max_pages_size, :integer + add_column :namespaces, :max_pages_size, :integer # rubocop:disable Migration/AddColumnsToWideTables end end diff --git a/db/migrate/20190911115222_add_namespaces_max_artifacts_size.rb b/db/migrate/20190911115222_add_namespaces_max_artifacts_size.rb index 60c594c47a6..bec81d6c7e1 100644 --- a/db/migrate/20190911115222_add_namespaces_max_artifacts_size.rb +++ b/db/migrate/20190911115222_add_namespaces_max_artifacts_size.rb @@ -4,6 +4,6 @@ class AddNamespacesMaxArtifactsSize < ActiveRecord::Migration[5.2] DOWNTIME = false def change - add_column :namespaces, :max_artifacts_size, :integer + add_column :namespaces, :max_artifacts_size, :integer # rubocop:disable Migration/AddColumnsToWideTables end end diff --git a/db/migrate/20191003195218_add_pendo_enabled_to_application_settings.rb b/db/migrate/20191003195218_add_pendo_enabled_to_application_settings.rb index 29ae831d4f4..2d937327ca1 100644 --- a/db/migrate/20191003195218_add_pendo_enabled_to_application_settings.rb +++ b/db/migrate/20191003195218_add_pendo_enabled_to_application_settings.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddPendoEnabledToApplicationSettings < ActiveRecord::Migration[5.2] include Gitlab::Database::MigrationHelpers diff --git a/db/migrate/20191003195620_add_pendo_url_to_application_settings.rb b/db/migrate/20191003195620_add_pendo_url_to_application_settings.rb index 6763cb5544c..cbeb1ef5186 100644 --- a/db/migrate/20191003195620_add_pendo_url_to_application_settings.rb +++ b/db/migrate/20191003195620_add_pendo_url_to_application_settings.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddPendoUrlToApplicationSettings < ActiveRecord::Migration[5.2] include Gitlab::Database::MigrationHelpers diff --git a/db/migrate/20191114132259_add_mentions_disabled_to_namespaces.rb b/db/migrate/20191114132259_add_mentions_disabled_to_namespaces.rb index dbd69568ef2..a67d032795d 100644 --- a/db/migrate/20191114132259_add_mentions_disabled_to_namespaces.rb +++ b/db/migrate/20191114132259_add_mentions_disabled_to_namespaces.rb @@ -4,6 +4,6 @@ class AddMentionsDisabledToNamespaces < ActiveRecord::Migration[5.2] DOWNTIME = false def change - add_column :namespaces, :mentions_disabled, :boolean + add_column :namespaces, :mentions_disabled, :boolean # rubocop:disable Migration/AddColumnsToWideTables end end diff --git a/db/migrate/20191120200015_add_index_to_grafana_integrations.rb b/db/migrate/20191120200015_add_index_to_grafana_integrations.rb index 87292c86e97..c67f6850baf 100644 --- a/db/migrate/20191120200015_add_index_to_grafana_integrations.rb +++ b/db/migrate/20191120200015_add_index_to_grafana_integrations.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddIndexToGrafanaIntegrations < ActiveRecord::Migration[5.2] include Gitlab::Database::MigrationHelpers diff --git a/db/migrate/20200207062728_add_default_branch_protection_to_namespaces.rb b/db/migrate/20200207062728_add_default_branch_protection_to_namespaces.rb index 6eb650e6b6a..56a30b02290 100644 --- a/db/migrate/20200207062728_add_default_branch_protection_to_namespaces.rb +++ b/db/migrate/20200207062728_add_default_branch_protection_to_namespaces.rb @@ -7,7 +7,7 @@ class AddDefaultBranchProtectionToNamespaces < ActiveRecord::Migration[6.0] def up with_lock_retries do - add_column :namespaces, :default_branch_protection, :integer, limit: 2 + add_column :namespaces, :default_branch_protection, :integer, limit: 2 # rubocop:disable Migration/AddColumnsToWideTables end end diff --git a/db/migrate/20200229171700_create_custom_emojis.rb b/db/migrate/20200229171700_create_custom_emojis.rb index 1a60d7c8a63..f0574831f33 100644 --- a/db/migrate/20200229171700_create_custom_emojis.rb +++ b/db/migrate/20200229171700_create_custom_emojis.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CreateCustomEmojis < ActiveRecord::Migration[5.2] include Gitlab::Database::MigrationHelpers DOWNTIME = false diff --git a/db/migrate/20200304124406_add_unlock_membership_to_ldap_of_groups.rb b/db/migrate/20200304124406_add_unlock_membership_to_ldap_of_groups.rb index 2aa58c92c3e..19e6573af9b 100644 --- a/db/migrate/20200304124406_add_unlock_membership_to_ldap_of_groups.rb +++ b/db/migrate/20200304124406_add_unlock_membership_to_ldap_of_groups.rb @@ -7,7 +7,7 @@ class AddUnlockMembershipToLdapOfGroups < ActiveRecord::Migration[5.2] def up with_lock_retries do - add_column(:namespaces, :unlock_membership_to_ldap, :boolean) + add_column(:namespaces, :unlock_membership_to_ldap, :boolean) # rubocop:disable Migration/AddColumnsToWideTables end end diff --git a/db/migrate/20200323075043_add_max_personal_access_token_lifetime_to_namespaces.rb b/db/migrate/20200323075043_add_max_personal_access_token_lifetime_to_namespaces.rb index 907c832ce46..7388d6bbc13 100644 --- a/db/migrate/20200323075043_add_max_personal_access_token_lifetime_to_namespaces.rb +++ b/db/migrate/20200323075043_add_max_personal_access_token_lifetime_to_namespaces.rb @@ -7,7 +7,7 @@ class AddMaxPersonalAccessTokenLifetimeToNamespaces < ActiveRecord::Migration[6. def up with_lock_retries do - add_column :namespaces, :max_personal_access_token_lifetime, :integer + add_column :namespaces, :max_personal_access_token_lifetime, :integer # rubocop:disable Migration/AddColumnsToWideTables end end diff --git a/db/migrate/20200407120000_add_push_rule_id_to_groups.rb b/db/migrate/20200407120000_add_push_rule_id_to_groups.rb index 4b4e99052aa..738f0a4c605 100644 --- a/db/migrate/20200407120000_add_push_rule_id_to_groups.rb +++ b/db/migrate/20200407120000_add_push_rule_id_to_groups.rb @@ -7,7 +7,7 @@ class AddPushRuleIdToGroups < ActiveRecord::Migration[6.0] def up with_lock_retries do - add_column :namespaces, :push_rule_id, :bigint + add_column :namespaces, :push_rule_id, :bigint # rubocop:disable Migration/AddColumnsToWideTables end end diff --git a/db/migrate/20200424102023_add_shared_runners_enabled_and_override_to_namespaces.rb b/db/migrate/20200424102023_add_shared_runners_enabled_and_override_to_namespaces.rb index 2555a50be44..1adc421b9af 100644 --- a/db/migrate/20200424102023_add_shared_runners_enabled_and_override_to_namespaces.rb +++ b/db/migrate/20200424102023_add_shared_runners_enabled_and_override_to_namespaces.rb @@ -7,8 +7,8 @@ class AddSharedRunnersEnabledAndOverrideToNamespaces < ActiveRecord::Migration[6 def up with_lock_retries do - add_column :namespaces, :shared_runners_enabled, :boolean, default: true, null: false - add_column :namespaces, :allow_descendants_override_disabled_shared_runners, :boolean, default: false, null: false + add_column :namespaces, :shared_runners_enabled, :boolean, default: true, null: false # rubocop:disable Migration/AddColumnsToWideTables + add_column :namespaces, :allow_descendants_override_disabled_shared_runners, :boolean, default: false, null: false # rubocop:disable Migration/AddColumnsToWideTables end end diff --git a/db/migrate/20200609012539_add_traversal_ids_to_namespaces.rb b/db/migrate/20200609012539_add_traversal_ids_to_namespaces.rb index d7f282b69f8..3041d7a8e58 100644 --- a/db/migrate/20200609012539_add_traversal_ids_to_namespaces.rb +++ b/db/migrate/20200609012539_add_traversal_ids_to_namespaces.rb @@ -7,7 +7,7 @@ class AddTraversalIdsToNamespaces < ActiveRecord::Migration[6.0] def up with_lock_retries do - add_column :namespaces, :traversal_ids, :integer, array: true, default: [], null: false + add_column :namespaces, :traversal_ids, :integer, array: true, default: [], null: false # rubocop:disable Migration/AddColumnsToWideTables end end diff --git a/db/migrate/20200701190523_add_delayed_project_removal_to_namespaces.rb b/db/migrate/20200701190523_add_delayed_project_removal_to_namespaces.rb index 2d5bbc1cba1..fcc08723520 100644 --- a/db/migrate/20200701190523_add_delayed_project_removal_to_namespaces.rb +++ b/db/migrate/20200701190523_add_delayed_project_removal_to_namespaces.rb @@ -7,7 +7,7 @@ class AddDelayedProjectRemovalToNamespaces < ActiveRecord::Migration[6.0] def up with_lock_retries do - add_column :namespaces, :delayed_project_removal, :boolean, default: false, null: false + add_column :namespaces, :delayed_project_removal, :boolean, default: false, null: false # rubocop:disable Migration/AddColumnsToWideTables end end diff --git a/db/migrate/20201004163918_remove_project_id_and_id_index_from_vulnerabilities_table.rb b/db/migrate/20201004163918_remove_project_id_and_id_index_from_vulnerabilities_table.rb index 7a59e706bf3..73028b6b795 100644 --- a/db/migrate/20201004163918_remove_project_id_and_id_index_from_vulnerabilities_table.rb +++ b/db/migrate/20201004163918_remove_project_id_and_id_index_from_vulnerabilities_table.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class RemoveProjectIdAndIdIndexFromVulnerabilitiesTable < ActiveRecord::Migration[6.0] include Gitlab::Database::MigrationHelpers diff --git a/db/migrate/20201027101010_create_user_follow_users.rb b/db/migrate/20201027101010_create_user_follow_users.rb new file mode 100644 index 00000000000..7c1f831f3b2 --- /dev/null +++ b/db/migrate/20201027101010_create_user_follow_users.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +class CreateUserFollowUsers < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + execute <<~SQL + CREATE TABLE user_follow_users ( + follower_id integer not null references users (id) on delete cascade, + followee_id integer not null references users (id) on delete cascade, + PRIMARY KEY (follower_id, followee_id) + ); + CREATE INDEX ON user_follow_users (followee_id); + SQL + end + end + + def down + drop_table :user_follow_users + end +end diff --git a/db/migrate/20201108134919_add_finding_fingerprint_table.rb b/db/migrate/20201108134919_add_finding_fingerprint_table.rb new file mode 100644 index 00000000000..dd8ffe8e8aa --- /dev/null +++ b/db/migrate/20201108134919_add_finding_fingerprint_table.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +class AddFindingFingerprintTable < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + FINGERPRINT_IDX = :idx_vuln_fingerprints_on_occurrences_id_and_fingerprint + UNIQ_IDX = :idx_vuln_fingerprints_uniqueness + + def up + with_lock_retries do + create_table :vulnerability_finding_fingerprints do |t| + t.references :finding, + index: true, + null: false, + foreign_key: { to_table: :vulnerability_occurrences, column: :finding_id, on_delete: :cascade } + + t.timestamps_with_timezone null: false + + t.integer :algorithm_type, null: false + t.binary :fingerprint_sha256, null: false + + t.index %i[finding_id fingerprint_sha256], + name: FINGERPRINT_IDX, + unique: true # only one link should exist between occurrence and the fingerprint + + t.index %i[finding_id algorithm_type fingerprint_sha256], + name: UNIQ_IDX, + unique: true # these should be unique + end + end + end + + def down + with_lock_retries do + drop_table :vulnerability_finding_fingerprints + end + 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 index 157f0de0821..e944cee24e4 100644 --- a/db/migrate/20201109080646_create_vulnerability_findings_remediations_join_table.rb +++ b/db/migrate/20201109080646_create_vulnerability_findings_remediations_join_table.rb @@ -3,6 +3,7 @@ class CreateVulnerabilityFindingsRemediationsJoinTable < ActiveRecord::Migration[6.0] DOWNTIME = false + # rubocop:disable Migration/CreateTableWithForeignKeys def change create_table :vulnerability_findings_remediations do |t| t.references :vulnerability_occurrence, index: false, foreign_key: { on_delete: :cascade } @@ -13,4 +14,5 @@ class CreateVulnerabilityFindingsRemediationsJoinTable < ActiveRecord::Migration t.index [:vulnerability_occurrence_id, :vulnerability_remediation_id], unique: true, name: 'index_vulnerability_findings_remediations_on_unique_keys' end end + # rubocop:enable Migration/CreateTableWithForeignKeys end diff --git a/db/migrate/20201120092000_add_kroki_formats_to_application_settings_table.rb b/db/migrate/20201120092000_add_kroki_formats_to_application_settings_table.rb new file mode 100644 index 00000000000..a059099dbc4 --- /dev/null +++ b/db/migrate/20201120092000_add_kroki_formats_to_application_settings_table.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class AddKrokiFormatsToApplicationSettingsTable < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + change_table :application_settings do |t| + t.jsonb :kroki_formats, null: false, default: {} + end + end +end diff --git a/db/migrate/20201120144823_create_tokens_with_iv.rb b/db/migrate/20201120144823_create_tokens_with_iv.rb new file mode 100644 index 00000000000..f8dc75513fb --- /dev/null +++ b/db/migrate/20201120144823_create_tokens_with_iv.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class CreateTokensWithIv < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def change + create_table :token_with_ivs do |t| + t.binary :hashed_token, null: false + t.binary :hashed_plaintext_token, null: false + t.binary :iv, null: false + + t.index :hashed_token, name: 'index_token_with_ivs_on_hashed_token', unique: true, using: :btree + t.index :hashed_plaintext_token, name: 'index_token_with_ivs_on_hashed_plaintext_token', unique: true, using: :btree + end + end +end diff --git a/db/migrate/20201127104228_add_index_to_security_scans_on_created_at_and_id.rb b/db/migrate/20201127104228_add_index_to_security_scans_on_created_at_and_id.rb new file mode 100644 index 00000000000..c9bbe8ab77d --- /dev/null +++ b/db/migrate/20201127104228_add_index_to_security_scans_on_created_at_and_id.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddIndexToSecurityScansOnCreatedAtAndId < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INDEX_NAME = 'index_security_scans_on_date_created_at_and_id' + + disable_ddl_transaction! + + def up + add_concurrent_index :security_scans, "date(timezone('UTC', created_at)), id", name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name(:security_scans, INDEX_NAME) + end +end diff --git a/db/migrate/20201204111200_create_packages_debian_project_components.rb b/db/migrate/20201204111200_create_packages_debian_project_components.rb new file mode 100644 index 00000000000..76946967357 --- /dev/null +++ b/db/migrate/20201204111200_create_packages_debian_project_components.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +class CreatePackagesDebianProjectComponents < ActiveRecord::Migration[5.2] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + UNIQUE_NAME = 'uniq_pkgs_deb_proj_components_on_distribution_id_and_name' + + disable_ddl_transaction! + + def up + unless table_exists?(:packages_debian_project_components) + create_table :packages_debian_project_components do |t| + t.timestamps_with_timezone + t.references :distribution, + foreign_key: { to_table: :packages_debian_project_distributions, on_delete: :cascade }, + null: false, + index: false + t.text :name, null: false + + t.index %w(distribution_id name), + name: UNIQUE_NAME, + unique: true, + using: :btree + end + end + + add_text_limit :packages_debian_project_components, :name, 255 + end + + def down + drop_table :packages_debian_project_components + end +end diff --git a/db/migrate/20201204111300_create_packages_debian_group_components.rb b/db/migrate/20201204111300_create_packages_debian_group_components.rb new file mode 100644 index 00000000000..c69f8d10c2b --- /dev/null +++ b/db/migrate/20201204111300_create_packages_debian_group_components.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +class CreatePackagesDebianGroupComponents < ActiveRecord::Migration[5.2] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + UNIQUE_NAME = 'uniq_pkgs_deb_grp_components_on_distribution_id_and_name' + + disable_ddl_transaction! + + def up + unless table_exists?(:packages_debian_group_components) + create_table :packages_debian_group_components do |t| + t.timestamps_with_timezone + t.references :distribution, + foreign_key: { to_table: :packages_debian_group_distributions, on_delete: :cascade }, + null: false, + index: false + t.text :name, null: false + + t.index %w(distribution_id name), + name: UNIQUE_NAME, + unique: true, + using: :btree + end + end + + add_text_limit :packages_debian_group_components, :name, 255 + end + + def down + drop_table :packages_debian_group_components + end +end diff --git a/db/migrate/20201204111400_create_packages_debian_project_component_files.rb b/db/migrate/20201204111400_create_packages_debian_project_component_files.rb new file mode 100644 index 00000000000..74ee1e9c4cf --- /dev/null +++ b/db/migrate/20201204111400_create_packages_debian_project_component_files.rb @@ -0,0 +1,41 @@ +# frozen_string_literal: true + +class CreatePackagesDebianProjectComponentFiles < ActiveRecord::Migration[5.2] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + INDEX_ARCHITECTURE = 'idx_packages_debian_project_component_files_on_architecture_id' + + disable_ddl_transaction! + + def up + with_lock_retries do + unless table_exists?(:packages_debian_project_component_files) + create_table :packages_debian_project_component_files do |t| + t.timestamps_with_timezone + t.references :component, + foreign_key: { to_table: :packages_debian_project_components, on_delete: :restrict }, + null: false, + index: true + t.references :architecture, + foreign_key: { to_table: :packages_debian_project_architectures, on_delete: :restrict }, + index: { name: INDEX_ARCHITECTURE } + t.integer :size, null: false + t.integer :file_type, limit: 2, null: false + t.integer :compression_type, limit: 2 + t.integer :file_store, limit: 2, default: 1, null: false + t.text :file, null: false + t.binary :file_md5, null: false + t.binary :file_sha256, null: false + end + end + end + + add_text_limit :packages_debian_project_component_files, :file, 255 + end + + def down + drop_table :packages_debian_project_component_files + end +end diff --git a/db/migrate/20201204111500_create_packages_debian_group_component_files.rb b/db/migrate/20201204111500_create_packages_debian_group_component_files.rb new file mode 100644 index 00000000000..2592d5b108a --- /dev/null +++ b/db/migrate/20201204111500_create_packages_debian_group_component_files.rb @@ -0,0 +1,41 @@ +# frozen_string_literal: true + +class CreatePackagesDebianGroupComponentFiles < ActiveRecord::Migration[5.2] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + INDEX_ARCHITECTURE = 'idx_packages_debian_group_component_files_on_architecture_id' + + disable_ddl_transaction! + + def up + with_lock_retries do + unless table_exists?(:packages_debian_group_component_files) + create_table :packages_debian_group_component_files do |t| + t.timestamps_with_timezone + t.references :component, + foreign_key: { to_table: :packages_debian_group_components, on_delete: :restrict }, + null: false, + index: true + t.references :architecture, + foreign_key: { to_table: :packages_debian_group_architectures, on_delete: :restrict }, + index: { name: INDEX_ARCHITECTURE } + t.integer :size, null: false + t.integer :file_type, limit: 2, null: false + t.integer :compression_type, limit: 2 + t.integer :file_store, limit: 2, default: 1, null: false + t.text :file, null: false + t.binary :file_md5, null: false + t.binary :file_sha256, null: false + end + end + end + + add_text_limit :packages_debian_group_component_files, :file, 255 + end + + def down + drop_table :packages_debian_group_component_files + end +end diff --git a/db/migrate/20201204111600_create_packages_debian_publications.rb b/db/migrate/20201204111600_create_packages_debian_publications.rb new file mode 100644 index 00000000000..2fd26c2c367 --- /dev/null +++ b/db/migrate/20201204111600_create_packages_debian_publications.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class CreatePackagesDebianPublications < ActiveRecord::Migration[5.2] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def change + create_table :packages_debian_publications do |t| + t.references :package, + index: { unique: true }, + null: false, + foreign_key: { to_table: :packages_packages, on_delete: :cascade } + t.references :distribution, + null: false, + foreign_key: { to_table: :packages_debian_project_distributions, on_delete: :cascade } + end + end +end diff --git a/db/migrate/20201214000000_change_mr_allow_maintainer_to_push_default.rb b/db/migrate/20201214000000_change_mr_allow_maintainer_to_push_default.rb index 0d97d54f3e4..47eec16807b 100644 --- a/db/migrate/20201214000000_change_mr_allow_maintainer_to_push_default.rb +++ b/db/migrate/20201214000000_change_mr_allow_maintainer_to_push_default.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class ChangeMrAllowMaintainerToPushDefault < ActiveRecord::Migration[6.0] include Gitlab::Database::MigrationHelpers diff --git a/db/migrate/20201221225303_add_service_desk_reply_to_is_not_null_index_on_issues.rb b/db/migrate/20201221225303_add_service_desk_reply_to_is_not_null_index_on_issues.rb new file mode 100644 index 00000000000..fb5429af458 --- /dev/null +++ b/db/migrate/20201221225303_add_service_desk_reply_to_is_not_null_index_on_issues.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddServiceDeskReplyToIsNotNullIndexOnIssues < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INDEX_NAME = 'idx_on_issues_where_service_desk_reply_to_is_not_null' + + disable_ddl_transaction! + + def up + add_concurrent_index(:issues, [:id], name: INDEX_NAME, where: 'service_desk_reply_to IS NOT NULL') + end + + def down + remove_concurrent_index_by_name(:issues, INDEX_NAME) + end +end diff --git a/db/migrate/20210105052034_rename_asset_proxy_whitelist_on_application_settings.rb b/db/migrate/20210105052034_rename_asset_proxy_whitelist_on_application_settings.rb new file mode 100644 index 00000000000..cdfbd368070 --- /dev/null +++ b/db/migrate/20210105052034_rename_asset_proxy_whitelist_on_application_settings.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class RenameAssetProxyWhitelistOnApplicationSettings < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers::V2 + + DOWNTIME = false + + disable_ddl_transaction! + + def up + rename_column_concurrently :application_settings, + :asset_proxy_whitelist, + :asset_proxy_allowlist + end + + def down + undo_rename_column_concurrently :application_settings, + :asset_proxy_whitelist, + :asset_proxy_allowlist + end +end diff --git a/db/migrate/20210105153342_add_entity_columns_to_vulnerability_occurrences.rb b/db/migrate/20210105153342_add_entity_columns_to_vulnerability_occurrences.rb new file mode 100644 index 00000000000..3b5ffff7645 --- /dev/null +++ b/db/migrate/20210105153342_add_entity_columns_to_vulnerability_occurrences.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class AddEntityColumnsToVulnerabilityOccurrences < ActiveRecord::Migration[6.0] + DOWNTIME = false + + # rubocop:disable Migration/AddLimitToTextColumns + # limit is added in 20200501000002_add_text_limit_to_sprints_extended_title + def change + add_column :vulnerability_occurrences, :description, :text + add_column :vulnerability_occurrences, :message, :text + add_column :vulnerability_occurrences, :solution, :text + add_column :vulnerability_occurrences, :cve, :text + add_column :vulnerability_occurrences, :location, :jsonb + end + # rubocop:enable Migration/AddLimitToTextColumns +end diff --git a/db/migrate/20210105154321_add_text_limit_to_vulnerability_occurrences_entity_columns.rb b/db/migrate/20210105154321_add_text_limit_to_vulnerability_occurrences_entity_columns.rb new file mode 100644 index 00000000000..c2e138303d8 --- /dev/null +++ b/db/migrate/20210105154321_add_text_limit_to_vulnerability_occurrences_entity_columns.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +class AddTextLimitToVulnerabilityOccurrencesEntityColumns < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_text_limit :vulnerability_occurrences, :description, 15000 + add_text_limit :vulnerability_occurrences, :message, 3000 + add_text_limit :vulnerability_occurrences, :solution, 7000 + add_text_limit :vulnerability_occurrences, :cve, 48400 + end + + def down + remove_text_limit :vulnerability_occurrences, :description + remove_text_limit :vulnerability_occurrences, :message + remove_text_limit :vulnerability_occurrences, :solution + remove_text_limit :vulnerability_occurrences, :cve + end +end diff --git a/db/migrate/20210106155209_add_merge_request_diff_commit_trailers.rb b/db/migrate/20210106155209_add_merge_request_diff_commit_trailers.rb new file mode 100644 index 00000000000..906efa58bcd --- /dev/null +++ b/db/migrate/20210106155209_add_merge_request_diff_commit_trailers.rb @@ -0,0 +1,22 @@ +# 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 AddMergeRequestDiffCommitTrailers < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + add_column :merge_request_diff_commits, :trailers, :jsonb, default: {}, null: false + end + end + + def down + with_lock_retries do + remove_column :merge_request_diff_commits, :trailers + end + end +end diff --git a/db/migrate/20210106225424_add_keep_latest_artifacts_to_application_settings.rb b/db/migrate/20210106225424_add_keep_latest_artifacts_to_application_settings.rb new file mode 100644 index 00000000000..884159ddedb --- /dev/null +++ b/db/migrate/20210106225424_add_keep_latest_artifacts_to_application_settings.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class AddKeepLatestArtifactsToApplicationSettings < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + # This is named keep_latest_artifact for consistency with the project level setting but + # turning it on keeps all (multiple) artifacts on the latest pipeline per ref + add_column :application_settings, :keep_latest_artifact, :boolean, default: true, null: false + end +end diff --git a/db/migrate/20210107105306_add_diff_type_to_merge_request_diffs.rb b/db/migrate/20210107105306_add_diff_type_to_merge_request_diffs.rb new file mode 100644 index 00000000000..0b9b5e93054 --- /dev/null +++ b/db/migrate/20210107105306_add_diff_type_to_merge_request_diffs.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +class AddDiffTypeToMergeRequestDiffs < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + UNIQUE_INDEX_NAME = 'index_merge_request_diffs_on_unique_merge_request_id' + + def up + unless column_exists?(:merge_request_diffs, :diff_type) + with_lock_retries do + add_column :merge_request_diffs, :diff_type, :integer, null: false, limit: 2, default: 1 + end + end + + add_concurrent_index :merge_request_diffs, :merge_request_id, unique: true, where: 'diff_type = 2', name: UNIQUE_INDEX_NAME + end + + def down + remove_concurrent_index_by_name(:merge_request_diffs, UNIQUE_INDEX_NAME) + + if column_exists?(:merge_request_diffs, :diff_type) + with_lock_retries do + remove_column :merge_request_diffs, :diff_type + end + end + end +end diff --git a/db/migrate/20210107154615_add_merge_request_context_commit_trailers.rb b/db/migrate/20210107154615_add_merge_request_context_commit_trailers.rb new file mode 100644 index 00000000000..e7bd7c2ea56 --- /dev/null +++ b/db/migrate/20210107154615_add_merge_request_context_commit_trailers.rb @@ -0,0 +1,12 @@ +# 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 AddMergeRequestContextCommitTrailers < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + add_column :merge_request_context_commits, :trailers, :jsonb, default: {}, null: false + end +end diff --git a/db/migrate/20210111051045_create_dast_profiles.rb b/db/migrate/20210111051045_create_dast_profiles.rb new file mode 100644 index 00000000000..f2667e1222e --- /dev/null +++ b/db/migrate/20210111051045_create_dast_profiles.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +class CreateDastProfiles < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + table_comment = { owner: 'group::dynamic analysis', description: 'Profile used to run a DAST on-demand scan' } + + create_table_with_constraints :dast_profiles, comment: table_comment.to_json do |t| # rubocop:disable Migration/AddLimitToTextColumns + t.references :project, null: false, foreign_key: false, index: false + t.references :dast_site_profile, null: false, foreign_key: { on_delete: :cascade } + t.references :dast_scanner_profile, null: false, foreign_key: { on_delete: :cascade } + + t.timestamps_with_timezone + + # rubocop:disable Migration/AddLimitToTextColumns + t.text :name, null: false + t.text :description, null: false + # rubocop:enable Migration/AddLimitToTextColumns + + t.index [:project_id, :name], unique: true + + t.text_limit :name, 255 + t.text_limit :description, 255 + end + end + + def down + with_lock_retries do + drop_table :dast_profiles + end + end +end diff --git a/db/migrate/20210111053308_add_project_fk_for_dast_profile.rb b/db/migrate/20210111053308_add_project_fk_for_dast_profile.rb new file mode 100644 index 00000000000..5dc057b5f70 --- /dev/null +++ b/db/migrate/20210111053308_add_project_fk_for_dast_profile.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddProjectFkForDastProfile < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :dast_profiles, :projects, column: :project_id, on_delete: :cascade + end + + def down + with_lock_retries do + remove_foreign_key :dast_profiles, column: :project_id + end + end +end diff --git a/db/migrate/20210111075104_add_temporary_index_on_security_findings_scan_id.rb b/db/migrate/20210111075104_add_temporary_index_on_security_findings_scan_id.rb new file mode 100644 index 00000000000..a8f4e130f07 --- /dev/null +++ b/db/migrate/20210111075104_add_temporary_index_on_security_findings_scan_id.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddTemporaryIndexOnSecurityFindingsScanId < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INDEX_NAME = 'tmp_index_on_security_findings_scan_id' + + disable_ddl_transaction! + + def up + add_concurrent_index :security_findings, :scan_id, where: 'uuid is null', name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :security_findings, INDEX_NAME + end +end diff --git a/db/migrate/20210112202949_create_composer_cache_file.rb b/db/migrate/20210112202949_create_composer_cache_file.rb new file mode 100644 index 00000000000..b1c2a1608dd --- /dev/null +++ b/db/migrate/20210112202949_create_composer_cache_file.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +class CreateComposerCacheFile < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + # rubocop:disable Migration/AddLimitToTextColumns + create_table_with_constraints :packages_composer_cache_files do |t| + t.timestamps_with_timezone + + # record can be deleted after `delete_at` + t.datetime_with_timezone :delete_at + + # which namespace it belongs to + t.integer :namespace_id, null: true + + # file storage related fields + t.integer :file_store, limit: 2, null: false, default: 1 + t.text :file, null: false + t.binary :file_sha256, null: false + + t.index [:namespace_id, :file_sha256], name: "index_packages_composer_cache_namespace_and_sha", using: :btree, unique: true + t.foreign_key :namespaces, column: :namespace_id, on_delete: :nullify + + t.text_limit :file, 255 + end + end + + def down + drop_table :packages_composer_cache_files + end +end diff --git a/db/migrate/20210113224909_add_pipeline_configuration_full_path_to_compliance_pipeline.rb b/db/migrate/20210113224909_add_pipeline_configuration_full_path_to_compliance_pipeline.rb new file mode 100644 index 00000000000..408d0579031 --- /dev/null +++ b/db/migrate/20210113224909_add_pipeline_configuration_full_path_to_compliance_pipeline.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class AddPipelineConfigurationFullPathToCompliancePipeline < ActiveRecord::Migration[6.0] + DOWNTIME = false + + # rubocop:disable Migration/AddLimitToTextColumns + # limit is added in 20210119162812_add_text_limit_to_compliance_pipeline_configuration_full_path.rb + def up + add_column :compliance_management_frameworks, :pipeline_configuration_full_path, :text + end + # rubocop:enable Migration/AddLimitToTextColumns + + def down + remove_column :compliance_management_frameworks, :pipeline_configuration_full_path + end +end diff --git a/db/migrate/20210113231532_add_converted_at_to_experiment_subjects.rb b/db/migrate/20210113231532_add_converted_at_to_experiment_subjects.rb new file mode 100644 index 00000000000..25571b25af9 --- /dev/null +++ b/db/migrate/20210113231532_add_converted_at_to_experiment_subjects.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddConvertedAtToExperimentSubjects < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + add_column :experiment_subjects, :converted_at, :datetime_with_timezone + end +end diff --git a/db/migrate/20210113231546_add_context_to_experiment_subjects.rb b/db/migrate/20210113231546_add_context_to_experiment_subjects.rb new file mode 100644 index 00000000000..7fac45e9952 --- /dev/null +++ b/db/migrate/20210113231546_add_context_to_experiment_subjects.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddContextToExperimentSubjects < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + add_column :experiment_subjects, :context, :jsonb, default: {}, null: false + end +end diff --git a/db/migrate/20210114142443_add_indexes_to_onboarding_progresses.rb b/db/migrate/20210114142443_add_indexes_to_onboarding_progresses.rb new file mode 100644 index 00000000000..39964047e7f --- /dev/null +++ b/db/migrate/20210114142443_add_indexes_to_onboarding_progresses.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +class AddIndexesToOnboardingProgresses < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + CREATE_TRACK_INDEX_NAME = 'index_onboarding_progresses_for_create_track' + VERIFY_TRACK_INDEX_NAME = 'index_onboarding_progresses_for_verify_track' + TRIAL_TRACK_INDEX_NAME = 'index_onboarding_progresses_for_trial_track' + TEAM_TRACK_INDEX_NAME = 'index_onboarding_progresses_for_team_track' + + disable_ddl_transaction! + + def up + add_concurrent_index :onboarding_progresses, :created_at, where: 'git_write_at IS NULL', name: CREATE_TRACK_INDEX_NAME + add_concurrent_index :onboarding_progresses, :git_write_at, where: 'git_write_at IS NOT NULL AND pipeline_created_at IS NULL', name: VERIFY_TRACK_INDEX_NAME + add_concurrent_index :onboarding_progresses, 'GREATEST(git_write_at, pipeline_created_at)', where: 'git_write_at IS NOT NULL AND pipeline_created_at IS NOT NULL AND trial_started_at IS NULL', name: TRIAL_TRACK_INDEX_NAME + add_concurrent_index :onboarding_progresses, 'GREATEST(git_write_at, pipeline_created_at, trial_started_at)', where: 'git_write_at IS NOT NULL AND pipeline_created_at IS NOT NULL AND trial_started_at IS NOT NULL AND user_added_at IS NULL', name: TEAM_TRACK_INDEX_NAME + end + + def down + remove_concurrent_index_by_name :onboarding_progresses, CREATE_TRACK_INDEX_NAME + remove_concurrent_index_by_name :onboarding_progresses, VERIFY_TRACK_INDEX_NAME + remove_concurrent_index_by_name :onboarding_progresses, TRIAL_TRACK_INDEX_NAME + remove_concurrent_index_by_name :onboarding_progresses, TEAM_TRACK_INDEX_NAME + end +end diff --git a/db/migrate/20210115090452_create_group_repository_storage_move.rb b/db/migrate/20210115090452_create_group_repository_storage_move.rb new file mode 100644 index 00000000000..bd168dce5ac --- /dev/null +++ b/db/migrate/20210115090452_create_group_repository_storage_move.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +class CreateGroupRepositoryStorageMove < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + unless table_exists?(:group_repository_storage_moves) + with_lock_retries do + create_table :group_repository_storage_moves do |t| + t.timestamps_with_timezone + t.references :group, references: :namespace, column: :group_id, index: true, null: false + t.integer :state, limit: 2, default: 1, null: false + t.text :source_storage_name, null: false + t.text :destination_storage_name, null: false + + t.foreign_key :namespaces, column: :group_id, on_delete: :cascade + end + end + end + + add_text_limit(:group_repository_storage_moves, :source_storage_name, 255, constraint_name: 'group_repository_storage_moves_source_storage_name') + add_text_limit(:group_repository_storage_moves, :destination_storage_name, 255, constraint_name: 'group_repository_storage_moves_destination_storage_name') + end + + def down + with_lock_retries do + drop_table :group_repository_storage_moves + end + end +end diff --git a/db/migrate/20210117210226_add_has_external_issue_tracker_trigger.rb b/db/migrate/20210117210226_add_has_external_issue_tracker_trigger.rb new file mode 100644 index 00000000000..20fe0ee0fd1 --- /dev/null +++ b/db/migrate/20210117210226_add_has_external_issue_tracker_trigger.rb @@ -0,0 +1,61 @@ +# frozen_string_literal: true + +class AddHasExternalIssueTrackerTrigger < ActiveRecord::Migration[6.0] + include Gitlab::Database::SchemaHelpers + + DOWNTIME = false + FUNCTION_NAME = 'set_has_external_issue_tracker' + TRIGGER_ON_INSERT_NAME = 'trigger_has_external_issue_tracker_on_insert' + TRIGGER_ON_UPDATE_NAME = 'trigger_has_external_issue_tracker_on_update' + TRIGGER_ON_DELETE_NAME = 'trigger_has_external_issue_tracker_on_delete' + + def up + create_trigger_function(FUNCTION_NAME, replace: true) do + <<~SQL + UPDATE projects SET has_external_issue_tracker = ( + EXISTS + ( + SELECT 1 + FROM services + WHERE project_id = COALESCE(NEW.project_id, OLD.project_id) + AND active = TRUE + AND category = 'issue_tracker' + ) + ) + WHERE projects.id = COALESCE(NEW.project_id, OLD.project_id); + RETURN NULL; + SQL + end + + execute(<<~SQL) + CREATE TRIGGER #{TRIGGER_ON_INSERT_NAME} + AFTER INSERT ON services + FOR EACH ROW + WHEN (NEW.category = 'issue_tracker' AND NEW.active = TRUE AND NEW.project_id IS NOT NULL) + EXECUTE FUNCTION #{FUNCTION_NAME}(); + SQL + + execute(<<~SQL) + CREATE TRIGGER #{TRIGGER_ON_UPDATE_NAME} + AFTER UPDATE ON services + FOR EACH ROW + WHEN (NEW.category = 'issue_tracker' AND OLD.active != NEW.active AND NEW.project_id IS NOT NULL) + EXECUTE FUNCTION #{FUNCTION_NAME}(); + SQL + + execute(<<~SQL) + CREATE TRIGGER #{TRIGGER_ON_DELETE_NAME} + AFTER DELETE ON services + FOR EACH ROW + WHEN (OLD.category = 'issue_tracker' AND OLD.active = TRUE AND OLD.project_id IS NOT NULL) + EXECUTE FUNCTION #{FUNCTION_NAME}(); + SQL + end + + def down + drop_trigger(:services, TRIGGER_ON_INSERT_NAME) + drop_trigger(:services, TRIGGER_ON_UPDATE_NAME) + drop_trigger(:services, TRIGGER_ON_DELETE_NAME) + drop_function(FUNCTION_NAME) + end +end diff --git a/db/migrate/20210118111307_add_enforce_ssh_key_expiration_to_application_settings.rb b/db/migrate/20210118111307_add_enforce_ssh_key_expiration_to_application_settings.rb new file mode 100644 index 00000000000..fd1ed4f207b --- /dev/null +++ b/db/migrate/20210118111307_add_enforce_ssh_key_expiration_to_application_settings.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddEnforceSshKeyExpirationToApplicationSettings < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + add_column :application_settings, :enforce_ssh_key_expiration, :boolean, default: false, null: false + end +end diff --git a/db/migrate/20210119153801_add_proxy_settings_to_jira_tracker_data.rb b/db/migrate/20210119153801_add_proxy_settings_to_jira_tracker_data.rb new file mode 100644 index 00000000000..237ea25554d --- /dev/null +++ b/db/migrate/20210119153801_add_proxy_settings_to_jira_tracker_data.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class AddProxySettingsToJiraTrackerData < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + add_column :jira_tracker_data, :encrypted_proxy_address, :text + add_column :jira_tracker_data, :encrypted_proxy_address_iv, :text + add_column :jira_tracker_data, :encrypted_proxy_port, :text + add_column :jira_tracker_data, :encrypted_proxy_port_iv, :text + add_column :jira_tracker_data, :encrypted_proxy_username, :text + add_column :jira_tracker_data, :encrypted_proxy_username_iv, :text + add_column :jira_tracker_data, :encrypted_proxy_password, :text + add_column :jira_tracker_data, :encrypted_proxy_password_iv, :text + end +end diff --git a/db/migrate/20210119162812_add_text_limit_to_compliance_pipeline_configuration_full_path.rb b/db/migrate/20210119162812_add_text_limit_to_compliance_pipeline_configuration_full_path.rb new file mode 100644 index 00000000000..2958dc8d0ec --- /dev/null +++ b/db/migrate/20210119162812_add_text_limit_to_compliance_pipeline_configuration_full_path.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddTextLimitToCompliancePipelineConfigurationFullPath < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_text_limit :compliance_management_frameworks, :pipeline_configuration_full_path, 255 + end + + def down + remove_text_limit :compliance_management_frameworks, :pipeline_configuration_full_path + end +end diff --git a/db/migrate/20210120180956_extend_index_on_ci_builds_metadata.rb b/db/migrate/20210120180956_extend_index_on_ci_builds_metadata.rb new file mode 100644 index 00000000000..421a2fac1ae --- /dev/null +++ b/db/migrate/20210120180956_extend_index_on_ci_builds_metadata.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +class ExtendIndexOnCiBuildsMetadata < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + OLD_INDEX = :index_ci_builds_metadata_on_build_id_and_interruptible + NEW_INDEX = :index_ci_builds_metadata_on_build_id_and_id_and_interruptible + + TABLE = :ci_builds_metadata + + def up + create_covering_index(TABLE, NEW_INDEX) + + remove_concurrent_index_by_name TABLE, OLD_INDEX + end + + def down + add_concurrent_index TABLE, :build_id, where: 'interruptible = true', name: OLD_INDEX + + remove_concurrent_index_by_name TABLE, NEW_INDEX + end + + private + + def create_covering_index(table, name) + return if index_exists_by_name?(table, name) + + disable_statement_timeout do + execute <<~SQL + CREATE INDEX CONCURRENTLY #{name} + ON #{table} (build_id) INCLUDE (id) + WHERE interruptible = true + SQL + end + end +end diff --git a/db/migrate/20210120221743_delete_oauth_applications_tmp_index.rb b/db/migrate/20210120221743_delete_oauth_applications_tmp_index.rb new file mode 100644 index 00000000000..d29e63ba5da --- /dev/null +++ b/db/migrate/20210120221743_delete_oauth_applications_tmp_index.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class DeleteOauthApplicationsTmpIndex < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INDEX_NAME = 'tmp_index_oauth_applications_on_id_where_trusted' + + disable_ddl_transaction! + + def up + remove_concurrent_index_by_name :oauth_applications, INDEX_NAME + end + + def down + add_concurrent_index :oauth_applications, :id, where: 'trusted = true', name: INDEX_NAME + end +end diff --git a/db/migrate/20210121093618_remove_repository_read_only_to_groups.rb b/db/migrate/20210121093618_remove_repository_read_only_to_groups.rb new file mode 100644 index 00000000000..0b353ba5d88 --- /dev/null +++ b/db/migrate/20210121093618_remove_repository_read_only_to_groups.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +class RemoveRepositoryReadOnlyToGroups < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + if column_exists?(:namespaces, :repository_read_only) + with_lock_retries do + remove_column :namespaces, :repository_read_only # rubocop:disable Migration/RemoveColumn + end + end + end + + def down + unless column_exists?(:namespaces, :repository_read_only) + with_lock_retries do + add_column :namespaces, :repository_read_only, :boolean, default: false, null: false # rubocop:disable Migration/AddColumnsToWideTables + end + end + end +end diff --git a/db/migrate/20210121100038_add_devops_adoption_group_segment.rb b/db/migrate/20210121100038_add_devops_adoption_group_segment.rb new file mode 100644 index 00000000000..619657e7f56 --- /dev/null +++ b/db/migrate/20210121100038_add_devops_adoption_group_segment.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddDevopsAdoptionGroupSegment < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_column :analytics_devops_adoption_segments, :namespace_id, :integer, if_not_exists: true + add_concurrent_index :analytics_devops_adoption_segments, :namespace_id, unique: true + end + + def down + remove_column :analytics_devops_adoption_segments, :namespace_id + end +end diff --git a/db/migrate/20210121121102_optional_devops_adoption_segment_name.rb b/db/migrate/20210121121102_optional_devops_adoption_segment_name.rb new file mode 100644 index 00000000000..d7fda093cfc --- /dev/null +++ b/db/migrate/20210121121102_optional_devops_adoption_segment_name.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +class OptionalDevopsAdoptionSegmentName < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + INDEX_NAME = 'index_analytics_devops_adoption_segments_on_name' + + def up + change_column_null :analytics_devops_adoption_segments, :name, true + remove_concurrent_index_by_name :analytics_devops_adoption_segments, INDEX_NAME + end + + def down + transaction do + execute "DELETE FROM analytics_devops_adoption_segments WHERE name IS NULL" + change_column_null :analytics_devops_adoption_segments, :name, false + end + add_concurrent_index :analytics_devops_adoption_segments, :name, unique: true, name: INDEX_NAME + end +end diff --git a/db/migrate/20210122073805_add_repository_read_only_to_namespace_settings.rb b/db/migrate/20210122073805_add_repository_read_only_to_namespace_settings.rb new file mode 100644 index 00000000000..f6479bdb3a4 --- /dev/null +++ b/db/migrate/20210122073805_add_repository_read_only_to_namespace_settings.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddRepositoryReadOnlyToNamespaceSettings < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + add_column :namespace_settings, :repository_read_only, :boolean, default: false, null: false + end + end + + def down + with_lock_retries do + remove_column :namespace_settings, :repository_read_only + end + end +end diff --git a/db/migrate/20210122153259_add_state_to_merge_request_reviewers.rb b/db/migrate/20210122153259_add_state_to_merge_request_reviewers.rb new file mode 100644 index 00000000000..dd0c98615f7 --- /dev/null +++ b/db/migrate/20210122153259_add_state_to_merge_request_reviewers.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class AddStateToMergeRequestReviewers < ActiveRecord::Migration[6.0] + DOWNTIME = false + + REVIEW_DEFAULT_STATE = 0 + + def change + add_column :merge_request_reviewers, :state, :smallint, default: REVIEW_DEFAULT_STATE, null: false + end +end diff --git a/db/migrate/20210122155158_add_pipeline_step_to_bulk_imports_failures.rb b/db/migrate/20210122155158_add_pipeline_step_to_bulk_imports_failures.rb new file mode 100644 index 00000000000..749e0b16eaf --- /dev/null +++ b/db/migrate/20210122155158_add_pipeline_step_to_bulk_imports_failures.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +class AddPipelineStepToBulkImportsFailures < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + unless column_exists?(:bulk_import_failures, :pipeline_step, :text) + with_lock_retries do + add_column :bulk_import_failures, :pipeline_step, :text + end + end + + add_text_limit :bulk_import_failures, :pipeline_step, 255 + end + + def down + with_lock_retries do + remove_column :bulk_import_failures, :pipeline_step + end + end +end diff --git a/db/migrate/20210125105410_add_devops_adoption_segment_namespace_fk.rb b/db/migrate/20210125105410_add_devops_adoption_segment_namespace_fk.rb new file mode 100644 index 00000000000..c7c18ae69d0 --- /dev/null +++ b/db/migrate/20210125105410_add_devops_adoption_segment_namespace_fk.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddDevopsAdoptionSegmentNamespaceFk < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :analytics_devops_adoption_segments, :namespaces, column: :namespace_id + end + + def down + remove_foreign_key_if_exists :analytics_devops_adoption_segments, :namespaces, column: :namespace_id + end +end diff --git a/db/migrate/20210126030249_add_security_dashboard_access_level_into_project_features.rb b/db/migrate/20210126030249_add_security_dashboard_access_level_into_project_features.rb new file mode 100644 index 00000000000..cd325747282 --- /dev/null +++ b/db/migrate/20210126030249_add_security_dashboard_access_level_into_project_features.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class AddSecurityDashboardAccessLevelIntoProjectFeatures < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + PRIVATE_ACCESS_LEVEL = 10 + + def up + with_lock_retries do + add_column :project_features, :security_and_compliance_access_level, :integer, default: PRIVATE_ACCESS_LEVEL, null: false + end + end + + def down + with_lock_retries do + remove_column :project_features, :security_and_compliance_access_level + end + end +end diff --git a/db/migrate/20210126091713_add_unique_index_services_project_id_and_type.rb b/db/migrate/20210126091713_add_unique_index_services_project_id_and_type.rb new file mode 100644 index 00000000000..272dca70a8b --- /dev/null +++ b/db/migrate/20210126091713_add_unique_index_services_project_id_and_type.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddUniqueIndexServicesProjectIdAndType < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + INDEX_NAME = 'index_services_on_project_id_and_type_unique' + + def up + add_concurrent_index :services, [:project_id, :type], name: INDEX_NAME, unique: true + end + + def down + remove_concurrent_index_by_name :services, name: INDEX_NAME + end +end diff --git a/db/migrate/20210126092102_remove_index_services_project_id_and_type.rb b/db/migrate/20210126092102_remove_index_services_project_id_and_type.rb new file mode 100644 index 00000000000..49780d03b7b --- /dev/null +++ b/db/migrate/20210126092102_remove_index_services_project_id_and_type.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class RemoveIndexServicesProjectIdAndType < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + INDEX_NAME = 'index_services_on_project_id_and_type' + + # Replaced by the index added in 20210126091713_add_unique_index_services_project_id_and_type.rb + def up + remove_concurrent_index_by_name :services, name: INDEX_NAME + end + + def down + add_concurrent_index :services, [:project_id, :type], name: INDEX_NAME + end +end diff --git a/db/migrate/20210126233608_add_rubygems_max_file_size_to_plan_limits.rb b/db/migrate/20210126233608_add_rubygems_max_file_size_to_plan_limits.rb new file mode 100644 index 00000000000..e0e7e773d17 --- /dev/null +++ b/db/migrate/20210126233608_add_rubygems_max_file_size_to_plan_limits.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddRubygemsMaxFileSizeToPlanLimits < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + add_column :plan_limits, :rubygems_max_file_size, :bigint, default: 3.gigabytes, null: false + end +end diff --git a/db/migrate/20210127052226_add_subgroup_events_to_web_hooks.rb b/db/migrate/20210127052226_add_subgroup_events_to_web_hooks.rb new file mode 100644 index 00000000000..fe2b2ef412d --- /dev/null +++ b/db/migrate/20210127052226_add_subgroup_events_to_web_hooks.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddSubgroupEventsToWebHooks < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + add_column :web_hooks, :subgroup_events, :boolean, null: false, default: false + end +end diff --git a/db/migrate/20210127143025_add_oldest_merge_requests_index.rb b/db/migrate/20210127143025_add_oldest_merge_requests_index.rb new file mode 100644 index 00000000000..c25e12d89af --- /dev/null +++ b/db/migrate/20210127143025_add_oldest_merge_requests_index.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddOldestMergeRequestsIndex < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def up + # replaced by db/migrate/20210201140434_add_oldest_merge_requests_index_again.rb + end + + def down + # replaced by db/migrate/20210201140434_add_oldest_merge_requests_index_again.rb + end +end diff --git a/db/migrate/20210128044930_add_git_two_factor_session_expiry_to_application_settings.rb b/db/migrate/20210128044930_add_git_two_factor_session_expiry_to_application_settings.rb new file mode 100644 index 00000000000..77a1dd2131b --- /dev/null +++ b/db/migrate/20210128044930_add_git_two_factor_session_expiry_to_application_settings.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddGitTwoFactorSessionExpiryToApplicationSettings < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + add_column :application_settings, :git_two_factor_session_expiry, :integer, default: 15, null: false + end +end diff --git a/db/migrate/20210128101707_add_prevent_merge_without_jira_issue_to_project_settings.rb b/db/migrate/20210128101707_add_prevent_merge_without_jira_issue_to_project_settings.rb new file mode 100644 index 00000000000..18f186294f1 --- /dev/null +++ b/db/migrate/20210128101707_add_prevent_merge_without_jira_issue_to_project_settings.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddPreventMergeWithoutJiraIssueToProjectSettings < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + DOWNTIME = false + + def up + with_lock_retries do + add_column :project_settings, :prevent_merge_without_jira_issue, :boolean, null: false, default: false + end + end + + def down + with_lock_retries do + remove_column :project_settings, :prevent_merge_without_jira_issue + end + end +end diff --git a/db/migrate/20210128114526_add_auto_delete_at_to_environments.rb b/db/migrate/20210128114526_add_auto_delete_at_to_environments.rb new file mode 100644 index 00000000000..8f89c2f2ad0 --- /dev/null +++ b/db/migrate/20210128114526_add_auto_delete_at_to_environments.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddAutoDeleteAtToEnvironments < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + add_column :environments, :auto_delete_at, :datetime_with_timezone + end + end + + def down + with_lock_retries do + remove_column :environments, :auto_delete_at + end + end +end diff --git a/db/migrate/20210128140157_add_content_type_to_dependency_proxy_manifests.rb b/db/migrate/20210128140157_add_content_type_to_dependency_proxy_manifests.rb new file mode 100644 index 00000000000..d016e3c20e2 --- /dev/null +++ b/db/migrate/20210128140157_add_content_type_to_dependency_proxy_manifests.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +class AddContentTypeToDependencyProxyManifests < ActiveRecord::Migration[6.0] + DOWNTIME = false + + # rubocop:disable Migration/AddLimitToTextColumns + # limit is added in 20210128140232_add_text_limit_to_dependency_proxy_manifests_content_type.rb + def change + add_column :dependency_proxy_manifests, :content_type, :text + end + # rubocop:enable Migration/AddLimitToTextColumns +end diff --git a/db/migrate/20210128140232_add_text_limit_to_dependency_proxy_manifests_content_type.rb b/db/migrate/20210128140232_add_text_limit_to_dependency_proxy_manifests_content_type.rb new file mode 100644 index 00000000000..035e4795ce0 --- /dev/null +++ b/db/migrate/20210128140232_add_text_limit_to_dependency_proxy_manifests_content_type.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class AddTextLimitToDependencyProxyManifestsContentType < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_text_limit :dependency_proxy_manifests, :content_type, 255 + end + + def down + remove_text_limit :dependency_proxy_manifests, :content_type + end +end diff --git a/db/migrate/20210128152830_create_ci_namespace_monthly_usage.rb b/db/migrate/20210128152830_create_ci_namespace_monthly_usage.rb new file mode 100644 index 00000000000..d6ee057a56b --- /dev/null +++ b/db/migrate/20210128152830_create_ci_namespace_monthly_usage.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +class CreateCiNamespaceMonthlyUsage < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + with_lock_retries do + create_table :ci_namespace_monthly_usages, if_not_exists: true do |t| + t.references :namespace, index: false, null: false + t.date :date, null: false + t.integer :additional_amount_available, null: false, default: 0 + t.decimal :amount_used, null: false, default: 0.0, precision: 18, scale: 2 + + t.index [:namespace_id, :date], unique: true + end + end + + add_check_constraint :ci_namespace_monthly_usages, "(date = date_trunc('month', date))", 'ci_namespace_monthly_usages_year_month_constraint' + end + + def down + with_lock_retries do + drop_table :ci_namespace_monthly_usages + end + end +end diff --git a/db/migrate/20210129225244_add_index_to_oncall_shfts_on_starts_at_and_ends_at.rb b/db/migrate/20210129225244_add_index_to_oncall_shfts_on_starts_at_and_ends_at.rb new file mode 100644 index 00000000000..8285aceb24a --- /dev/null +++ b/db/migrate/20210129225244_add_index_to_oncall_shfts_on_starts_at_and_ends_at.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +class AddIndexToOncallShftsOnStartsAtAndEndsAt < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + NEW_NAME = 'index_oncall_shifts_on_rotation_id_and_starts_at_and_ends_at' + OLD_NAME = 'index_incident_management_oncall_shifts_on_rotation_id' + + def up + add_concurrent_index :incident_management_oncall_shifts, %i[rotation_id starts_at ends_at], name: NEW_NAME + + remove_concurrent_index_by_name :incident_management_oncall_shifts, OLD_NAME + end + + def down + add_concurrent_index :incident_management_oncall_shifts, :rotation_id, name: OLD_NAME + + remove_concurrent_index_by_name :incident_management_oncall_shifts, NEW_NAME + end +end diff --git a/db/migrate/20210201140434_add_oldest_merge_requests_index_again.rb b/db/migrate/20210201140434_add_oldest_merge_requests_index_again.rb new file mode 100644 index 00000000000..a3fed9e576a --- /dev/null +++ b/db/migrate/20210201140434_add_oldest_merge_requests_index_again.rb @@ -0,0 +1,59 @@ +# frozen_string_literal: true + +class AddOldestMergeRequestsIndexAgain < ActiveRecord::Migration[6.0] + include Gitlab::Database::SchemaHelpers + include Gitlab::Database::MigrationHelpers + + disable_ddl_transaction! + + DOWNTIME = false + + INDEX = 'index_on_merge_requests_for_latest_diffs' + + def up + execute "DROP INDEX CONCURRENTLY #{INDEX}" if invalid_index? + + return if index_exists_by_name?('merge_requests', INDEX) + + begin + disable_statement_timeout do + execute "CREATE INDEX CONCURRENTLY #{INDEX} ON merge_requests " \ + 'USING btree (target_project_id) INCLUDE (id, latest_merge_request_diff_id)' + end + rescue ActiveRecord::StatementInvalid => ex + # Due to https://github.com/lfittl/pg_query/issues/184, if the CREATE + # INDEX statement fails, we trigger a separate error due to the Gem not + # supporting the INCLUDE syntax. + # + # To work around this, we raise a custom error instead, as these won't + # have a query context injected. + raise "The index #{INDEX} couldn't be added: #{ex.message}" + end + + create_comment( + 'INDEX', + INDEX, + 'Index used to efficiently obtain the oldest merge request for a commit SHA' + ) + end + + def down + return unless index_exists_by_name?('merge_requests', INDEX) + + disable_statement_timeout do + execute "DROP INDEX CONCURRENTLY #{INDEX}" + end + end + + def invalid_index? + result = execute(<<~SQL) + SELECT pg_class.relname + FROM pg_class, pg_index + WHERE pg_index.indisvalid = false + AND pg_index.indexrelid = pg_class.oid + AND pg_class.relname = '#{INDEX}'; + SQL + + result.values.any? + end +end diff --git a/db/migrate/20210203002331_drop_backup_label_index.rb b/db/migrate/20210203002331_drop_backup_label_index.rb new file mode 100644 index 00000000000..430d2d0fb79 --- /dev/null +++ b/db/migrate/20210203002331_drop_backup_label_index.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class DropBackupLabelIndex < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + INDEX_NAME = 'backup_labels_project_id_title_idx' + + def up + remove_concurrent_index_by_name(:backup_labels, name: INDEX_NAME) + end + + def down + add_concurrent_index :backup_labels, [:project_id, :title], name: INDEX_NAME, unique: true, where: 'group_id = NULL::integer' + end +end diff --git a/db/migrate/20210203092540_remove_has_external_wiki_constraint.rb b/db/migrate/20210203092540_remove_has_external_wiki_constraint.rb new file mode 100644 index 00000000000..80b0cc11685 --- /dev/null +++ b/db/migrate/20210203092540_remove_has_external_wiki_constraint.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class RemoveHasExternalWikiConstraint < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + # This reverts the following migration: add_not_null_constraint :projects, :has_external_wiki, validate: false + if check_not_null_constraint_exists?(:projects, :has_external_wiki) + remove_not_null_constraint :projects, :has_external_wiki + end + end + + def down + # no-op + end +end diff --git a/db/migrate/20210203092549_restore_has_external_wiki_default_value.rb b/db/migrate/20210203092549_restore_has_external_wiki_default_value.rb new file mode 100644 index 00000000000..37111b370a5 --- /dev/null +++ b/db/migrate/20210203092549_restore_has_external_wiki_default_value.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +class RestoreHasExternalWikiDefaultValue < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + class TmpProject < ActiveRecord::Base + self.table_name = 'projects' + end + + # This reverts the following migration: change_column_default(:projects, :has_external_wiki, from: nil, to: false) + # We only change the column when the current default value is false + def up + # Find out the current default value + column = TmpProject.columns.find { |c| c.name == 'has_external_wiki' } + return unless column + + if column.default == 'false' + with_lock_retries do + change_column_default(:projects, :has_external_wiki, from: false, to: nil) + end + end + end + + def down + # no-op + end +end diff --git a/db/migrate/20210203221631_create_packages_rubygems_metadata.rb b/db/migrate/20210203221631_create_packages_rubygems_metadata.rb new file mode 100644 index 00000000000..f4ad5abf7e5 --- /dev/null +++ b/db/migrate/20210203221631_create_packages_rubygems_metadata.rb @@ -0,0 +1,69 @@ +# frozen_string_literal: true + +class CreatePackagesRubygemsMetadata < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + create_table_with_constraints :packages_rubygems_metadata, id: false do |t| + t.timestamps_with_timezone + t.references :package, primary_key: true, index: false, default: nil, null: false, foreign_key: { to_table: :packages_packages, on_delete: :cascade }, type: :bigint + t.text :authors + t.text :files + t.text :summary + + t.text :description + t.text :email + t.text :homepage + t.text :licenses + t.text :metadata + + t.text :author + t.text :bindir + t.text :cert_chain + t.text :executables + t.text :extensions + t.text :extra_rdoc_files + t.text :platform + t.text :post_install_message + t.text :rdoc_options + t.text :require_paths + t.text :required_ruby_version + t.text :required_rubygems_version + t.text :requirements + t.text :rubygems_version + t.text :signing_key + + t.text_limit :authors, 255 + t.text_limit :files, 255 + t.text_limit :summary, 1024 + + t.text_limit :description, 1024 + t.text_limit :email, 255 + t.text_limit :homepage, 255 + t.text_limit :licenses, 255 + t.text_limit :metadata, 255 + + t.text_limit :author, 255 + t.text_limit :bindir, 255 + t.text_limit :cert_chain, 255 + t.text_limit :executables, 255 + t.text_limit :extensions, 255 + t.text_limit :extra_rdoc_files, 255 + t.text_limit :platform, 255 + t.text_limit :post_install_message, 255 + t.text_limit :rdoc_options, 255 + t.text_limit :require_paths, 255 + t.text_limit :required_ruby_version, 255 + t.text_limit :required_rubygems_version, 255 + t.text_limit :requirements, 255 + t.text_limit :rubygems_version, 255 + t.text_limit :signing_key, 255 + end + end + + def down + drop_table :packages_rubygems_metadata + end +end diff --git a/db/migrate/20210203222620_add_expired_index_to_composer_cache_files.rb b/db/migrate/20210203222620_add_expired_index_to_composer_cache_files.rb new file mode 100644 index 00000000000..9c6a27812a5 --- /dev/null +++ b/db/migrate/20210203222620_add_expired_index_to_composer_cache_files.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddExpiredIndexToComposerCacheFiles < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + INDEX_NAME = 'composer_cache_files_index_on_deleted_at' + + def up + add_concurrent_index :packages_composer_cache_files, [:delete_at, :id], name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :packages_composer_cache_files, INDEX_NAME + end +end diff --git a/db/migrate/20210203223551_add_orphan_index_to_composer_cache_files.rb b/db/migrate/20210203223551_add_orphan_index_to_composer_cache_files.rb new file mode 100644 index 00000000000..e2853977e5f --- /dev/null +++ b/db/migrate/20210203223551_add_orphan_index_to_composer_cache_files.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddOrphanIndexToComposerCacheFiles < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + INDEX_NAME = 'index_composer_cache_files_where_namespace_id_is_null' + + def up + add_concurrent_index :packages_composer_cache_files, :id, name: INDEX_NAME, where: 'namespace_id IS NULL' + end + + def down + remove_concurrent_index_by_name :packages_composer_cache_files, INDEX_NAME + end +end diff --git a/db/migrate/20210204152257_add_status_to_packages_packages.rb b/db/migrate/20210204152257_add_status_to_packages_packages.rb new file mode 100644 index 00000000000..4fd441048c6 --- /dev/null +++ b/db/migrate/20210204152257_add_status_to_packages_packages.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddStatusToPackagesPackages < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + add_column :packages_packages, :status, :smallint, default: 0, null: false + end +end diff --git a/db/migrate/20210204212850_add_group_id_to_ci_daily_build_group_report_results.rb b/db/migrate/20210204212850_add_group_id_to_ci_daily_build_group_report_results.rb new file mode 100644 index 00000000000..ba0464f5ad6 --- /dev/null +++ b/db/migrate/20210204212850_add_group_id_to_ci_daily_build_group_report_results.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddGroupIdToCiDailyBuildGroupReportResults < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + add_column(:ci_daily_build_group_report_results, :group_id, :bigint) + end +end diff --git a/db/migrate/20210205084357_create_ci_project_monthly_usage.rb b/db/migrate/20210205084357_create_ci_project_monthly_usage.rb new file mode 100644 index 00000000000..c91bfa5ee1c --- /dev/null +++ b/db/migrate/20210205084357_create_ci_project_monthly_usage.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +class CreateCiProjectMonthlyUsage < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + with_lock_retries do + create_table :ci_project_monthly_usages, if_not_exists: true do |t| + t.references :project, foreign_key: { on_delete: :cascade }, index: false, null: false + t.date :date, null: false + t.decimal :amount_used, null: false, default: 0.0, precision: 18, scale: 2 + + t.index [:project_id, :date], unique: true + end + end + + add_check_constraint :ci_project_monthly_usages, "(date = date_trunc('month', date))", 'ci_project_monthly_usages_year_month_constraint' + end + + def down + with_lock_retries do + drop_table :ci_project_monthly_usages + end + end +end diff --git a/db/migrate/20210205143926_remove_namespace_id_foreign_key_on_namespace_onboarding_actions.rb b/db/migrate/20210205143926_remove_namespace_id_foreign_key_on_namespace_onboarding_actions.rb new file mode 100644 index 00000000000..6fe66430dd0 --- /dev/null +++ b/db/migrate/20210205143926_remove_namespace_id_foreign_key_on_namespace_onboarding_actions.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class RemoveNamespaceIdForeignKeyOnNamespaceOnboardingActions < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + remove_foreign_key :namespace_onboarding_actions, :namespaces + end + end + + def down + with_lock_retries do + add_foreign_key :namespace_onboarding_actions, :namespaces, on_delete: :cascade + end + end +end diff --git a/db/migrate/20210205213915_remove_foreign_keys_from_alerts_service_data.rb b/db/migrate/20210205213915_remove_foreign_keys_from_alerts_service_data.rb new file mode 100644 index 00000000000..1d539f783b4 --- /dev/null +++ b/db/migrate/20210205213915_remove_foreign_keys_from_alerts_service_data.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class RemoveForeignKeysFromAlertsServiceData < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + remove_foreign_key_if_exists :alerts_service_data, column: :service_id + end + end + + def down + with_lock_retries do + add_foreign_key :alerts_service_data, :services, column: :service_id, on_delete: :cascade + end + end +end diff --git a/db/migrate/20210208125050_add_status_expires_at_to_user_statuses.rb b/db/migrate/20210208125050_add_status_expires_at_to_user_statuses.rb new file mode 100644 index 00000000000..3ec1f6014a8 --- /dev/null +++ b/db/migrate/20210208125050_add_status_expires_at_to_user_statuses.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddStatusExpiresAtToUserStatuses < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + add_column(:user_statuses, :clear_status_at, :datetime_with_timezone, null: true) + end + end + + def down + with_lock_retries do + remove_column(:user_statuses, :clear_status_at) + end + end +end diff --git a/db/migrate/20210208125248_add_index_on_user_statuses_status_expires_at.rb b/db/migrate/20210208125248_add_index_on_user_statuses_status_expires_at.rb new file mode 100644 index 00000000000..98f3449c2e8 --- /dev/null +++ b/db/migrate/20210208125248_add_index_on_user_statuses_status_expires_at.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddIndexOnUserStatusesStatusExpiresAt < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INDEX_NAME = 'index_user_statuses_on_clear_status_at_not_null' + + disable_ddl_transaction! + + def up + add_concurrent_index(:user_statuses, :clear_status_at, name: INDEX_NAME, where: 'clear_status_at IS NOT NULL') + end + + def down + remove_concurrent_index_by_name(:user_statuses, INDEX_NAME) + end +end diff --git a/db/migrate/20210208144134_add_index_group_id_to_ci_daily_build_group_report_results.rb b/db/migrate/20210208144134_add_index_group_id_to_ci_daily_build_group_report_results.rb new file mode 100644 index 00000000000..422d8174043 --- /dev/null +++ b/db/migrate/20210208144134_add_index_group_id_to_ci_daily_build_group_report_results.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class AddIndexGroupIdToCiDailyBuildGroupReportResults < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INDEX_NAME = 'index_ci_daily_build_group_report_results_on_group_id' + + disable_ddl_transaction! + + def up + add_concurrent_index(:ci_daily_build_group_report_results, :group_id, name: INDEX_NAME) + add_concurrent_foreign_key(:ci_daily_build_group_report_results, :namespaces, column: :group_id) + end + + def down + remove_foreign_key_if_exists(:ci_daily_build_group_report_results, column: :group_id) + remove_concurrent_index_by_name(:ci_daily_build_group_report_results, INDEX_NAME) + end +end diff --git a/db/migrate/20210208161207_add_notes_create_limit_to_application_settings.rb b/db/migrate/20210208161207_add_notes_create_limit_to_application_settings.rb new file mode 100644 index 00000000000..4468da77e6c --- /dev/null +++ b/db/migrate/20210208161207_add_notes_create_limit_to_application_settings.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddNotesCreateLimitToApplicationSettings < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + add_column :application_settings, :notes_create_limit, :integer, default: 300, null: false + end +end diff --git a/db/migrate/20210209160510_create_security_orchestration_policy_configurations.rb b/db/migrate/20210209160510_create_security_orchestration_policy_configurations.rb new file mode 100644 index 00000000000..896593c803f --- /dev/null +++ b/db/migrate/20210209160510_create_security_orchestration_policy_configurations.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +class CreateSecurityOrchestrationPolicyConfigurations < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INDEX_PREFIX = 'index_sop_configs_' + + def up + table_comment = { owner: 'group::container security', description: 'Configuration used to store relationship between project and security policy repository' } + + create_table_with_constraints :security_orchestration_policy_configurations, comment: table_comment.to_json do |t| + t.references :project, null: false, foreign_key: { to_table: :projects, on_delete: :cascade }, index: { name: INDEX_PREFIX + 'on_project_id', unique: true } + t.references :security_policy_management_project, null: false, foreign_key: { to_table: :projects, on_delete: :restrict }, index: { name: INDEX_PREFIX + 'on_security_policy_management_project_id', unique: true } + + t.timestamps_with_timezone + end + end + + def down + with_lock_retries do + drop_table :security_orchestration_policy_configurations, force: :cascade + end + end +end diff --git a/db/migrate/20210209171525_add_status_index_to_packages_packages.rb b/db/migrate/20210209171525_add_status_index_to_packages_packages.rb new file mode 100644 index 00000000000..cb956165d6e --- /dev/null +++ b/db/migrate/20210209171525_add_status_index_to_packages_packages.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddStatusIndexToPackagesPackages < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + INDEX_NAME = 'index_packages_packages_on_project_id_and_status' + + def up + add_concurrent_index :packages_packages, [:project_id, :status], name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :packages_packages, name: INDEX_NAME + end +end diff --git a/db/migrate/20210210210232_add_notes_create_limit_allowlist_to_application_settings.rb b/db/migrate/20210210210232_add_notes_create_limit_allowlist_to_application_settings.rb new file mode 100644 index 00000000000..56feed3688c --- /dev/null +++ b/db/migrate/20210210210232_add_notes_create_limit_allowlist_to_application_settings.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddNotesCreateLimitAllowlistToApplicationSettings < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + add_column :application_settings, :notes_create_limit_allowlist, :text, array: true, default: [], null: false + end +end diff --git a/db/migrate/20210211195543_add_created_by_user_for_cluster_agent_token.rb b/db/migrate/20210211195543_add_created_by_user_for_cluster_agent_token.rb new file mode 100644 index 00000000000..94dc8192037 --- /dev/null +++ b/db/migrate/20210211195543_add_created_by_user_for_cluster_agent_token.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +class AddCreatedByUserForClusterAgentToken < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INDEX_NAME = 'index_cluster_agent_tokens_on_created_by_user_id' + + disable_ddl_transaction! + + def up + unless column_exists?(:cluster_agent_tokens, :created_by_user_id) + add_column :cluster_agent_tokens, :created_by_user_id, :bigint + end + + add_concurrent_index :cluster_agent_tokens, :created_by_user_id, name: INDEX_NAME + add_concurrent_foreign_key :cluster_agent_tokens, :users, column: :created_by_user_id, on_delete: :nullify + end + + def down + with_lock_retries do + remove_foreign_key_if_exists :cluster_agent_tokens, :users, column: :created_by_user_id + end + + remove_concurrent_index_by_name :cluster_agent_tokens, INDEX_NAME + remove_column :cluster_agent_tokens, :created_by_user_id + end +end diff --git a/db/migrate/20210216135504_add_created_by_to_cluster_agent.rb b/db/migrate/20210216135504_add_created_by_to_cluster_agent.rb new file mode 100644 index 00000000000..fd679a1c525 --- /dev/null +++ b/db/migrate/20210216135504_add_created_by_to_cluster_agent.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +class AddCreatedByToClusterAgent < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INDEX_NAME = 'index_cluster_agents_on_created_by_user_id' + + disable_ddl_transaction! + + def up + unless column_exists?(:cluster_agents, :created_by_user_id) + with_lock_retries do + add_column :cluster_agents, :created_by_user_id, :bigint + end + end + + add_concurrent_index :cluster_agents, :created_by_user_id, name: INDEX_NAME + add_concurrent_foreign_key :cluster_agents, :users, column: :created_by_user_id, on_delete: :nullify + end + + def down + with_lock_retries do + remove_column :cluster_agents, :created_by_user_id + end + end +end diff --git a/db/optional_migrations/composite_primary_keys.rb b/db/optional_migrations/composite_primary_keys.rb index 1fcb9664ff6..13bc58b8692 100644 --- a/db/optional_migrations/composite_primary_keys.rb +++ b/db/optional_migrations/composite_primary_keys.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # This migration adds a primary key constraint to tables # that only have a composite unique key. # diff --git a/db/post_migrate/20190214112022_schedule_sync_issuables_state_id.rb b/db/post_migrate/20190214112022_schedule_sync_issuables_state_id.rb index c05ad73d616..34536e22bbf 100644 --- a/db/post_migrate/20190214112022_schedule_sync_issuables_state_id.rb +++ b/db/post_migrate/20190214112022_schedule_sync_issuables_state_id.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class ScheduleSyncIssuablesStateId < ActiveRecord::Migration[5.0] # This migration schedules the sync of state_id for issues and merge requests # which are converting the state column from string to integer. diff --git a/db/post_migrate/20190606175050_encrypt_feature_flags_clients_tokens.rb b/db/post_migrate/20190606175050_encrypt_feature_flags_clients_tokens.rb index cb7d723670f..b8df41767f0 100644 --- a/db/post_migrate/20190606175050_encrypt_feature_flags_clients_tokens.rb +++ b/db/post_migrate/20190606175050_encrypt_feature_flags_clients_tokens.rb @@ -10,7 +10,7 @@ class EncryptFeatureFlagsClientsTokens < ActiveRecord::Migration[5.1] def up say_with_time("Encrypting tokens from operations_feature_flags_clients") do FeatureFlagsClient.where('token_encrypted is NULL AND token IS NOT NULL').find_each do |feature_flags_client| - token_encrypted = Gitlab::CryptoHelper.aes256_gcm_encrypt(feature_flags_client.token) + token_encrypted = Gitlab::CryptoHelper.aes256_gcm_encrypt(feature_flags_client.token, nonce: Gitlab::CryptoHelper::AES256_GCM_IV_STATIC) feature_flags_client.update!(token_encrypted: token_encrypted) end end diff --git a/db/post_migrate/20190711201818_encrypt_deploy_tokens_tokens.rb b/db/post_migrate/20190711201818_encrypt_deploy_tokens_tokens.rb index 2eb8d1ee11c..b2de98118b7 100644 --- a/db/post_migrate/20190711201818_encrypt_deploy_tokens_tokens.rb +++ b/db/post_migrate/20190711201818_encrypt_deploy_tokens_tokens.rb @@ -10,7 +10,7 @@ class EncryptDeployTokensTokens < ActiveRecord::Migration[5.1] def up say_with_time("Encrypting tokens from deploy_tokens") do DeploymentTokens.where('token_encrypted is NULL AND token IS NOT NULL').find_each(batch_size: 10000) do |deploy_token| - token_encrypted = Gitlab::CryptoHelper.aes256_gcm_encrypt(deploy_token.token) + token_encrypted = Gitlab::CryptoHelper.aes256_gcm_encrypt(deploy_token.token, nonce: Gitlab::CryptoHelper::AES256_GCM_IV_STATIC) deploy_token.update!(token_encrypted: token_encrypted) end end diff --git a/db/post_migrate/20200408132152_remove_namespaces_trial_ends_on.rb b/db/post_migrate/20200408132152_remove_namespaces_trial_ends_on.rb index cfe0daaf50f..a303b9d1869 100644 --- a/db/post_migrate/20200408132152_remove_namespaces_trial_ends_on.rb +++ b/db/post_migrate/20200408132152_remove_namespaces_trial_ends_on.rb @@ -18,7 +18,7 @@ class RemoveNamespacesTrialEndsOn < ActiveRecord::Migration[6.0] def down unless column_exists?(:namespaces, :trial_ends_on) with_lock_retries do - add_column :namespaces, :trial_ends_on, :datetime_with_timezone + add_column :namespaces, :trial_ends_on, :datetime_with_timezone # rubocop:disable Migration/AddColumnsToWideTables end end diff --git a/db/post_migrate/20200424043515_drop_namespaces_plan_id.rb b/db/post_migrate/20200424043515_drop_namespaces_plan_id.rb index 16a56b16e5a..b05f2da648a 100644 --- a/db/post_migrate/20200424043515_drop_namespaces_plan_id.rb +++ b/db/post_migrate/20200424043515_drop_namespaces_plan_id.rb @@ -16,7 +16,7 @@ class DropNamespacesPlanId < ActiveRecord::Migration[6.0] def down unless column_exists?(:namespaces, :plan_id) with_lock_retries do - add_column :namespaces, :plan_id, :integer + add_column :namespaces, :plan_id, :integer # rubocop:disable Migration/AddColumnsToWideTables 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 index 2cb7c9c5250..6a031c28ed7 100644 --- 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 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # # frozen_string_literal: true class ScheduleUpdateExistingUsersThatRequireTwoFactorAuth < ActiveRecord::Migration[6.0] diff --git a/db/post_migrate/20201112130710_schedule_remove_duplicate_vulnerabilities_findings.rb b/db/post_migrate/20201112130710_schedule_remove_duplicate_vulnerabilities_findings.rb new file mode 100644 index 00000000000..d05516bd255 --- /dev/null +++ b/db/post_migrate/20201112130710_schedule_remove_duplicate_vulnerabilities_findings.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +class ScheduleRemoveDuplicateVulnerabilitiesFindings < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + INDEX_NAME = 'tmp_idx_deduplicate_vulnerability_occurrences' + + MIGRATION = 'RemoveDuplicateVulnerabilitiesFindings' + DELAY_INTERVAL = 2.minutes.to_i + BATCH_SIZE = 5_000 + + disable_ddl_transaction! + + class VulnerabilitiesFinding < ActiveRecord::Base + include ::EachBatch + self.table_name = "vulnerability_occurrences" + end + + def up + add_concurrent_index :vulnerability_occurrences, + %i[project_id report_type location_fingerprint primary_identifier_id id], + name: INDEX_NAME + + say "Scheduling #{MIGRATION} jobs" + queue_background_migration_jobs_by_range_at_intervals( + VulnerabilitiesFinding, + MIGRATION, + DELAY_INTERVAL, + batch_size: BATCH_SIZE + ) + end + + def down + remove_concurrent_index_by_name(:vulnerability_occurrences, INDEX_NAME) + end +end diff --git a/db/post_migrate/20201128210234_schedule_populate_issue_email_participants.rb b/db/post_migrate/20201128210234_schedule_populate_issue_email_participants.rb new file mode 100644 index 00000000000..6fea683944c --- /dev/null +++ b/db/post_migrate/20201128210234_schedule_populate_issue_email_participants.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +class SchedulePopulateIssueEmailParticipants < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + BATCH_SIZE = 1_000 + DELAY_INTERVAL = 2.minutes + MIGRATION = 'PopulateIssueEmailParticipants' + + disable_ddl_transaction! + + class Issue < ActiveRecord::Base + include EachBatch + + self.table_name = 'issues' + end + + def up + queue_background_migration_jobs_by_range_at_intervals( + Issue.where.not(service_desk_reply_to: nil), + MIGRATION, + DELAY_INTERVAL, + batch_size: BATCH_SIZE + ) + end + + def down + # no-op + end +end diff --git a/db/post_migrate/20210105030125_cleanup_projects_with_bad_has_external_wiki_data.rb b/db/post_migrate/20210105030125_cleanup_projects_with_bad_has_external_wiki_data.rb new file mode 100644 index 00000000000..73725062bb3 --- /dev/null +++ b/db/post_migrate/20210105030125_cleanup_projects_with_bad_has_external_wiki_data.rb @@ -0,0 +1,88 @@ +# frozen_string_literal: true + +class CleanupProjectsWithBadHasExternalWikiData < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + TMP_INDEX_NAME = 'tmp_index_projects_on_id_where_has_external_wiki_is_true'.freeze + BATCH_SIZE = 100 + + disable_ddl_transaction! + + class Service < ActiveRecord::Base + include EachBatch + belongs_to :project + + self.table_name = 'services' + self.inheritance_column = :_type_disabled + end + + class Project < ActiveRecord::Base + include EachBatch + + self.table_name = 'projects' + end + + def up + update_projects_with_active_external_wikis + update_projects_without_active_external_wikis + end + + def down + # no-op : can't go back to incorrect data + end + + private + + def update_projects_with_active_external_wikis + # 11 projects are scoped in this query on GitLab.com. + scope = Service.where(active: true, type: 'ExternalWikiService').where.not(project_id: nil) + + scope.each_batch(of: BATCH_SIZE) do |relation| + scope_with_projects = relation + .joins(:project) + .select('project_id') + .merge(Project.where(has_external_wiki: false).where(pending_delete: false).where(archived: false)) + + execute(<<~SQL) + WITH project_ids_to_update (id) AS ( + #{scope_with_projects.to_sql} + ) + UPDATE projects SET has_external_wiki = true WHERE id IN (SELECT id FROM project_ids_to_update) + SQL + end + end + + def update_projects_without_active_external_wikis + # Add a temporary index to speed up the scoping of projects. + index_where = <<~SQL + ( + "projects"."has_external_wiki" = TRUE + ) + AND "projects"."pending_delete" = FALSE + AND "projects"."archived" = FALSE + SQL + + add_concurrent_index(:projects, :id, where: index_where, name: TMP_INDEX_NAME) + + services_sub_query = Service + .select('1') + .where('services.project_id = projects.id') + .where(type: 'ExternalWikiService') + .where(active: true) + + # 322 projects are scoped in this query on GitLab.com. + Project.where(index_where).each_batch(of: BATCH_SIZE) do |relation| + relation_with_exists_query = relation.where('NOT EXISTS (?)', services_sub_query) + execute(<<~SQL) + WITH project_ids_to_update (id) AS ( + #{relation_with_exists_query.select(:id).to_sql} + ) + UPDATE projects SET has_external_wiki = false WHERE id IN (SELECT id FROM project_ids_to_update) + SQL + end + + # Drop the temporary index. + remove_concurrent_index_by_name(:projects, TMP_INDEX_NAME) + end +end diff --git a/db/post_migrate/20210105052229_clean_up_asset_proxy_whitelist_rename_on_application_settings.rb b/db/post_migrate/20210105052229_clean_up_asset_proxy_whitelist_rename_on_application_settings.rb new file mode 100644 index 00000000000..8f6d312ae5e --- /dev/null +++ b/db/post_migrate/20210105052229_clean_up_asset_proxy_whitelist_rename_on_application_settings.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class CleanUpAssetProxyWhitelistRenameOnApplicationSettings < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers::V2 + + DOWNTIME = false + + disable_ddl_transaction! + + def up + cleanup_concurrent_column_rename :application_settings, + :asset_proxy_whitelist, + :asset_proxy_allowlist + end + + def down + undo_cleanup_concurrent_column_rename :application_settings, + :asset_proxy_whitelist, + :asset_proxy_allowlist + end +end diff --git a/db/post_migrate/20210111075105_schedule_uuid_population_for_security_findings.rb b/db/post_migrate/20210111075105_schedule_uuid_population_for_security_findings.rb new file mode 100644 index 00000000000..92241378495 --- /dev/null +++ b/db/post_migrate/20210111075105_schedule_uuid_population_for_security_findings.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +class ScheduleUuidPopulationForSecurityFindings < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + MIGRATION_CLASS = 'PopulateUuidsForSecurityFindings' + DELAY_INTERVAL = 2.minutes + BATCH_SIZE = 25 + + disable_ddl_transaction! + + def up + Gitlab::BackgroundMigration::PopulateUuidsForSecurityFindings.security_findings.each_batch(column: :scan_id, of: BATCH_SIZE) do |batch, index| + migrate_in( + DELAY_INTERVAL * index, + MIGRATION_CLASS, + batch.pluck(:scan_id) + ) + end + end + + def down + # no-op + end +end diff --git a/db/post_migrate/20210115220610_schedule_artifact_expiry_backfill.rb b/db/post_migrate/20210115220610_schedule_artifact_expiry_backfill.rb new file mode 100644 index 00000000000..44a76321495 --- /dev/null +++ b/db/post_migrate/20210115220610_schedule_artifact_expiry_backfill.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +class ScheduleArtifactExpiryBackfill < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + MIGRATION = 'BackfillArtifactExpiryDate'.freeze + SWITCH_DATE = Date.new(2020, 06, 22).freeze + INDEX_NAME = 'expired_artifacts_temp_index'.freeze + OLD_INDEX_CONDITION = "expire_at IS NULL AND created_at < '#{SWITCH_DATE}'" + INDEX_CONDITION = "expire_at IS NULL AND date(created_at AT TIME ZONE 'UTC') < '2020-06-22'::date".freeze + + disable_ddl_transaction! + + class JobArtifact < ActiveRecord::Base + include EachBatch + + self.table_name = 'ci_job_artifacts' + + scope :without_expiry_date, -> { where(expire_at: nil) } + scope :before_switch, -> { where("date(created_at AT TIME ZONE 'UTC') < ?::date", SWITCH_DATE) } + end + + def up + # Create temporary index for expired artifacts + # Needs to be removed in a later migration + remove_concurrent_index_by_name :ci_job_artifacts, INDEX_NAME + add_concurrent_index(:ci_job_artifacts, %i(id created_at), where: INDEX_CONDITION, name: INDEX_NAME) + + queue_background_migration_jobs_by_range_at_intervals( + JobArtifact.without_expiry_date.before_switch, + MIGRATION, + 2.minutes, + batch_size: 200_000 + ) + end + + def down + remove_concurrent_index_by_name :ci_job_artifacts, INDEX_NAME + add_concurrent_index(:ci_job_artifacts, %i(id created_at), where: OLD_INDEX_CONDITION, name: INDEX_NAME) + + Gitlab::BackgroundMigration.steal(MIGRATION) do |job| + job.delete + + false + end + end +end diff --git a/db/post_migrate/20210119122354_alter_vsa_issue_first_mentioned_in_commit_value.rb b/db/post_migrate/20210119122354_alter_vsa_issue_first_mentioned_in_commit_value.rb new file mode 100644 index 00000000000..132d72e180b --- /dev/null +++ b/db/post_migrate/20210119122354_alter_vsa_issue_first_mentioned_in_commit_value.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +class AlterVsaIssueFirstMentionedInCommitValue < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + ISSUE_FIRST_MENTIONED_IN_COMMIT_FOSS = 2 + ISSUE_FIRST_MENTIONED_IN_COMMIT_EE = 6 + + class GroupStage < ActiveRecord::Base + self.table_name = 'analytics_cycle_analytics_group_stages' + + include EachBatch + end + + def up + GroupStage.each_batch(of: 100) do |relation| + relation + .where(start_event_identifier: ISSUE_FIRST_MENTIONED_IN_COMMIT_EE) + .update_all(start_event_identifier: ISSUE_FIRST_MENTIONED_IN_COMMIT_FOSS) + + relation + .where(end_event_identifier: ISSUE_FIRST_MENTIONED_IN_COMMIT_EE) + .update_all(end_event_identifier: ISSUE_FIRST_MENTIONED_IN_COMMIT_FOSS) + end + end + + def down + # rollback is not needed, the identifier "6" is the same as identifier "2" on the application level + end +end diff --git a/db/post_migrate/20210203143131_migrate_existing_devops_segments_to_groups.rb b/db/post_migrate/20210203143131_migrate_existing_devops_segments_to_groups.rb new file mode 100644 index 00000000000..5267e0fd658 --- /dev/null +++ b/db/post_migrate/20210203143131_migrate_existing_devops_segments_to_groups.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +# Data migration to migrate multi-selection segments into separate segments. +# Both tables involved are pretty-low traffic and the number +# of records in DB cannot exceed 400 +class MigrateExistingDevopsSegmentsToGroups < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def up + Gitlab::BackgroundMigration::MigrateDevopsSegmentsToGroups.new.perform + end + + def down + end +end diff --git a/db/post_migrate/20210205104425_add_new_post_eoa_plans.rb b/db/post_migrate/20210205104425_add_new_post_eoa_plans.rb new file mode 100644 index 00000000000..d1a5afbd314 --- /dev/null +++ b/db/post_migrate/20210205104425_add_new_post_eoa_plans.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +class AddNewPostEoaPlans < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def up + execute "INSERT INTO plans (name, title, created_at, updated_at) VALUES ('premium', 'Premium (Formerly Silver)', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)" + execute "INSERT INTO plans (name, title, created_at, updated_at) VALUES ('ultimate', 'Ultimate (Formerly Gold)', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)" + end + + def down + execute "DELETE FROM plans WHERE name IN ('premium', 'ultimate')" + end +end diff --git a/db/post_migrate/20210205144537_remove_namespace_onboarding_actions_table.rb b/db/post_migrate/20210205144537_remove_namespace_onboarding_actions_table.rb new file mode 100644 index 00000000000..210b1d7822c --- /dev/null +++ b/db/post_migrate/20210205144537_remove_namespace_onboarding_actions_table.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +class RemoveNamespaceOnboardingActionsTable < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + drop_table :namespace_onboarding_actions + end + end + + def down + with_lock_retries do + create_table :namespace_onboarding_actions do |t| + t.references :namespace, index: true, null: false + t.datetime_with_timezone :created_at, null: false + t.integer :action, limit: 2, null: false + end + end + end +end diff --git a/db/post_migrate/20210205174154_remove_bad_dependency_proxy_manifests.rb b/db/post_migrate/20210205174154_remove_bad_dependency_proxy_manifests.rb new file mode 100644 index 00000000000..eb302fb7009 --- /dev/null +++ b/db/post_migrate/20210205174154_remove_bad_dependency_proxy_manifests.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class RemoveBadDependencyProxyManifests < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def up + # We run destroy on each record because we need the callback to remove + # the underlying files + DependencyProxy::Manifest.where.not(content_type: nil).destroy_all # rubocop:disable Cop/DestroyAll + end + + def down + # no op + end +end diff --git a/db/post_migrate/20210205213933_drop_alerts_service_data.rb b/db/post_migrate/20210205213933_drop_alerts_service_data.rb new file mode 100644 index 00000000000..6ad6c90290e --- /dev/null +++ b/db/post_migrate/20210205213933_drop_alerts_service_data.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +class DropAlertsServiceData < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + drop_table :alerts_service_data + end + end + + # rubocop:disable Migration/PreventStrings + def down + with_lock_retries do + create_table :alerts_service_data do |t| + t.bigint :service_id, null: false + t.timestamps_with_timezone + t.string :encrypted_token, limit: 255 + t.string :encrypted_token_iv, limit: 255 + end + end + end + # rubocop:enable Migration/PreventStrings +end diff --git a/db/post_migrate/20210205214003_remove_alerts_service_records_again.rb b/db/post_migrate/20210205214003_remove_alerts_service_records_again.rb new file mode 100644 index 00000000000..aabc6fc00cd --- /dev/null +++ b/db/post_migrate/20210205214003_remove_alerts_service_records_again.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class RemoveAlertsServiceRecordsAgain < ActiveRecord::Migration[6.0] + DOWNTIME = false + + disable_ddl_transaction! + + class Service < ActiveRecord::Base + self.table_name = 'services' + end + + def up + Service.delete_by(type: 'AlertsService') + end + + def down + # no-op + end +end diff --git a/db/post_migrate/20210210093901_backfill_updated_at_after_repository_storage_move.rb b/db/post_migrate/20210210093901_backfill_updated_at_after_repository_storage_move.rb new file mode 100644 index 00000000000..0631cc8095e --- /dev/null +++ b/db/post_migrate/20210210093901_backfill_updated_at_after_repository_storage_move.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +class BackfillUpdatedAtAfterRepositoryStorageMove < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + BATCH_SIZE = 10_000 + INTERVAL = 2.minutes + MIGRATION_CLASS = 'BackfillProjectUpdatedAtAfterRepositoryStorageMove' + + disable_ddl_transaction! + + class ProjectRepositoryStorageMove < ActiveRecord::Base + include EachBatch + + self.table_name = 'project_repository_storage_moves' + end + + def up + ProjectRepositoryStorageMove.reset_column_information + + ProjectRepositoryStorageMove.select(:project_id).distinct.each_batch(of: BATCH_SIZE, column: :project_id) do |batch, index| + migrate_in( + INTERVAL * index, + MIGRATION_CLASS, + batch.pluck(:project_id) + ) + end + end + + def down + # No-op + end +end diff --git a/db/schema_migrations/20201027101010 b/db/schema_migrations/20201027101010 new file mode 100644 index 00000000000..68628373757 --- /dev/null +++ b/db/schema_migrations/20201027101010 @@ -0,0 +1 @@ +d6b324e808265c4ba8b6216c77b7abfa96b4b8b4c9fbd8d0a15240548526c4f3
\ No newline at end of file diff --git a/db/schema_migrations/20201108134919 b/db/schema_migrations/20201108134919 new file mode 100644 index 00000000000..10e88ae9359 --- /dev/null +++ b/db/schema_migrations/20201108134919 @@ -0,0 +1 @@ +6643e5b4c5597d92c94115f392bfbd5cfce9884eb0bcb18f9629855f3711eed0
\ No newline at end of file diff --git a/db/schema_migrations/20201112130710 b/db/schema_migrations/20201112130710 new file mode 100644 index 00000000000..a13668cf3ce --- /dev/null +++ b/db/schema_migrations/20201112130710 @@ -0,0 +1 @@ +322d7270e942c161cc8b50b8c3f531c93b6e6e938e415c1b6010a70b630bf82e
\ No newline at end of file diff --git a/db/schema_migrations/20201120092000 b/db/schema_migrations/20201120092000 new file mode 100644 index 00000000000..eaa6c37cff2 --- /dev/null +++ b/db/schema_migrations/20201120092000 @@ -0,0 +1 @@ +c8f837a5fe7a1959af41f19f93b6dd96d8907a476626f124876ee8b10b120b71
\ No newline at end of file diff --git a/db/schema_migrations/20201120144823 b/db/schema_migrations/20201120144823 new file mode 100644 index 00000000000..4f0c5c43978 --- /dev/null +++ b/db/schema_migrations/20201120144823 @@ -0,0 +1 @@ +dde424c434c78e22087123fa30eec75c07268a9079fea44339915747aae235e0
\ No newline at end of file diff --git a/db/schema_migrations/20201127104228 b/db/schema_migrations/20201127104228 new file mode 100644 index 00000000000..9a582600854 --- /dev/null +++ b/db/schema_migrations/20201127104228 @@ -0,0 +1 @@ +a66f13cf62740c590aa195dd510f1e9f4a36e12d29fd0c824fbd0ace03717706
\ No newline at end of file diff --git a/db/schema_migrations/20201128210234 b/db/schema_migrations/20201128210234 new file mode 100644 index 00000000000..6c85130bf58 --- /dev/null +++ b/db/schema_migrations/20201128210234 @@ -0,0 +1 @@ +7c2f83a5821765f3657a6dd6f69bc8711a3b9388aec7335293748b883f7ab872
\ No newline at end of file diff --git a/db/schema_migrations/20201204111200 b/db/schema_migrations/20201204111200 new file mode 100644 index 00000000000..34628516bf8 --- /dev/null +++ b/db/schema_migrations/20201204111200 @@ -0,0 +1 @@ +2aad94b0577882df4fec3df3806993858dad9f4eb20db71c94f8590c6640d62e
\ No newline at end of file diff --git a/db/schema_migrations/20201204111300 b/db/schema_migrations/20201204111300 new file mode 100644 index 00000000000..69a114bed98 --- /dev/null +++ b/db/schema_migrations/20201204111300 @@ -0,0 +1 @@ +e1265a293640d0d067672cb0426987c4a308025cf5a15b17bac8e30267dc8eaf
\ No newline at end of file diff --git a/db/schema_migrations/20201204111400 b/db/schema_migrations/20201204111400 new file mode 100644 index 00000000000..54fcc022f10 --- /dev/null +++ b/db/schema_migrations/20201204111400 @@ -0,0 +1 @@ +6fcaa4184ae69fabd6f2668cad19c38a8ae7c187053d60cdf4fcbdbc0443aa42
\ No newline at end of file diff --git a/db/schema_migrations/20201204111500 b/db/schema_migrations/20201204111500 new file mode 100644 index 00000000000..d482fb6d31a --- /dev/null +++ b/db/schema_migrations/20201204111500 @@ -0,0 +1 @@ +3f422a916b50cafd46b4a7486b6c3cc0a9992831a7dbc40c51323c835d845a0a
\ No newline at end of file diff --git a/db/schema_migrations/20201204111600 b/db/schema_migrations/20201204111600 new file mode 100644 index 00000000000..d6c5e232962 --- /dev/null +++ b/db/schema_migrations/20201204111600 @@ -0,0 +1 @@ +51967d740ce184b27d0d9417fc86cb896fd3e3aa8a5e40759b290f47b9f3e99b
\ No newline at end of file diff --git a/db/schema_migrations/20201221225303 b/db/schema_migrations/20201221225303 new file mode 100644 index 00000000000..d1824217b99 --- /dev/null +++ b/db/schema_migrations/20201221225303 @@ -0,0 +1 @@ +06dcd1a1f4bc0598357d48d9a0e838d9af1cf078234f2aabaa53ff9df01d2c17
\ No newline at end of file diff --git a/db/schema_migrations/20210105030125 b/db/schema_migrations/20210105030125 new file mode 100644 index 00000000000..d2495a23b63 --- /dev/null +++ b/db/schema_migrations/20210105030125 @@ -0,0 +1 @@ +c5a780e5b5e62043fb04e77ebf89f7d04dfc9bfdc70df8d89c16a3f3fd960ea3
\ No newline at end of file diff --git a/db/schema_migrations/20210105052034 b/db/schema_migrations/20210105052034 new file mode 100644 index 00000000000..d2c1eacddf6 --- /dev/null +++ b/db/schema_migrations/20210105052034 @@ -0,0 +1 @@ +4eef64fb237f783cdb07e012356d48a4ec9afc349721de1c53cf3def95e83858
\ No newline at end of file diff --git a/db/schema_migrations/20210105052229 b/db/schema_migrations/20210105052229 new file mode 100644 index 00000000000..19b7f359482 --- /dev/null +++ b/db/schema_migrations/20210105052229 @@ -0,0 +1 @@ +ef994f0c65154825906fb0952b9b3073f4cb0692f01c90280edf06a4ea2ec339
\ No newline at end of file diff --git a/db/schema_migrations/20210105153342 b/db/schema_migrations/20210105153342 new file mode 100644 index 00000000000..cb970b9b3cc --- /dev/null +++ b/db/schema_migrations/20210105153342 @@ -0,0 +1 @@ +7a252c5d76c1e71421c3aa3e01584cdeeec6a5002ba6ef0824674c64f92e2764
\ No newline at end of file diff --git a/db/schema_migrations/20210105154321 b/db/schema_migrations/20210105154321 new file mode 100644 index 00000000000..2f7f2477526 --- /dev/null +++ b/db/schema_migrations/20210105154321 @@ -0,0 +1 @@ +9327676097c49bb1a221d79dd351ad8c57a434f19e32f49951c0d6d655c2fa4e
\ No newline at end of file diff --git a/db/schema_migrations/20210106155209 b/db/schema_migrations/20210106155209 new file mode 100644 index 00000000000..10dde1cf874 --- /dev/null +++ b/db/schema_migrations/20210106155209 @@ -0,0 +1 @@ +4aeff45663a9f5a41a8dd92298afb4b0b57aa6f190f4648455df2fa1e39e174f
\ No newline at end of file diff --git a/db/schema_migrations/20210106225424 b/db/schema_migrations/20210106225424 new file mode 100644 index 00000000000..84878ee30f4 --- /dev/null +++ b/db/schema_migrations/20210106225424 @@ -0,0 +1 @@ +a0561e52982756aded22563e833ab8005b4f45b84c81e872dd8c7188aeb84434
\ No newline at end of file diff --git a/db/schema_migrations/20210107105306 b/db/schema_migrations/20210107105306 new file mode 100644 index 00000000000..fe66a041837 --- /dev/null +++ b/db/schema_migrations/20210107105306 @@ -0,0 +1 @@ +f76ce27a82f4773dcda324d79cc93a044f21317dbb9fdff035879502b5752da3
\ No newline at end of file diff --git a/db/schema_migrations/20210107154615 b/db/schema_migrations/20210107154615 new file mode 100644 index 00000000000..f8b6f97d3fe --- /dev/null +++ b/db/schema_migrations/20210107154615 @@ -0,0 +1 @@ +3e867ceefcab4f043b89d3c04e6e0a1182423039e1a9245e611128efe77c0e88
\ No newline at end of file diff --git a/db/schema_migrations/20210111051045 b/db/schema_migrations/20210111051045 new file mode 100644 index 00000000000..842c164fc20 --- /dev/null +++ b/db/schema_migrations/20210111051045 @@ -0,0 +1 @@ +6075e469081fcca124c0c4b485071a086545b502c398314cca05052765072caf
\ No newline at end of file diff --git a/db/schema_migrations/20210111053308 b/db/schema_migrations/20210111053308 new file mode 100644 index 00000000000..b7968a03c32 --- /dev/null +++ b/db/schema_migrations/20210111053308 @@ -0,0 +1 @@ +a98ca25378df3fc798b6ae361b3a47b697f6b853796975221329db023cb98466
\ No newline at end of file diff --git a/db/schema_migrations/20210111075104 b/db/schema_migrations/20210111075104 new file mode 100644 index 00000000000..f0d8f6da529 --- /dev/null +++ b/db/schema_migrations/20210111075104 @@ -0,0 +1 @@ +3568bda1b43710880c8bfe2777d346aba1172217c27b5e690e7151aec9da2288
\ No newline at end of file diff --git a/db/schema_migrations/20210111075105 b/db/schema_migrations/20210111075105 new file mode 100644 index 00000000000..d058560ead2 --- /dev/null +++ b/db/schema_migrations/20210111075105 @@ -0,0 +1 @@ +d48f5e042f3f919041f0c93e6492bcf56c19f4268d4819bd231ddffe70ba7c6b
\ No newline at end of file diff --git a/db/schema_migrations/20210112202949 b/db/schema_migrations/20210112202949 new file mode 100644 index 00000000000..5926b701b1a --- /dev/null +++ b/db/schema_migrations/20210112202949 @@ -0,0 +1 @@ +56595e67e9e78a9558e6874d75bdcc295b89ab0096d1b37e4d9366e1574d241c
\ No newline at end of file diff --git a/db/schema_migrations/20210113224909 b/db/schema_migrations/20210113224909 new file mode 100644 index 00000000000..ab03538f520 --- /dev/null +++ b/db/schema_migrations/20210113224909 @@ -0,0 +1 @@ +e6841491cd7d2cc015fd628f5c14270720d59cbb17b7efb160937963f074f5c2
\ No newline at end of file diff --git a/db/schema_migrations/20210113231532 b/db/schema_migrations/20210113231532 new file mode 100644 index 00000000000..eb39ac161ba --- /dev/null +++ b/db/schema_migrations/20210113231532 @@ -0,0 +1 @@ +1a430ce6d137ee896cbd37bb822ccd18c9e87204b765b1192928dd82efb28602
\ No newline at end of file diff --git a/db/schema_migrations/20210113231546 b/db/schema_migrations/20210113231546 new file mode 100644 index 00000000000..3286727b72c --- /dev/null +++ b/db/schema_migrations/20210113231546 @@ -0,0 +1 @@ +5d7bbf376acbf5679d111866e70b69eebba26a487a9e7d6bd571f15dc423e3e3
\ No newline at end of file diff --git a/db/schema_migrations/20210114142443 b/db/schema_migrations/20210114142443 new file mode 100644 index 00000000000..d4e771a56f5 --- /dev/null +++ b/db/schema_migrations/20210114142443 @@ -0,0 +1 @@ +7ef5cb1f167c133c67fc98c0abe929516ec700179747d3353d19cf8219ebd0ef
\ No newline at end of file diff --git a/db/schema_migrations/20210115090452 b/db/schema_migrations/20210115090452 new file mode 100644 index 00000000000..92c5574e71f --- /dev/null +++ b/db/schema_migrations/20210115090452 @@ -0,0 +1 @@ +5415850ae27c507fd8b1df20951e25b42352f4f9ec8e1402019533170edabdb8
\ No newline at end of file diff --git a/db/schema_migrations/20210115220610 b/db/schema_migrations/20210115220610 new file mode 100644 index 00000000000..002c37e54ec --- /dev/null +++ b/db/schema_migrations/20210115220610 @@ -0,0 +1 @@ +541a6626d3afd4fd421fd59fe5eb8ab7764952ae780c83c3805fd4a29e3f42fb
\ No newline at end of file diff --git a/db/schema_migrations/20210117210226 b/db/schema_migrations/20210117210226 new file mode 100644 index 00000000000..a68f7f6d93e --- /dev/null +++ b/db/schema_migrations/20210117210226 @@ -0,0 +1 @@ +c0d22d00d52a516347930e1a36f350113c0949214925176f08ceed81999746bd
\ No newline at end of file diff --git a/db/schema_migrations/20210118111307 b/db/schema_migrations/20210118111307 new file mode 100644 index 00000000000..036d909f5ad --- /dev/null +++ b/db/schema_migrations/20210118111307 @@ -0,0 +1 @@ +f33cc3eebc9197db381d81150a140582e30905d3964d6fb444caad6c9eff1b31
\ No newline at end of file diff --git a/db/schema_migrations/20210119122354 b/db/schema_migrations/20210119122354 new file mode 100644 index 00000000000..a17b2dab2df --- /dev/null +++ b/db/schema_migrations/20210119122354 @@ -0,0 +1 @@ +e8264993f6503268cd99e8ca26ccdc0e986f31a2818b9bbef2a9cef36191e686
\ No newline at end of file diff --git a/db/schema_migrations/20210119153801 b/db/schema_migrations/20210119153801 new file mode 100644 index 00000000000..f84f7ad1d48 --- /dev/null +++ b/db/schema_migrations/20210119153801 @@ -0,0 +1 @@ +c8b5485f158fdec0ab6813e4014713786dfa231b901e77ea610a873d03f8f0f0
\ No newline at end of file diff --git a/db/schema_migrations/20210119162812 b/db/schema_migrations/20210119162812 new file mode 100644 index 00000000000..dfbf33a9fcf --- /dev/null +++ b/db/schema_migrations/20210119162812 @@ -0,0 +1 @@ +cd7643fc762d8b9236ef5ac7cc285ffbd29f1953178b9b6e129082efd7b9e07b
\ No newline at end of file diff --git a/db/schema_migrations/20210120180956 b/db/schema_migrations/20210120180956 new file mode 100644 index 00000000000..395c9c09df9 --- /dev/null +++ b/db/schema_migrations/20210120180956 @@ -0,0 +1 @@ +897815c347f04093da5eba420e95b6310454bd493412914e60a296bd710ebde1
\ No newline at end of file diff --git a/db/schema_migrations/20210120221743 b/db/schema_migrations/20210120221743 new file mode 100644 index 00000000000..ce54788b86c --- /dev/null +++ b/db/schema_migrations/20210120221743 @@ -0,0 +1 @@ +4bf1d277affdfa9ee772d69cb713f49f257140fb58c40bc8659d563b4cc3de29
\ No newline at end of file diff --git a/db/schema_migrations/20210121093618 b/db/schema_migrations/20210121093618 new file mode 100644 index 00000000000..f12566f1aa9 --- /dev/null +++ b/db/schema_migrations/20210121093618 @@ -0,0 +1 @@ +e2be30f71b2a4a410b21e57ee53c3b54cf0214a08bc65cd92b2cb4b93bde9451
\ No newline at end of file diff --git a/db/schema_migrations/20210121100038 b/db/schema_migrations/20210121100038 new file mode 100644 index 00000000000..0f9379ff019 --- /dev/null +++ b/db/schema_migrations/20210121100038 @@ -0,0 +1 @@ +12a5eba74f0bb5b63cddd32d32009ad073e638a9defb40eeee5c16f559ebe951
\ No newline at end of file diff --git a/db/schema_migrations/20210121121102 b/db/schema_migrations/20210121121102 new file mode 100644 index 00000000000..6bce3892276 --- /dev/null +++ b/db/schema_migrations/20210121121102 @@ -0,0 +1 @@ +359231b3f18a2c1e56ffba4872a51d01fd4ca834ef722e1133a5a9f01e4271e9
\ No newline at end of file diff --git a/db/schema_migrations/20210122073805 b/db/schema_migrations/20210122073805 new file mode 100644 index 00000000000..322c90eb820 --- /dev/null +++ b/db/schema_migrations/20210122073805 @@ -0,0 +1 @@ +f5231b1eec17ea1a67f2d2f4ca759314afb85b2c8fb431e3303d530d44bdb1ef
\ No newline at end of file diff --git a/db/schema_migrations/20210122153259 b/db/schema_migrations/20210122153259 new file mode 100644 index 00000000000..887f0ac4a5c --- /dev/null +++ b/db/schema_migrations/20210122153259 @@ -0,0 +1 @@ +4c697cc183a000ee8c18b516e4b1d77d0f8d2d3d7abe11121f2240a60c03216c
\ No newline at end of file diff --git a/db/schema_migrations/20210122155158 b/db/schema_migrations/20210122155158 new file mode 100644 index 00000000000..f521f910346 --- /dev/null +++ b/db/schema_migrations/20210122155158 @@ -0,0 +1 @@ +5f326f101ff06993e9160b0486d24d615abd6d5027b375e422f776181ad8a193
\ No newline at end of file diff --git a/db/schema_migrations/20210125105410 b/db/schema_migrations/20210125105410 new file mode 100644 index 00000000000..d685894bd8a --- /dev/null +++ b/db/schema_migrations/20210125105410 @@ -0,0 +1 @@ +0c80fa1c88f67ef34bbfab52b1b75eadc4a6f07557986f0fbe4ffd83e20df52a
\ No newline at end of file diff --git a/db/schema_migrations/20210126030249 b/db/schema_migrations/20210126030249 new file mode 100644 index 00000000000..068f5eeb9c5 --- /dev/null +++ b/db/schema_migrations/20210126030249 @@ -0,0 +1 @@ +b5c219d1b1443ddf482f26d8280a1c7318456affce3ad57a082eb8f9efc32206
\ No newline at end of file diff --git a/db/schema_migrations/20210126091713 b/db/schema_migrations/20210126091713 new file mode 100644 index 00000000000..b75636bd437 --- /dev/null +++ b/db/schema_migrations/20210126091713 @@ -0,0 +1 @@ +3906739d07514e6e59f79a4a81d28859a2481614a299c95ec1b1d9825a07ec64
\ No newline at end of file diff --git a/db/schema_migrations/20210126092102 b/db/schema_migrations/20210126092102 new file mode 100644 index 00000000000..803643389f6 --- /dev/null +++ b/db/schema_migrations/20210126092102 @@ -0,0 +1 @@ +124c5ae1a1ccade5dec01f72b726e03febc8f56411d7d8990f976bb2a9516037
\ No newline at end of file diff --git a/db/schema_migrations/20210126233608 b/db/schema_migrations/20210126233608 new file mode 100644 index 00000000000..adab3a3f365 --- /dev/null +++ b/db/schema_migrations/20210126233608 @@ -0,0 +1 @@ +4105ae45742c2eda67fe5c54256732e55555ab7832e4cbf0fcb041599c23bd29
\ No newline at end of file diff --git a/db/schema_migrations/20210127052226 b/db/schema_migrations/20210127052226 new file mode 100644 index 00000000000..ca7d44edff8 --- /dev/null +++ b/db/schema_migrations/20210127052226 @@ -0,0 +1 @@ +e978687e9b27db5288862ea85053f3fc04a8e841702b16ca17c01398a86654d0
\ No newline at end of file diff --git a/db/schema_migrations/20210127143025 b/db/schema_migrations/20210127143025 new file mode 100644 index 00000000000..a4875304c0b --- /dev/null +++ b/db/schema_migrations/20210127143025 @@ -0,0 +1 @@ +c173ba86340efe39977f1b319d1ebcead634e3bfe819a30e230fb4f81766f28a
\ No newline at end of file diff --git a/db/schema_migrations/20210128044930 b/db/schema_migrations/20210128044930 new file mode 100644 index 00000000000..4965cd9a9c6 --- /dev/null +++ b/db/schema_migrations/20210128044930 @@ -0,0 +1 @@ +6164ef91c60bd614310cbda6ad8ab1a205cae17c4d037fafa89eaf95d06323e4
\ No newline at end of file diff --git a/db/schema_migrations/20210128101707 b/db/schema_migrations/20210128101707 new file mode 100644 index 00000000000..f10f080c1df --- /dev/null +++ b/db/schema_migrations/20210128101707 @@ -0,0 +1 @@ +ae84fa35fcc5a0780d86887294a32e250d2ac13dcf607750f834df5828e5bece
\ No newline at end of file diff --git a/db/schema_migrations/20210128114526 b/db/schema_migrations/20210128114526 new file mode 100644 index 00000000000..107c86913ba --- /dev/null +++ b/db/schema_migrations/20210128114526 @@ -0,0 +1 @@ +ad83205a0203427ccad1c25933e28cf13ebfb0274865ce5f0f2d578e84bb07a3
\ No newline at end of file diff --git a/db/schema_migrations/20210128140157 b/db/schema_migrations/20210128140157 new file mode 100644 index 00000000000..2b71db39920 --- /dev/null +++ b/db/schema_migrations/20210128140157 @@ -0,0 +1 @@ +0fa84b2038f33e27e549bdb3eb137e1813f604b6e81abc67a49a54d3e1e4bcf5
\ No newline at end of file diff --git a/db/schema_migrations/20210128140232 b/db/schema_migrations/20210128140232 new file mode 100644 index 00000000000..ee335323fce --- /dev/null +++ b/db/schema_migrations/20210128140232 @@ -0,0 +1 @@ +93f337364eb5ca5c67f4d4767d1aee9972bfe0596c89f006317dd6103558e35c
\ No newline at end of file diff --git a/db/schema_migrations/20210128152830 b/db/schema_migrations/20210128152830 new file mode 100644 index 00000000000..36d3de788eb --- /dev/null +++ b/db/schema_migrations/20210128152830 @@ -0,0 +1 @@ +932509d18f1cfdfa09f1565e4ac2f197b7ca792263ff5da3e5b712fae7279925
\ No newline at end of file diff --git a/db/schema_migrations/20210129225244 b/db/schema_migrations/20210129225244 new file mode 100644 index 00000000000..1b05096b07f --- /dev/null +++ b/db/schema_migrations/20210129225244 @@ -0,0 +1 @@ +6cb54c71a9835ec1b3cf801a19c2cd385d224e0438c7924b6a29d298ecebe8a7
\ No newline at end of file diff --git a/db/schema_migrations/20210201140434 b/db/schema_migrations/20210201140434 new file mode 100644 index 00000000000..00671276b1c --- /dev/null +++ b/db/schema_migrations/20210201140434 @@ -0,0 +1 @@ +71220cfc36215f6c22d22d1fb0b74389e90c58733214b5fa36dcb8da0377a120
\ No newline at end of file diff --git a/db/schema_migrations/20210203002331 b/db/schema_migrations/20210203002331 new file mode 100644 index 00000000000..f1ed6bf23f6 --- /dev/null +++ b/db/schema_migrations/20210203002331 @@ -0,0 +1 @@ +b8a19b2ebf648a1b79a488a7a2847f6a392e594464c1ba0ae96f274f583559e3
\ No newline at end of file diff --git a/db/schema_migrations/20210203092540 b/db/schema_migrations/20210203092540 new file mode 100644 index 00000000000..12367417d44 --- /dev/null +++ b/db/schema_migrations/20210203092540 @@ -0,0 +1 @@ +fa0b69df96069dd29971f69a51ce4eb691480904c5693fa480f6daa83b042e77
\ No newline at end of file diff --git a/db/schema_migrations/20210203092549 b/db/schema_migrations/20210203092549 new file mode 100644 index 00000000000..967b0d3acc7 --- /dev/null +++ b/db/schema_migrations/20210203092549 @@ -0,0 +1 @@ +096d13548e156a13b9ccdbb39ed83b3be7ef64a57df5daea2e3cd870f3e2b448
\ No newline at end of file diff --git a/db/schema_migrations/20210203143131 b/db/schema_migrations/20210203143131 new file mode 100644 index 00000000000..6b318f8c219 --- /dev/null +++ b/db/schema_migrations/20210203143131 @@ -0,0 +1 @@ +1f05176d9f6a88e9d740000084b7c9f5c72c61a59dbe1f68f43b3b5606ecd9d8
\ No newline at end of file diff --git a/db/schema_migrations/20210203221631 b/db/schema_migrations/20210203221631 new file mode 100644 index 00000000000..ed9efcd2b5f --- /dev/null +++ b/db/schema_migrations/20210203221631 @@ -0,0 +1 @@ +ec6832ba26fca8d8427383cd0189765191a0a7f17bb78d61b900c5b541d5725e
\ No newline at end of file diff --git a/db/schema_migrations/20210203222620 b/db/schema_migrations/20210203222620 new file mode 100644 index 00000000000..2c8c3ffc111 --- /dev/null +++ b/db/schema_migrations/20210203222620 @@ -0,0 +1 @@ +6d3250533b72c6aa307570d386725fa3ebe1ec49c36edc0f7d6dc8a1d5092826
\ No newline at end of file diff --git a/db/schema_migrations/20210203223551 b/db/schema_migrations/20210203223551 new file mode 100644 index 00000000000..53b3a9f65aa --- /dev/null +++ b/db/schema_migrations/20210203223551 @@ -0,0 +1 @@ +4ccf450bbc9061edae81cabcfafd9360f1f57cfd25af3ad016fbbb344f9fe694
\ No newline at end of file diff --git a/db/schema_migrations/20210204152257 b/db/schema_migrations/20210204152257 new file mode 100644 index 00000000000..c98d4637d05 --- /dev/null +++ b/db/schema_migrations/20210204152257 @@ -0,0 +1 @@ +cb9f4b4e627cbc163653fc01c0542ef0ce87139b376c55bbaa4d7ab23e9b8973
\ No newline at end of file diff --git a/db/schema_migrations/20210204212850 b/db/schema_migrations/20210204212850 new file mode 100644 index 00000000000..ffa4ca8393e --- /dev/null +++ b/db/schema_migrations/20210204212850 @@ -0,0 +1 @@ +2a40acf9a3ac2716120388cfe79be13130e4587286d215596e9c75097af1e436
\ No newline at end of file diff --git a/db/schema_migrations/20210205084357 b/db/schema_migrations/20210205084357 new file mode 100644 index 00000000000..6babb782c70 --- /dev/null +++ b/db/schema_migrations/20210205084357 @@ -0,0 +1 @@ +5bd622f36126b06c7c585ee14a8140750843d36092e79b6cc35b62c06afb1178
\ No newline at end of file diff --git a/db/schema_migrations/20210205104425 b/db/schema_migrations/20210205104425 new file mode 100644 index 00000000000..c51f201b5a6 --- /dev/null +++ b/db/schema_migrations/20210205104425 @@ -0,0 +1 @@ +4df2229fca7652cb836c867b621da91f1194899c50bb0a8be2fbae58f29dc788
\ No newline at end of file diff --git a/db/schema_migrations/20210205143926 b/db/schema_migrations/20210205143926 new file mode 100644 index 00000000000..00a8c3528a7 --- /dev/null +++ b/db/schema_migrations/20210205143926 @@ -0,0 +1 @@ +cdf55e9f2b1b9c375920198a438d29fe3c9ab7147f3c670b0d66b11d499573d9
\ No newline at end of file diff --git a/db/schema_migrations/20210205144537 b/db/schema_migrations/20210205144537 new file mode 100644 index 00000000000..6ca27521248 --- /dev/null +++ b/db/schema_migrations/20210205144537 @@ -0,0 +1 @@ +d9cfb7515805e642c562b8be58b6cd482c24e62e76245db35a7d91b25c327d8d
\ No newline at end of file diff --git a/db/schema_migrations/20210205174154 b/db/schema_migrations/20210205174154 new file mode 100644 index 00000000000..fc8c4b6cff1 --- /dev/null +++ b/db/schema_migrations/20210205174154 @@ -0,0 +1 @@ +483d1b4a24086fa57efe7f3b3fa872cf793352f80aba5c25614f07eafa2d30c5
\ No newline at end of file diff --git a/db/schema_migrations/20210205213915 b/db/schema_migrations/20210205213915 new file mode 100644 index 00000000000..5849abd1d03 --- /dev/null +++ b/db/schema_migrations/20210205213915 @@ -0,0 +1 @@ +c7c2936062f4a7c764938453fb28dc2f461a06f0a21cc74b1750edbde9398fa1
\ No newline at end of file diff --git a/db/schema_migrations/20210205213933 b/db/schema_migrations/20210205213933 new file mode 100644 index 00000000000..f3ebb2672c7 --- /dev/null +++ b/db/schema_migrations/20210205213933 @@ -0,0 +1 @@ +caec7f6c66a0277561f650ae513fedaba581ab35bb238351eccccfef1132d118
\ No newline at end of file diff --git a/db/schema_migrations/20210205214003 b/db/schema_migrations/20210205214003 new file mode 100644 index 00000000000..4d1ea7570f5 --- /dev/null +++ b/db/schema_migrations/20210205214003 @@ -0,0 +1 @@ +6ca08c885fddccd3c82fc8651d20140655b65019e56f9c6136e92140401386d1
\ No newline at end of file diff --git a/db/schema_migrations/20210208125050 b/db/schema_migrations/20210208125050 new file mode 100644 index 00000000000..35877cfc029 --- /dev/null +++ b/db/schema_migrations/20210208125050 @@ -0,0 +1 @@ +b9200d6c754f7c450ba0c718171806e8f4f9720d870e532f4800640ca707f24f
\ No newline at end of file diff --git a/db/schema_migrations/20210208125248 b/db/schema_migrations/20210208125248 new file mode 100644 index 00000000000..91d5c4bb950 --- /dev/null +++ b/db/schema_migrations/20210208125248 @@ -0,0 +1 @@ +3a7fb1b7959f09b9ba464253a72d52bcb744e7f78aac4f44e1d9201fa3c8387d
\ No newline at end of file diff --git a/db/schema_migrations/20210208144134 b/db/schema_migrations/20210208144134 new file mode 100644 index 00000000000..1afe893eba0 --- /dev/null +++ b/db/schema_migrations/20210208144134 @@ -0,0 +1 @@ +845636d8a0c6e9b6b39194cb44ffeceea3464023c22fadb2a4da44fed5dd973f
\ No newline at end of file diff --git a/db/schema_migrations/20210208161207 b/db/schema_migrations/20210208161207 new file mode 100644 index 00000000000..7064a636822 --- /dev/null +++ b/db/schema_migrations/20210208161207 @@ -0,0 +1 @@ +818fcf0f0fec9d2833b091ef380005a2d485486522fb63e2a7b2fd01dbf1ff79
\ No newline at end of file diff --git a/db/schema_migrations/20210209160510 b/db/schema_migrations/20210209160510 new file mode 100644 index 00000000000..3aa90658d4e --- /dev/null +++ b/db/schema_migrations/20210209160510 @@ -0,0 +1 @@ +601d67a2911c461881064ec18a2246ef9e5b2835eb0fdf40e701c9360e19eca4
\ No newline at end of file diff --git a/db/schema_migrations/20210209171525 b/db/schema_migrations/20210209171525 new file mode 100644 index 00000000000..0c421b99a39 --- /dev/null +++ b/db/schema_migrations/20210209171525 @@ -0,0 +1 @@ +5c661c453922181b350b8551d9a8f9b097e568459a2c2d128e41d9aefb026ab5
\ No newline at end of file diff --git a/db/schema_migrations/20210210093901 b/db/schema_migrations/20210210093901 new file mode 100644 index 00000000000..c1bbb93de21 --- /dev/null +++ b/db/schema_migrations/20210210093901 @@ -0,0 +1 @@ +961c147e9c8e35eac5b8dd33f879582e173b7f6e31659b2d00989bc38afc6f5a
\ No newline at end of file diff --git a/db/schema_migrations/20210210210232 b/db/schema_migrations/20210210210232 new file mode 100644 index 00000000000..96f31a2adef --- /dev/null +++ b/db/schema_migrations/20210210210232 @@ -0,0 +1 @@ +e1bd58eeaf63caf473680a8c4b7269cc63e7c0d6e8d4e71636608e10c9731c85
\ No newline at end of file diff --git a/db/schema_migrations/20210211195543 b/db/schema_migrations/20210211195543 new file mode 100644 index 00000000000..7f15ca21d36 --- /dev/null +++ b/db/schema_migrations/20210211195543 @@ -0,0 +1 @@ +484338ddc83bfb44523d08da92ac7f5b9d13e1a66ad1c9c3f7590f91fc9305c0
\ No newline at end of file diff --git a/db/schema_migrations/20210216135504 b/db/schema_migrations/20210216135504 new file mode 100644 index 00000000000..99cda90b2ee --- /dev/null +++ b/db/schema_migrations/20210216135504 @@ -0,0 +1 @@ +8c676b4142db828b1d2d5dc6bd891eb929d12ab13e9073693ab7d830bcea599a
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index c1f13a2fca4..97a2850fd5c 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -10,6 +10,26 @@ CREATE EXTENSION IF NOT EXISTS btree_gist; CREATE EXTENSION IF NOT EXISTS pg_trgm; +CREATE FUNCTION set_has_external_issue_tracker() RETURNS trigger + LANGUAGE plpgsql + AS $$ +BEGIN +UPDATE projects SET has_external_issue_tracker = ( + EXISTS + ( + SELECT 1 + FROM services + WHERE project_id = COALESCE(NEW.project_id, OLD.project_id) + AND active = TRUE + AND category = 'issue_tracker' + ) +) +WHERE projects.id = COALESCE(NEW.project_id, OLD.project_id); +RETURN NULL; + +END +$$; + CREATE FUNCTION set_has_external_wiki() RETURNS trigger LANGUAGE plpgsql AS $$ @@ -8865,24 +8885,6 @@ CREATE SEQUENCE alert_management_http_integrations_id_seq ALTER SEQUENCE alert_management_http_integrations_id_seq OWNED BY alert_management_http_integrations.id; -CREATE TABLE alerts_service_data ( - id bigint NOT NULL, - service_id integer NOT NULL, - created_at timestamp with time zone NOT NULL, - updated_at timestamp with time zone NOT NULL, - encrypted_token character varying(255), - encrypted_token_iv character varying(255) -); - -CREATE SEQUENCE alerts_service_data_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - -ALTER SEQUENCE alerts_service_data_id_seq OWNED BY alerts_service_data.id; - CREATE TABLE allowed_email_domains ( id bigint NOT NULL, created_at timestamp with time zone NOT NULL, @@ -8988,10 +8990,11 @@ ALTER SEQUENCE analytics_devops_adoption_segment_selections_id_seq OWNED BY anal CREATE TABLE analytics_devops_adoption_segments ( id bigint NOT NULL, - name text NOT NULL, + name text, last_recorded_at timestamp with time zone, created_at timestamp with time zone NOT NULL, updated_at timestamp with time zone NOT NULL, + namespace_id integer, CONSTRAINT check_4be7a006fd CHECK ((char_length(name) <= 255)) ); @@ -9273,7 +9276,6 @@ CREATE TABLE application_settings ( instance_administration_project_id bigint, asset_proxy_enabled boolean DEFAULT false NOT NULL, asset_proxy_url character varying, - asset_proxy_whitelist text, encrypted_asset_proxy_secret_key text, encrypted_asset_proxy_secret_key_iv character varying, static_objects_external_storage_url character varying(255), @@ -9390,6 +9392,13 @@ CREATE TABLE application_settings ( rate_limiting_response_text text, invisible_captcha_enabled boolean DEFAULT false NOT NULL, container_registry_cleanup_tags_service_max_list_size integer DEFAULT 200 NOT NULL, + enforce_ssh_key_expiration boolean DEFAULT false NOT NULL, + git_two_factor_session_expiry integer DEFAULT 15 NOT NULL, + asset_proxy_allowlist text, + keep_latest_artifact boolean DEFAULT true NOT NULL, + notes_create_limit integer DEFAULT 300 NOT NULL, + notes_create_limit_allowlist text[] DEFAULT '{}'::text[] NOT NULL, + kroki_formats jsonb DEFAULT '{}'::jsonb NOT NULL, CONSTRAINT app_settings_container_reg_cleanup_tags_max_list_size_positive CHECK ((container_registry_cleanup_tags_service_max_list_size >= 0)), 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)), @@ -10054,8 +10063,10 @@ CREATE TABLE bulk_import_failures ( exception_class text NOT NULL, exception_message text NOT NULL, correlation_id_value text, + pipeline_step text, CONSTRAINT check_053d65c7a4 CHECK ((char_length(pipeline_class) <= 255)), CONSTRAINT check_6eca8f972e CHECK ((char_length(exception_message) <= 255)), + CONSTRAINT check_721a422375 CHECK ((char_length(pipeline_step) <= 255)), CONSTRAINT check_c7dba8398e CHECK ((char_length(exception_class) <= 255)), CONSTRAINT check_e787285882 CHECK ((char_length(correlation_id_value) <= 255)) ); @@ -10355,7 +10366,8 @@ CREATE TABLE ci_daily_build_group_report_results ( ref_path text NOT NULL, group_name text NOT NULL, data jsonb NOT NULL, - default_branch boolean DEFAULT false NOT NULL + default_branch boolean DEFAULT false NOT NULL, + group_id bigint ); CREATE SEQUENCE ci_daily_build_group_report_results_id_seq @@ -10495,6 +10507,24 @@ CREATE SEQUENCE ci_job_variables_id_seq ALTER SEQUENCE ci_job_variables_id_seq OWNED BY ci_job_variables.id; +CREATE TABLE ci_namespace_monthly_usages ( + id bigint NOT NULL, + namespace_id bigint NOT NULL, + date date NOT NULL, + additional_amount_available integer DEFAULT 0 NOT NULL, + amount_used numeric(18,2) DEFAULT 0.0 NOT NULL, + CONSTRAINT ci_namespace_monthly_usages_year_month_constraint CHECK ((date = date_trunc('month'::text, (date)::timestamp with time zone))) +); + +CREATE SEQUENCE ci_namespace_monthly_usages_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE ci_namespace_monthly_usages_id_seq OWNED BY ci_namespace_monthly_usages.id; + CREATE TABLE ci_pipeline_artifacts ( id bigint NOT NULL, created_at timestamp with time zone NOT NULL, @@ -10692,6 +10722,23 @@ CREATE SEQUENCE ci_platform_metrics_id_seq ALTER SEQUENCE ci_platform_metrics_id_seq OWNED BY ci_platform_metrics.id; +CREATE TABLE ci_project_monthly_usages ( + id bigint NOT NULL, + project_id bigint NOT NULL, + date date NOT NULL, + amount_used numeric(18,2) DEFAULT 0.0 NOT NULL, + CONSTRAINT ci_project_monthly_usages_year_month_constraint CHECK ((date = date_trunc('month'::text, (date)::timestamp with time zone))) +); + +CREATE SEQUENCE ci_project_monthly_usages_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE ci_project_monthly_usages_id_seq OWNED BY ci_project_monthly_usages.id; + CREATE TABLE ci_refs ( id bigint NOT NULL, project_id bigint NOT NULL, @@ -10978,6 +11025,7 @@ CREATE TABLE cluster_agent_tokens ( updated_at timestamp with time zone NOT NULL, agent_id bigint NOT NULL, token_encrypted text NOT NULL, + created_by_user_id bigint, CONSTRAINT check_c60daed227 CHECK ((char_length(token_encrypted) <= 255)) ); @@ -10996,6 +11044,7 @@ CREATE TABLE cluster_agents ( updated_at timestamp with time zone NOT NULL, project_id bigint NOT NULL, name text NOT NULL, + created_by_user_id bigint, CONSTRAINT check_3498369510 CHECK ((char_length(name) <= 255)) ); @@ -11437,9 +11486,11 @@ CREATE TABLE compliance_management_frameworks ( color text NOT NULL, namespace_id integer NOT NULL, regulated boolean DEFAULT true NOT NULL, + pipeline_configuration_full_path text, CONSTRAINT check_08cd34b2c2 CHECK ((char_length(color) <= 10)), CONSTRAINT check_1617e0b87e CHECK ((char_length(description) <= 255)), - CONSTRAINT check_ab00bc2193 CHECK ((char_length(name) <= 255)) + CONSTRAINT check_ab00bc2193 CHECK ((char_length(name) <= 255)), + CONSTRAINT check_e7a9972435 CHECK ((char_length(pipeline_configuration_full_path) <= 255)) ); CREATE SEQUENCE compliance_management_frameworks_id_seq @@ -11569,6 +11620,30 @@ CREATE SEQUENCE custom_emoji_id_seq ALTER SEQUENCE custom_emoji_id_seq OWNED BY custom_emoji.id; +CREATE TABLE dast_profiles ( + id bigint NOT NULL, + project_id bigint NOT NULL, + dast_site_profile_id bigint NOT NULL, + dast_scanner_profile_id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + name text NOT NULL, + description text NOT NULL, + CONSTRAINT check_5fcf73bf61 CHECK ((char_length(name) <= 255)), + CONSTRAINT check_c34e505c24 CHECK ((char_length(description) <= 255)) +); + +COMMENT ON TABLE dast_profiles IS '{"owner":"group::dynamic analysis","description":"Profile used to run a DAST on-demand scan"}'; + +CREATE SEQUENCE dast_profiles_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE dast_profiles_id_seq OWNED BY dast_profiles.id; + CREATE TABLE dast_scanner_profiles ( id bigint NOT NULL, created_at timestamp with time zone NOT NULL, @@ -11725,7 +11800,9 @@ CREATE TABLE dependency_proxy_manifests ( file_name text NOT NULL, file text NOT NULL, digest text NOT NULL, + content_type text, CONSTRAINT check_079b293a7b CHECK ((char_length(file) <= 255)), + CONSTRAINT check_167a9a8a91 CHECK ((char_length(content_type) <= 255)), CONSTRAINT check_c579e3f586 CHECK ((char_length(file_name) <= 255)), CONSTRAINT check_f5d9996bf1 CHECK ((char_length(digest) <= 255)) ); @@ -12057,7 +12134,8 @@ CREATE TABLE environments ( environment_type character varying, state character varying DEFAULT 'available'::character varying NOT NULL, slug character varying NOT NULL, - auto_stop_at timestamp with time zone + auto_stop_at timestamp with time zone, + auto_delete_at timestamp with time zone ); CREATE SEQUENCE environments_id_seq @@ -12215,6 +12293,8 @@ CREATE TABLE experiment_subjects ( variant smallint DEFAULT 0 NOT NULL, created_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, CONSTRAINT chk_has_one_subject CHECK ((num_nonnulls(user_id, group_id, project_id) = 1)) ); @@ -12998,6 +13078,27 @@ CREATE TABLE group_merge_request_approval_settings ( allow_author_approval boolean DEFAULT false NOT NULL ); +CREATE TABLE group_repository_storage_moves ( + 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, + state smallint DEFAULT 1 NOT NULL, + source_storage_name text NOT NULL, + destination_storage_name text NOT NULL, + CONSTRAINT group_repository_storage_moves_destination_storage_name CHECK ((char_length(destination_storage_name) <= 255)), + CONSTRAINT group_repository_storage_moves_source_storage_name CHECK ((char_length(source_storage_name) <= 255)) +); + +CREATE SEQUENCE group_repository_storage_moves_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE group_repository_storage_moves_id_seq OWNED BY group_repository_storage_moves.id; + CREATE TABLE group_wiki_repositories ( shard_id bigint NOT NULL, group_id bigint NOT NULL, @@ -13526,6 +13627,14 @@ CREATE TABLE jira_tracker_data ( deployment_type smallint DEFAULT 0 NOT NULL, vulnerabilities_issuetype text, vulnerabilities_enabled boolean DEFAULT false NOT NULL, + encrypted_proxy_address text, + encrypted_proxy_address_iv text, + encrypted_proxy_port text, + encrypted_proxy_port_iv text, + encrypted_proxy_username text, + encrypted_proxy_username_iv text, + encrypted_proxy_password text, + encrypted_proxy_password_iv text, CONSTRAINT check_0bf84b76e9 CHECK ((char_length(vulnerabilities_issuetype) <= 255)), CONSTRAINT check_214cf6a48b CHECK ((char_length(project_key) <= 255)) ); @@ -13863,7 +13972,8 @@ CREATE TABLE merge_request_context_commits ( committer_name text, committer_email text, message text, - merge_request_id bigint + merge_request_id bigint, + trailers jsonb DEFAULT '{}'::jsonb NOT NULL ); CREATE SEQUENCE merge_request_context_commits_id_seq @@ -13885,7 +13995,8 @@ CREATE TABLE merge_request_diff_commits ( author_email text, committer_name text, committer_email text, - message text + message text, + trailers jsonb DEFAULT '{}'::jsonb NOT NULL ); CREATE TABLE merge_request_diff_details ( @@ -13940,6 +14051,7 @@ CREATE TABLE merge_request_diffs ( stored_externally boolean, files_count smallint, sorted boolean DEFAULT false NOT NULL, + diff_type smallint DEFAULT 1 NOT NULL, CONSTRAINT check_93ee616ac9 CHECK ((external_diff_store IS NOT NULL)) ); @@ -13992,7 +14104,8 @@ CREATE TABLE merge_request_reviewers ( id bigint NOT NULL, user_id bigint NOT NULL, merge_request_id bigint NOT NULL, - created_at timestamp with time zone NOT NULL + created_at timestamp with time zone NOT NULL, + state smallint DEFAULT 0 NOT NULL ); CREATE SEQUENCE merge_request_reviewers_id_seq @@ -14197,22 +14310,6 @@ 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_package_settings ( namespace_id bigint NOT NULL, maven_duplicates_allowed boolean DEFAULT true NOT NULL, @@ -14241,6 +14338,7 @@ CREATE TABLE namespace_settings ( prevent_forking_outside_group boolean DEFAULT false NOT NULL, allow_mfa_for_subgroups boolean DEFAULT true NOT NULL, default_branch_name text, + repository_read_only boolean DEFAULT false NOT NULL, CONSTRAINT check_0ba93c78c7 CHECK ((char_length(default_branch_name) <= 255)) ); @@ -14709,6 +14807,27 @@ CREATE SEQUENCE packages_build_infos_id_seq ALTER SEQUENCE packages_build_infos_id_seq OWNED BY packages_build_infos.id; +CREATE TABLE packages_composer_cache_files ( + id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + delete_at timestamp with time zone, + namespace_id integer, + file_store smallint DEFAULT 1 NOT NULL, + file text NOT NULL, + file_sha256 bytea NOT NULL, + CONSTRAINT check_84f5ba81f5 CHECK ((char_length(file) <= 255)) +); + +CREATE SEQUENCE packages_composer_cache_files_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE packages_composer_cache_files_id_seq OWNED BY packages_composer_cache_files.id; + CREATE TABLE packages_composer_metadata ( package_id bigint NOT NULL, target_sha bytea NOT NULL, @@ -14784,6 +14903,49 @@ CREATE SEQUENCE packages_debian_group_architectures_id_seq ALTER SEQUENCE packages_debian_group_architectures_id_seq OWNED BY packages_debian_group_architectures.id; +CREATE TABLE packages_debian_group_component_files ( + id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + component_id bigint NOT NULL, + architecture_id bigint, + size integer NOT NULL, + file_type smallint NOT NULL, + compression_type smallint, + file_store smallint DEFAULT 1 NOT NULL, + file text NOT NULL, + file_md5 bytea NOT NULL, + file_sha256 bytea NOT NULL, + CONSTRAINT check_839e1685bc CHECK ((char_length(file) <= 255)) +); + +CREATE SEQUENCE packages_debian_group_component_files_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE packages_debian_group_component_files_id_seq OWNED BY packages_debian_group_component_files.id; + +CREATE TABLE packages_debian_group_components ( + id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + distribution_id bigint NOT NULL, + name text NOT NULL, + CONSTRAINT check_a9bc7d85be CHECK ((char_length(name) <= 255)) +); + +CREATE SEQUENCE packages_debian_group_components_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE packages_debian_group_components_id_seq OWNED BY packages_debian_group_components.id; + CREATE TABLE packages_debian_group_distributions ( id bigint NOT NULL, created_at timestamp with time zone NOT NULL, @@ -14843,6 +15005,49 @@ CREATE SEQUENCE packages_debian_project_architectures_id_seq ALTER SEQUENCE packages_debian_project_architectures_id_seq OWNED BY packages_debian_project_architectures.id; +CREATE TABLE packages_debian_project_component_files ( + id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + component_id bigint NOT NULL, + architecture_id bigint, + size integer NOT NULL, + file_type smallint NOT NULL, + compression_type smallint, + file_store smallint DEFAULT 1 NOT NULL, + file text NOT NULL, + file_md5 bytea NOT NULL, + file_sha256 bytea NOT NULL, + CONSTRAINT check_e5af03fa2d CHECK ((char_length(file) <= 255)) +); + +CREATE SEQUENCE packages_debian_project_component_files_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE packages_debian_project_component_files_id_seq OWNED BY packages_debian_project_component_files.id; + +CREATE TABLE packages_debian_project_components ( + id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + distribution_id bigint NOT NULL, + name text NOT NULL, + CONSTRAINT check_517559f298 CHECK ((char_length(name) <= 255)) +); + +CREATE SEQUENCE packages_debian_project_components_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE packages_debian_project_components_id_seq OWNED BY packages_debian_project_components.id; + CREATE TABLE packages_debian_project_distributions ( id bigint NOT NULL, created_at timestamp with time zone NOT NULL, @@ -14884,6 +15089,21 @@ CREATE SEQUENCE packages_debian_project_distributions_id_seq ALTER SEQUENCE packages_debian_project_distributions_id_seq OWNED BY packages_debian_project_distributions.id; +CREATE TABLE packages_debian_publications ( + id bigint NOT NULL, + package_id bigint NOT NULL, + distribution_id bigint NOT NULL +); + +CREATE SEQUENCE packages_debian_publications_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE packages_debian_publications_id_seq OWNED BY packages_debian_publications.id; + CREATE TABLE packages_dependencies ( id bigint NOT NULL, name character varying(255) NOT NULL, @@ -15024,7 +15244,8 @@ CREATE TABLE packages_packages ( name character varying NOT NULL, version character varying, package_type smallint NOT NULL, - creator_id integer + creator_id integer, + status smallint DEFAULT 0 NOT NULL ); CREATE SEQUENCE packages_packages_id_seq @@ -15043,6 +15264,58 @@ CREATE TABLE packages_pypi_metadata ( CONSTRAINT check_379019d5da CHECK ((char_length(required_python) <= 255)) ); +CREATE TABLE packages_rubygems_metadata ( + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + package_id bigint NOT NULL, + authors text, + files text, + summary text, + description text, + email text, + homepage text, + licenses text, + metadata text, + author text, + bindir text, + cert_chain text, + executables text, + extensions text, + extra_rdoc_files text, + platform text, + post_install_message text, + rdoc_options text, + require_paths text, + required_ruby_version text, + required_rubygems_version text, + requirements text, + rubygems_version text, + signing_key text, + CONSTRAINT check_0154a18c82 CHECK ((char_length(description) <= 1024)), + CONSTRAINT check_22814c771b CHECK ((char_length(email) <= 255)), + CONSTRAINT check_242293030e CHECK ((char_length(extensions) <= 255)), + CONSTRAINT check_27619a7922 CHECK ((char_length(rubygems_version) <= 255)), + CONSTRAINT check_3d1b6f3a39 CHECK ((char_length(post_install_message) <= 255)), + CONSTRAINT check_545f7606f9 CHECK ((char_length(required_rubygems_version) <= 255)), + CONSTRAINT check_5988451714 CHECK ((char_length(executables) <= 255)), + CONSTRAINT check_5f9c84ea17 CHECK ((char_length(platform) <= 255)), + CONSTRAINT check_64f1cecf05 CHECK ((char_length(requirements) <= 255)), + CONSTRAINT check_6ac7043c50 CHECK ((char_length(extra_rdoc_files) <= 255)), + CONSTRAINT check_6ff3abe325 CHECK ((char_length(cert_chain) <= 255)), + CONSTRAINT check_7cb01436df CHECK ((char_length(licenses) <= 255)), + CONSTRAINT check_8be21d92e7 CHECK ((char_length(summary) <= 1024)), + CONSTRAINT check_946cb96acb CHECK ((char_length(homepage) <= 255)), + CONSTRAINT check_9824fc9efc CHECK ((char_length(bindir) <= 255)), + CONSTRAINT check_994b68eb64 CHECK ((char_length(authors) <= 255)), + CONSTRAINT check_9d42fa48ae CHECK ((char_length(signing_key) <= 255)), + CONSTRAINT check_b0f4f8c853 CHECK ((char_length(files) <= 255)), + CONSTRAINT check_b7b296b420 CHECK ((char_length(author) <= 255)), + CONSTRAINT check_bf16b21a47 CHECK ((char_length(rdoc_options) <= 255)), + CONSTRAINT check_ca641a3354 CHECK ((char_length(required_ruby_version) <= 255)), + CONSTRAINT check_ea02f4800f CHECK ((char_length(metadata) <= 255)), + CONSTRAINT check_f76bad1a9a CHECK ((char_length(require_paths) <= 255)) +); + CREATE TABLE packages_tags ( id bigint NOT NULL, package_id integer NOT NULL, @@ -15255,7 +15528,8 @@ CREATE TABLE plan_limits ( 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, - daily_invites integer DEFAULT 0 NOT NULL + daily_invites integer DEFAULT 0 NOT NULL, + rubygems_max_file_size bigint DEFAULT '3221225472'::bigint NOT NULL ); CREATE SEQUENCE plan_limits_id_seq @@ -15702,7 +15976,8 @@ CREATE TABLE project_features ( metrics_dashboard_access_level integer, requirements_access_level integer DEFAULT 20 NOT NULL, operations_access_level integer DEFAULT 20 NOT NULL, - analytics_access_level integer DEFAULT 20 NOT NULL + analytics_access_level integer DEFAULT 20 NOT NULL, + security_and_compliance_access_level integer DEFAULT 10 NOT NULL ); CREATE SEQUENCE project_features_id_seq @@ -15903,6 +16178,7 @@ CREATE TABLE project_settings ( has_confluence boolean DEFAULT false NOT NULL, has_vulnerabilities boolean DEFAULT false NOT NULL, allow_editing_commit_messages boolean DEFAULT false NOT NULL, + prevent_merge_without_jira_issue boolean DEFAULT false NOT NULL, CONSTRAINT check_bde223416c CHECK ((show_default_award_emojis IS NOT NULL)) ); @@ -16717,6 +16993,25 @@ CREATE SEQUENCE security_findings_id_seq ALTER SEQUENCE security_findings_id_seq OWNED BY security_findings.id; +CREATE TABLE security_orchestration_policy_configurations ( + id bigint NOT NULL, + project_id bigint NOT NULL, + security_policy_management_project_id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL +); + +COMMENT ON TABLE security_orchestration_policy_configurations IS '{"owner":"group::container security","description":"Configuration used to store relationship between project and security policy repository"}'; + +CREATE SEQUENCE security_orchestration_policy_configurations_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE security_orchestration_policy_configurations_id_seq OWNED BY security_orchestration_policy_configurations.id; + CREATE TABLE security_scans ( id bigint NOT NULL, created_at timestamp with time zone NOT NULL, @@ -17327,6 +17622,22 @@ CREATE SEQUENCE todos_id_seq ALTER SEQUENCE todos_id_seq OWNED BY todos.id; +CREATE TABLE token_with_ivs ( + id bigint NOT NULL, + hashed_token bytea NOT NULL, + hashed_plaintext_token bytea NOT NULL, + iv bytea NOT NULL +); + +CREATE SEQUENCE token_with_ivs_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE token_with_ivs_id_seq OWNED BY token_with_ivs.id; + CREATE TABLE trending_projects ( id integer NOT NULL, project_id integer NOT NULL @@ -17479,6 +17790,11 @@ CREATE SEQUENCE user_details_user_id_seq ALTER SEQUENCE user_details_user_id_seq OWNED BY user_details.user_id; +CREATE TABLE user_follow_users ( + follower_id integer NOT NULL, + followee_id integer NOT NULL +); + CREATE TABLE user_highest_roles ( user_id bigint NOT NULL, updated_at timestamp with time zone NOT NULL, @@ -17553,7 +17869,8 @@ CREATE TABLE user_statuses ( emoji character varying DEFAULT 'speech_balloon'::character varying NOT NULL, message character varying(100), message_html character varying, - availability smallint DEFAULT 0 NOT NULL + availability smallint DEFAULT 0 NOT NULL, + clear_status_at timestamp with time zone ); CREATE SEQUENCE user_statuses_user_id_seq @@ -17858,6 +18175,24 @@ CREATE SEQUENCE vulnerability_feedback_id_seq ALTER SEQUENCE vulnerability_feedback_id_seq OWNED BY vulnerability_feedback.id; +CREATE TABLE vulnerability_finding_fingerprints ( + id bigint NOT NULL, + finding_id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + algorithm_type integer NOT NULL, + fingerprint_sha256 bytea NOT NULL +); + +CREATE SEQUENCE vulnerability_finding_fingerprints_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE vulnerability_finding_fingerprints_id_seq OWNED BY vulnerability_finding_fingerprints.id; + CREATE TABLE vulnerability_finding_links ( id bigint NOT NULL, created_at timestamp with time zone NOT NULL, @@ -18010,7 +18345,16 @@ CREATE TABLE vulnerability_occurrences ( metadata_version character varying NOT NULL, raw_metadata text NOT NULL, vulnerability_id bigint, - details jsonb DEFAULT '{}'::jsonb NOT NULL + details jsonb DEFAULT '{}'::jsonb NOT NULL, + description text, + message text, + solution text, + cve text, + location jsonb, + CONSTRAINT check_4a3a60f2ba CHECK ((char_length(solution) <= 7000)), + CONSTRAINT check_ade261da6b CHECK ((char_length(description) <= 15000)), + CONSTRAINT check_df6dd20219 CHECK ((char_length(message) <= 3000)), + CONSTRAINT check_f602da68dd CHECK ((char_length(cve) <= 48400)) ); CREATE SEQUENCE vulnerability_occurrences_id_seq @@ -18160,7 +18504,8 @@ CREATE TABLE web_hooks ( deployment_events boolean DEFAULT false NOT NULL, releases_events boolean DEFAULT false NOT NULL, feature_flag_events boolean DEFAULT false NOT NULL, - member_events boolean DEFAULT false NOT NULL + member_events boolean DEFAULT false NOT NULL, + subgroup_events boolean DEFAULT false NOT NULL ); CREATE SEQUENCE web_hooks_id_seq @@ -18317,8 +18662,6 @@ ALTER TABLE ONLY alert_management_alerts ALTER COLUMN id SET DEFAULT nextval('al ALTER TABLE ONLY alert_management_http_integrations ALTER COLUMN id SET DEFAULT nextval('alert_management_http_integrations_id_seq'::regclass); -ALTER TABLE ONLY alerts_service_data ALTER COLUMN id SET DEFAULT nextval('alerts_service_data_id_seq'::regclass); - ALTER TABLE ONLY allowed_email_domains ALTER COLUMN id SET DEFAULT nextval('allowed_email_domains_id_seq'::regclass); ALTER TABLE ONLY analytics_cycle_analytics_group_stages ALTER COLUMN id SET DEFAULT nextval('analytics_cycle_analytics_group_stages_id_seq'::regclass); @@ -18443,6 +18786,8 @@ ALTER TABLE ONLY ci_job_artifacts ALTER COLUMN id SET DEFAULT nextval('ci_job_ar ALTER TABLE ONLY ci_job_variables ALTER COLUMN id SET DEFAULT nextval('ci_job_variables_id_seq'::regclass); +ALTER TABLE ONLY ci_namespace_monthly_usages ALTER COLUMN id SET DEFAULT nextval('ci_namespace_monthly_usages_id_seq'::regclass); + ALTER TABLE ONLY ci_pipeline_artifacts ALTER COLUMN id SET DEFAULT nextval('ci_pipeline_artifacts_id_seq'::regclass); ALTER TABLE ONLY ci_pipeline_chat_data ALTER COLUMN id SET DEFAULT nextval('ci_pipeline_chat_data_id_seq'::regclass); @@ -18461,6 +18806,8 @@ ALTER TABLE ONLY ci_pipelines_config ALTER COLUMN pipeline_id SET DEFAULT nextva ALTER TABLE ONLY ci_platform_metrics ALTER COLUMN id SET DEFAULT nextval('ci_platform_metrics_id_seq'::regclass); +ALTER TABLE ONLY ci_project_monthly_usages ALTER COLUMN id SET DEFAULT nextval('ci_project_monthly_usages_id_seq'::regclass); + ALTER TABLE ONLY ci_refs ALTER COLUMN id SET DEFAULT nextval('ci_refs_id_seq'::regclass); ALTER TABLE ONLY ci_resource_groups ALTER COLUMN id SET DEFAULT nextval('ci_resource_groups_id_seq'::regclass); @@ -18543,6 +18890,8 @@ ALTER TABLE ONLY csv_issue_imports ALTER COLUMN id SET DEFAULT nextval('csv_issu ALTER TABLE ONLY custom_emoji ALTER COLUMN id SET DEFAULT nextval('custom_emoji_id_seq'::regclass); +ALTER TABLE ONLY dast_profiles ALTER COLUMN id SET DEFAULT nextval('dast_profiles_id_seq'::regclass); + ALTER TABLE ONLY dast_scanner_profiles ALTER COLUMN id SET DEFAULT nextval('dast_scanner_profiles_id_seq'::regclass); ALTER TABLE ONLY dast_site_profiles ALTER COLUMN id SET DEFAULT nextval('dast_site_profiles_id_seq'::regclass); @@ -18675,6 +19024,8 @@ ALTER TABLE ONLY group_group_links ALTER COLUMN id SET DEFAULT nextval('group_gr ALTER TABLE ONLY group_import_states ALTER COLUMN group_id SET DEFAULT nextval('group_import_states_group_id_seq'::regclass); +ALTER TABLE ONLY group_repository_storage_moves ALTER COLUMN id SET DEFAULT nextval('group_repository_storage_moves_id_seq'::regclass); + ALTER TABLE ONLY historical_data ALTER COLUMN id SET DEFAULT nextval('historical_data_id_seq'::regclass); ALTER TABLE ONLY identities ALTER COLUMN id SET DEFAULT nextval('identities_id_seq'::regclass); @@ -18779,8 +19130,6 @@ 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); @@ -18821,18 +19170,30 @@ ALTER TABLE ONLY operations_user_lists ALTER COLUMN id SET DEFAULT nextval('oper ALTER TABLE ONLY packages_build_infos ALTER COLUMN id SET DEFAULT nextval('packages_build_infos_id_seq'::regclass); +ALTER TABLE ONLY packages_composer_cache_files ALTER COLUMN id SET DEFAULT nextval('packages_composer_cache_files_id_seq'::regclass); + ALTER TABLE ONLY packages_conan_file_metadata ALTER COLUMN id SET DEFAULT nextval('packages_conan_file_metadata_id_seq'::regclass); ALTER TABLE ONLY packages_conan_metadata ALTER COLUMN id SET DEFAULT nextval('packages_conan_metadata_id_seq'::regclass); ALTER TABLE ONLY packages_debian_group_architectures ALTER COLUMN id SET DEFAULT nextval('packages_debian_group_architectures_id_seq'::regclass); +ALTER TABLE ONLY packages_debian_group_component_files ALTER COLUMN id SET DEFAULT nextval('packages_debian_group_component_files_id_seq'::regclass); + +ALTER TABLE ONLY packages_debian_group_components ALTER COLUMN id SET DEFAULT nextval('packages_debian_group_components_id_seq'::regclass); + ALTER TABLE ONLY packages_debian_group_distributions ALTER COLUMN id SET DEFAULT nextval('packages_debian_group_distributions_id_seq'::regclass); ALTER TABLE ONLY packages_debian_project_architectures ALTER COLUMN id SET DEFAULT nextval('packages_debian_project_architectures_id_seq'::regclass); +ALTER TABLE ONLY packages_debian_project_component_files ALTER COLUMN id SET DEFAULT nextval('packages_debian_project_component_files_id_seq'::regclass); + +ALTER TABLE ONLY packages_debian_project_components ALTER COLUMN id SET DEFAULT nextval('packages_debian_project_components_id_seq'::regclass); + ALTER TABLE ONLY packages_debian_project_distributions ALTER COLUMN id SET DEFAULT nextval('packages_debian_project_distributions_id_seq'::regclass); +ALTER TABLE ONLY packages_debian_publications ALTER COLUMN id SET DEFAULT nextval('packages_debian_publications_id_seq'::regclass); + ALTER TABLE ONLY packages_dependencies ALTER COLUMN id SET DEFAULT nextval('packages_dependencies_id_seq'::regclass); ALTER TABLE ONLY packages_dependency_links ALTER COLUMN id SET DEFAULT nextval('packages_dependency_links_id_seq'::regclass); @@ -18977,6 +19338,8 @@ ALTER TABLE ONLY scim_oauth_access_tokens ALTER COLUMN id SET DEFAULT nextval('s ALTER TABLE ONLY security_findings ALTER COLUMN id SET DEFAULT nextval('security_findings_id_seq'::regclass); +ALTER TABLE ONLY security_orchestration_policy_configurations ALTER COLUMN id SET DEFAULT nextval('security_orchestration_policy_configurations_id_seq'::regclass); + ALTER TABLE ONLY security_scans ALTER COLUMN id SET DEFAULT nextval('security_scans_id_seq'::regclass); ALTER TABLE ONLY self_managed_prometheus_alert_events ALTER COLUMN id SET DEFAULT nextval('self_managed_prometheus_alert_events_id_seq'::regclass); @@ -19031,6 +19394,8 @@ ALTER TABLE ONLY timelogs ALTER COLUMN id SET DEFAULT nextval('timelogs_id_seq': ALTER TABLE ONLY todos ALTER COLUMN id SET DEFAULT nextval('todos_id_seq'::regclass); +ALTER TABLE ONLY token_with_ivs ALTER COLUMN id SET DEFAULT nextval('token_with_ivs_id_seq'::regclass); + ALTER TABLE ONLY trending_projects ALTER COLUMN id SET DEFAULT nextval('trending_projects_id_seq'::regclass); ALTER TABLE ONLY u2f_registrations ALTER COLUMN id SET DEFAULT nextval('u2f_registrations_id_seq'::regclass); @@ -19071,6 +19436,8 @@ ALTER TABLE ONLY vulnerability_external_issue_links ALTER COLUMN id SET DEFAULT ALTER TABLE ONLY vulnerability_feedback ALTER COLUMN id SET DEFAULT nextval('vulnerability_feedback_id_seq'::regclass); +ALTER TABLE ONLY vulnerability_finding_fingerprints ALTER COLUMN id SET DEFAULT nextval('vulnerability_finding_fingerprints_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); @@ -19323,9 +19690,6 @@ ALTER TABLE ONLY alert_management_alerts ALTER TABLE ONLY alert_management_http_integrations ADD CONSTRAINT alert_management_http_integrations_pkey PRIMARY KEY (id); -ALTER TABLE ONLY alerts_service_data - ADD CONSTRAINT alerts_service_data_pkey PRIMARY KEY (id); - ALTER TABLE ONLY allowed_email_domains ADD CONSTRAINT allowed_email_domains_pkey PRIMARY KEY (id); @@ -19539,6 +19903,9 @@ ALTER TABLE ONLY ci_job_artifacts ALTER TABLE ONLY ci_job_variables ADD CONSTRAINT ci_job_variables_pkey PRIMARY KEY (id); +ALTER TABLE ONLY ci_namespace_monthly_usages + ADD CONSTRAINT ci_namespace_monthly_usages_pkey PRIMARY KEY (id); + ALTER TABLE ONLY ci_pipeline_artifacts ADD CONSTRAINT ci_pipeline_artifacts_pkey PRIMARY KEY (id); @@ -19566,6 +19933,9 @@ ALTER TABLE ONLY ci_pipelines ALTER TABLE ONLY ci_platform_metrics ADD CONSTRAINT ci_platform_metrics_pkey PRIMARY KEY (id); +ALTER TABLE ONLY ci_project_monthly_usages + ADD CONSTRAINT ci_project_monthly_usages_pkey PRIMARY KEY (id); + ALTER TABLE ONLY ci_refs ADD CONSTRAINT ci_refs_pkey PRIMARY KEY (id); @@ -19692,6 +20062,9 @@ ALTER TABLE ONLY csv_issue_imports ALTER TABLE ONLY custom_emoji ADD CONSTRAINT custom_emoji_pkey PRIMARY KEY (id); +ALTER TABLE ONLY dast_profiles + ADD CONSTRAINT dast_profiles_pkey PRIMARY KEY (id); + ALTER TABLE ONLY dast_scanner_profiles ADD CONSTRAINT dast_scanner_profiles_pkey PRIMARY KEY (id); @@ -19908,6 +20281,9 @@ ALTER TABLE ONLY group_import_states ALTER TABLE ONLY group_merge_request_approval_settings ADD CONSTRAINT group_merge_request_approval_settings_pkey PRIMARY KEY (group_id); +ALTER TABLE ONLY group_repository_storage_moves + ADD CONSTRAINT group_repository_storage_moves_pkey PRIMARY KEY (id); + ALTER TABLE ONLY group_wiki_repositories ADD CONSTRAINT group_wiki_repositories_pkey PRIMARY KEY (group_id); @@ -20103,9 +20479,6 @@ 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_package_settings ADD CONSTRAINT namespace_package_settings_pkey PRIMARY KEY (namespace_id); @@ -20175,6 +20548,9 @@ ALTER TABLE ONLY operations_user_lists ALTER TABLE ONLY packages_build_infos ADD CONSTRAINT packages_build_infos_pkey PRIMARY KEY (id); +ALTER TABLE ONLY packages_composer_cache_files + ADD CONSTRAINT packages_composer_cache_files_pkey PRIMARY KEY (id); + ALTER TABLE ONLY packages_composer_metadata ADD CONSTRAINT packages_composer_metadata_pkey PRIMARY KEY (package_id); @@ -20190,15 +20566,30 @@ ALTER TABLE ONLY packages_debian_file_metadata ALTER TABLE ONLY packages_debian_group_architectures ADD CONSTRAINT packages_debian_group_architectures_pkey PRIMARY KEY (id); +ALTER TABLE ONLY packages_debian_group_component_files + ADD CONSTRAINT packages_debian_group_component_files_pkey PRIMARY KEY (id); + +ALTER TABLE ONLY packages_debian_group_components + ADD CONSTRAINT packages_debian_group_components_pkey PRIMARY KEY (id); + ALTER TABLE ONLY packages_debian_group_distributions ADD CONSTRAINT packages_debian_group_distributions_pkey PRIMARY KEY (id); ALTER TABLE ONLY packages_debian_project_architectures ADD CONSTRAINT packages_debian_project_architectures_pkey PRIMARY KEY (id); +ALTER TABLE ONLY packages_debian_project_component_files + ADD CONSTRAINT packages_debian_project_component_files_pkey PRIMARY KEY (id); + +ALTER TABLE ONLY packages_debian_project_components + ADD CONSTRAINT packages_debian_project_components_pkey PRIMARY KEY (id); + ALTER TABLE ONLY packages_debian_project_distributions ADD CONSTRAINT packages_debian_project_distributions_pkey PRIMARY KEY (id); +ALTER TABLE ONLY packages_debian_publications + ADD CONSTRAINT packages_debian_publications_pkey PRIMARY KEY (id); + ALTER TABLE ONLY packages_dependencies ADD CONSTRAINT packages_dependencies_pkey PRIMARY KEY (id); @@ -20229,6 +20620,9 @@ ALTER TABLE ONLY packages_packages ALTER TABLE ONLY packages_pypi_metadata ADD CONSTRAINT packages_pypi_metadata_pkey PRIMARY KEY (package_id); +ALTER TABLE ONLY packages_rubygems_metadata + ADD CONSTRAINT packages_rubygems_metadata_pkey PRIMARY KEY (package_id); + ALTER TABLE ONLY packages_tags ADD CONSTRAINT packages_tags_pkey PRIMARY KEY (id); @@ -20454,6 +20848,9 @@ ALTER TABLE ONLY scim_oauth_access_tokens ALTER TABLE ONLY security_findings ADD CONSTRAINT security_findings_pkey PRIMARY KEY (id); +ALTER TABLE ONLY security_orchestration_policy_configurations + ADD CONSTRAINT security_orchestration_policy_configurations_pkey PRIMARY KEY (id); + ALTER TABLE ONLY security_scans ADD CONSTRAINT security_scans_pkey PRIMARY KEY (id); @@ -20547,6 +20944,9 @@ ALTER TABLE ONLY timelogs ALTER TABLE ONLY todos ADD CONSTRAINT todos_pkey PRIMARY KEY (id); +ALTER TABLE ONLY token_with_ivs + ADD CONSTRAINT token_with_ivs_pkey PRIMARY KEY (id); + ALTER TABLE ONLY trending_projects ADD CONSTRAINT trending_projects_pkey PRIMARY KEY (id); @@ -20571,6 +20971,9 @@ ALTER TABLE ONLY user_custom_attributes ALTER TABLE ONLY user_details ADD CONSTRAINT user_details_pkey PRIMARY KEY (user_id); +ALTER TABLE ONLY user_follow_users + ADD CONSTRAINT user_follow_users_pkey PRIMARY KEY (follower_id, followee_id); + ALTER TABLE ONLY user_highest_roles ADD CONSTRAINT user_highest_roles_pkey PRIMARY KEY (user_id); @@ -20616,6 +21019,9 @@ ALTER TABLE ONLY vulnerability_external_issue_links ALTER TABLE ONLY vulnerability_feedback ADD CONSTRAINT vulnerability_feedback_pkey PRIMARY KEY (id); +ALTER TABLE ONLY vulnerability_finding_fingerprints + ADD CONSTRAINT vulnerability_finding_fingerprints_pkey PRIMARY KEY (id); + ALTER TABLE ONLY vulnerability_finding_links ADD CONSTRAINT vulnerability_finding_links_pkey PRIMARY KEY (id); @@ -20831,8 +21237,6 @@ CREATE INDEX backup_labels_group_id_title_idx ON backup_labels USING btree (grou CREATE INDEX backup_labels_project_id_idx ON backup_labels USING btree (project_id); -CREATE UNIQUE INDEX backup_labels_project_id_title_idx ON backup_labels USING btree (project_id, title) WHERE (group_id = NULL::integer); - CREATE INDEX backup_labels_template_idx ON backup_labels USING btree (template) WHERE template; CREATE INDEX backup_labels_title_idx ON backup_labels USING btree (title); @@ -20847,6 +21251,8 @@ CREATE INDEX code_owner_approval_required ON protected_branches USING btree (pro CREATE INDEX commit_id_and_note_id_index ON commit_user_mentions USING btree (commit_id, note_id); +CREATE INDEX composer_cache_files_index_on_deleted_at ON packages_composer_cache_files USING btree (delete_at, id); + CREATE UNIQUE INDEX design_management_designs_versions_uniqueness ON design_management_designs_versions USING btree (design_id, version_id); CREATE INDEX design_user_mentions_on_design_id_and_note_id_index ON design_user_mentions USING btree (design_id, note_id); @@ -20855,7 +21261,7 @@ CREATE UNIQUE INDEX epic_user_mentions_on_epic_id_and_note_id_index ON epic_user CREATE UNIQUE INDEX epic_user_mentions_on_epic_id_index ON epic_user_mentions USING btree (epic_id) WHERE (note_id IS NULL); -CREATE INDEX expired_artifacts_temp_index ON ci_job_artifacts USING btree (id, created_at) WHERE ((expire_at IS NULL) AND (created_at < '2020-06-22 00:00:00+00'::timestamp with time zone)); +CREATE INDEX expired_artifacts_temp_index ON ci_job_artifacts USING btree (id, created_at) WHERE ((expire_at IS NULL) AND (date(timezone('UTC'::text, created_at)) < '2020-06-22'::date)); CREATE INDEX finding_links_on_vulnerability_occurrence_id ON vulnerability_finding_links USING btree (vulnerability_occurrence_id); @@ -20911,8 +21317,14 @@ CREATE INDEX idx_mr_cc_diff_files_on_mr_cc_id_and_sha ON merge_request_context_c CREATE UNIQUE INDEX idx_on_compliance_management_frameworks_namespace_id_name ON compliance_management_frameworks USING btree (namespace_id, name); +CREATE INDEX idx_on_issues_where_service_desk_reply_to_is_not_null ON issues USING btree (id) WHERE (service_desk_reply_to IS NOT NULL); + CREATE INDEX idx_packages_build_infos_on_package_id ON packages_build_infos USING btree (package_id); +CREATE INDEX idx_packages_debian_group_component_files_on_architecture_id ON packages_debian_group_component_files USING btree (architecture_id); + +CREATE INDEX idx_packages_debian_project_component_files_on_architecture_id ON packages_debian_project_component_files USING btree (architecture_id); + CREATE INDEX idx_packages_packages_on_project_id_name_version_package_type ON packages_packages USING btree (project_id, name, version, package_type); CREATE INDEX idx_pkgs_deb_grp_architectures_on_distribution_id ON packages_debian_group_architectures USING btree (distribution_id); @@ -20951,6 +21363,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_vuln_fingerprints_on_occurrences_id_and_fingerprint ON vulnerability_finding_fingerprints USING btree (finding_id, fingerprint_sha256); + +CREATE UNIQUE INDEX idx_vuln_fingerprints_uniqueness ON vulnerability_finding_fingerprints USING btree (finding_id, algorithm_type, fingerprint_sha256); + 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); @@ -20983,8 +21399,6 @@ CREATE UNIQUE INDEX index_alert_user_mentions_on_alert_id_and_note_id ON alert_m CREATE UNIQUE INDEX index_alert_user_mentions_on_note_id ON alert_management_alert_user_mentions USING btree (note_id) WHERE (note_id IS NOT NULL); -CREATE INDEX index_alerts_service_data_on_service_id ON alerts_service_data USING btree (service_id); - CREATE INDEX index_allowed_email_domains_on_group_id ON allowed_email_domains USING btree (group_id); CREATE INDEX index_analytics_ca_group_stages_on_end_event_label_id ON analytics_cycle_analytics_group_stages USING btree (end_event_label_id); @@ -21011,7 +21425,7 @@ CREATE INDEX index_analytics_ca_project_stages_on_start_event_label_id ON analyt CREATE INDEX index_analytics_cycle_analytics_group_stages_custom_only ON analytics_cycle_analytics_group_stages USING btree (id) WHERE (custom = true); -CREATE UNIQUE INDEX index_analytics_devops_adoption_segments_on_name ON analytics_devops_adoption_segments USING btree (name); +CREATE UNIQUE INDEX index_analytics_devops_adoption_segments_on_namespace_id ON analytics_devops_adoption_segments USING btree (namespace_id); CREATE INDEX index_application_settings_on_custom_project_templates_group_id ON application_settings USING btree (custom_project_templates_group_id); @@ -21211,7 +21625,7 @@ CREATE UNIQUE INDEX index_ci_builds_metadata_on_build_id ON ci_builds_metadata U CREATE INDEX index_ci_builds_metadata_on_build_id_and_has_exposed_artifacts ON ci_builds_metadata USING btree (build_id) WHERE (has_exposed_artifacts IS TRUE); -CREATE INDEX index_ci_builds_metadata_on_build_id_and_interruptible ON ci_builds_metadata USING btree (build_id) WHERE (interruptible = true); +CREATE INDEX index_ci_builds_metadata_on_build_id_and_id_and_interruptible ON ci_builds_metadata USING btree (build_id) INCLUDE (id) WHERE (interruptible = true); CREATE INDEX index_ci_builds_metadata_on_project_id ON ci_builds_metadata USING btree (project_id); @@ -21261,6 +21675,8 @@ CREATE INDEX index_ci_builds_project_id_and_status_for_live_jobs_partial2 ON ci_ CREATE UNIQUE INDEX index_ci_builds_runner_session_on_build_id ON ci_builds_runner_session USING btree (build_id); +CREATE INDEX index_ci_daily_build_group_report_results_on_group_id ON ci_daily_build_group_report_results USING btree (group_id); + CREATE INDEX index_ci_daily_build_group_report_results_on_last_pipeline_id ON ci_daily_build_group_report_results USING btree (last_pipeline_id); CREATE INDEX index_ci_daily_build_group_report_results_on_project_and_date ON ci_daily_build_group_report_results USING btree (project_id, date DESC) WHERE ((default_branch = true) AND ((data -> 'coverage'::text) IS NOT NULL)); @@ -21291,6 +21707,8 @@ CREATE INDEX index_ci_job_variables_on_job_id ON ci_job_variables USING btree (j CREATE UNIQUE INDEX index_ci_job_variables_on_key_and_job_id ON ci_job_variables USING btree (key, job_id); +CREATE UNIQUE INDEX index_ci_namespace_monthly_usages_on_namespace_id_and_date ON ci_namespace_monthly_usages USING btree (namespace_id, date); + CREATE INDEX index_ci_pipeline_artifacts_on_expire_at ON ci_pipeline_artifacts USING btree (expire_at); CREATE INDEX index_ci_pipeline_artifacts_on_pipeline_id ON ci_pipeline_artifacts USING btree (pipeline_id); @@ -21355,6 +21773,8 @@ CREATE INDEX index_ci_pipelines_on_user_id_and_created_at_and_config_source ON c CREATE INDEX index_ci_pipelines_on_user_id_and_created_at_and_source ON ci_pipelines USING btree (user_id, created_at, source); +CREATE UNIQUE INDEX index_ci_project_monthly_usages_on_project_id_and_date ON ci_project_monthly_usages USING btree (project_id, date); + CREATE UNIQUE INDEX index_ci_refs_on_project_id_and_ref_path ON ci_refs USING btree (project_id, ref_path); CREATE UNIQUE INDEX index_ci_resource_groups_on_project_id_and_key ON ci_resource_groups USING btree (project_id, key); @@ -21427,8 +21847,12 @@ CREATE UNIQUE INDEX index_ci_variables_on_project_id_and_key_and_environment_sco CREATE INDEX index_cluster_agent_tokens_on_agent_id ON cluster_agent_tokens USING btree (agent_id); +CREATE INDEX index_cluster_agent_tokens_on_created_by_user_id ON cluster_agent_tokens USING btree (created_by_user_id); + CREATE UNIQUE INDEX index_cluster_agent_tokens_on_token_encrypted ON cluster_agent_tokens USING btree (token_encrypted); +CREATE INDEX index_cluster_agents_on_created_by_user_id ON cluster_agents USING btree (created_by_user_id); + CREATE UNIQUE INDEX index_cluster_agents_on_project_id_and_name ON cluster_agents USING btree (project_id, name); CREATE UNIQUE INDEX index_cluster_groups_on_cluster_id_and_group_id ON cluster_groups USING btree (cluster_id, group_id); @@ -21495,6 +21919,8 @@ CREATE INDEX index_clusters_on_user_id ON clusters USING btree (user_id); CREATE UNIQUE INDEX index_commit_user_mentions_on_note_id ON commit_user_mentions USING btree (note_id); +CREATE INDEX index_composer_cache_files_where_namespace_id_is_null ON packages_composer_cache_files USING btree (id) WHERE (namespace_id IS NULL); + CREATE INDEX index_container_expiration_policies_on_next_run_at_and_enabled ON container_expiration_policies USING btree (next_run_at, enabled); CREATE INDEX index_container_repositories_on_project_id ON container_repositories USING btree (project_id); @@ -21515,6 +21941,12 @@ CREATE UNIQUE INDEX index_custom_emoji_on_namespace_id_and_name ON custom_emoji CREATE UNIQUE INDEX index_daily_build_group_report_results_unique_columns ON ci_daily_build_group_report_results USING btree (project_id, ref_path, date, group_name); +CREATE INDEX index_dast_profiles_on_dast_scanner_profile_id ON dast_profiles USING btree (dast_scanner_profile_id); + +CREATE INDEX index_dast_profiles_on_dast_site_profile_id ON dast_profiles USING btree (dast_site_profile_id); + +CREATE UNIQUE INDEX index_dast_profiles_on_project_id_and_name ON dast_profiles USING btree (project_id, name); + CREATE UNIQUE INDEX index_dast_scanner_profiles_on_project_id_and_name ON dast_scanner_profiles USING btree (project_id, name); CREATE INDEX index_dast_site_profiles_on_dast_site_id ON dast_site_profiles USING btree (dast_site_id); @@ -21883,6 +22315,8 @@ CREATE INDEX index_group_import_states_on_group_id ON group_import_states USING CREATE INDEX index_group_import_states_on_user_id ON group_import_states USING btree (user_id) WHERE (user_id IS NOT NULL); +CREATE INDEX index_group_repository_storage_moves_on_group_id ON group_repository_storage_moves USING btree (group_id); + CREATE UNIQUE INDEX index_group_stages_on_group_id_group_value_stream_id_and_name ON analytics_cycle_analytics_group_stages USING btree (group_id, group_value_stream_id, name); CREATE UNIQUE INDEX index_group_wiki_repositories_on_disk_path ON group_wiki_repositories USING btree (disk_path); @@ -21927,8 +22361,6 @@ CREATE INDEX index_incident_management_oncall_schedules_on_project_id ON inciden CREATE INDEX index_incident_management_oncall_shifts_on_participant_id ON incident_management_oncall_shifts USING btree (participant_id); -CREATE INDEX index_incident_management_oncall_shifts_on_rotation_id ON incident_management_oncall_shifts USING btree (rotation_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); @@ -22123,6 +22555,8 @@ CREATE INDEX index_merge_request_diffs_on_external_diff_store ON merge_request_d CREATE INDEX index_merge_request_diffs_on_merge_request_id_and_id ON merge_request_diffs USING btree (merge_request_id, id); +CREATE UNIQUE INDEX index_merge_request_diffs_on_unique_merge_request_id ON merge_request_diffs USING btree (merge_request_id) WHERE (diff_type = 2); + CREATE INDEX index_merge_request_metrics_on_first_deployed_to_production_at ON merge_request_metrics USING btree (first_deployed_to_production_at); CREATE INDEX index_merge_request_metrics_on_latest_closed_at ON merge_request_metrics USING btree (latest_closed_at) WHERE (latest_closed_at IS NOT NULL); @@ -22237,8 +22671,6 @@ CREATE INDEX index_mr_metrics_on_target_project_id_merged_at_time_to_merge ON me 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); @@ -22335,6 +22767,10 @@ CREATE UNIQUE INDEX index_on_instance_statistics_recorded_at_and_identifier ON a CREATE INDEX index_on_label_links_all_columns ON label_links USING btree (target_id, label_id, target_type); +CREATE INDEX index_on_merge_requests_for_latest_diffs ON merge_requests USING btree (target_project_id) INCLUDE (id, latest_merge_request_diff_id); + +COMMENT ON INDEX index_on_merge_requests_for_latest_diffs IS 'Index used to efficiently obtain the oldest merge request for a commit SHA'; + CREATE INDEX index_on_namespaces_lower_name ON namespaces USING btree (lower((name)::text)); CREATE INDEX index_on_namespaces_lower_path ON namespaces USING btree (lower((path)::text)); @@ -22359,8 +22795,18 @@ CREATE INDEX index_on_users_lower_username ON users USING btree (lower((username CREATE INDEX index_on_users_name_lower ON users USING btree (lower((name)::text)); +CREATE INDEX index_onboarding_progresses_for_create_track ON onboarding_progresses USING btree (created_at) WHERE (git_write_at IS NULL); + +CREATE INDEX index_onboarding_progresses_for_team_track ON onboarding_progresses USING btree (GREATEST(git_write_at, pipeline_created_at, trial_started_at)) WHERE ((git_write_at IS NOT NULL) AND (pipeline_created_at IS NOT NULL) AND (trial_started_at IS NOT NULL) AND (user_added_at IS NULL)); + +CREATE INDEX index_onboarding_progresses_for_trial_track ON onboarding_progresses USING btree (GREATEST(git_write_at, pipeline_created_at)) WHERE ((git_write_at IS NOT NULL) AND (pipeline_created_at IS NOT NULL) AND (trial_started_at IS NULL)); + +CREATE INDEX index_onboarding_progresses_for_verify_track ON onboarding_progresses USING btree (git_write_at) WHERE ((git_write_at IS NOT NULL) AND (pipeline_created_at IS NULL)); + CREATE UNIQUE INDEX index_onboarding_progresses_on_namespace_id ON onboarding_progresses USING btree (namespace_id); +CREATE INDEX index_oncall_shifts_on_rotation_id_and_starts_at_and_ends_at ON incident_management_oncall_shifts USING btree (rotation_id, starts_at, ends_at); + CREATE INDEX index_open_project_tracker_data_on_service_id ON open_project_tracker_data USING btree (service_id); CREATE INDEX index_operations_feature_flags_issues_on_issue_id ON operations_feature_flags_issues USING btree (issue_id); @@ -22385,20 +22831,30 @@ CREATE UNIQUE INDEX index_ops_strategies_user_lists_on_strategy_id_and_user_list CREATE INDEX index_packages_build_infos_on_pipeline_id ON packages_build_infos USING btree (pipeline_id); +CREATE UNIQUE INDEX index_packages_composer_cache_namespace_and_sha ON packages_composer_cache_files USING btree (namespace_id, file_sha256); + CREATE UNIQUE INDEX index_packages_composer_metadata_on_package_id_and_target_sha ON packages_composer_metadata USING btree (package_id, target_sha); CREATE UNIQUE INDEX index_packages_conan_file_metadata_on_package_file_id ON packages_conan_file_metadata USING btree (package_file_id); CREATE UNIQUE INDEX index_packages_conan_metadata_on_package_id_username_channel ON packages_conan_metadata USING btree (package_id, package_username, package_channel); +CREATE INDEX index_packages_debian_group_component_files_on_component_id ON packages_debian_group_component_files USING btree (component_id); + CREATE INDEX index_packages_debian_group_distributions_on_creator_id ON packages_debian_group_distributions USING btree (creator_id); CREATE INDEX index_packages_debian_group_distributions_on_group_id ON packages_debian_group_distributions USING btree (group_id); +CREATE INDEX index_packages_debian_project_component_files_on_component_id ON packages_debian_project_component_files USING btree (component_id); + CREATE INDEX index_packages_debian_project_distributions_on_creator_id ON packages_debian_project_distributions USING btree (creator_id); CREATE INDEX index_packages_debian_project_distributions_on_project_id ON packages_debian_project_distributions USING btree (project_id); +CREATE INDEX index_packages_debian_publications_on_distribution_id ON packages_debian_publications USING btree (distribution_id); + +CREATE UNIQUE INDEX index_packages_debian_publications_on_package_id ON packages_debian_publications USING btree (package_id); + CREATE UNIQUE INDEX index_packages_dependencies_on_name_and_version_pattern ON packages_dependencies USING btree (name, version_pattern); CREATE INDEX index_packages_dependency_links_on_dependency_id ON packages_dependency_links USING btree (dependency_id); @@ -22431,6 +22887,8 @@ CREATE INDEX index_packages_packages_on_project_id_and_created_at ON packages_pa CREATE INDEX index_packages_packages_on_project_id_and_package_type ON packages_packages USING btree (project_id, package_type); +CREATE INDEX index_packages_packages_on_project_id_and_status ON packages_packages USING btree (project_id, status); + CREATE INDEX index_packages_packages_on_project_id_and_version ON packages_packages USING btree (project_id, version); CREATE INDEX index_packages_project_id_name_partial_for_nuget ON packages_packages USING btree (project_id, name) WHERE (((name)::text <> 'NuGet.Temporary.Package'::text) AND (version IS NOT NULL) AND (package_type = 4)); @@ -22885,6 +23343,8 @@ CREATE INDEX index_security_findings_on_severity ON security_findings USING btre CREATE UNIQUE INDEX index_security_findings_on_uuid_and_scan_id ON security_findings USING btree (uuid, scan_id); +CREATE INDEX index_security_scans_on_date_created_at_and_id ON security_scans USING btree (date(timezone('UTC'::text, created_at)), 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); @@ -22903,7 +23363,7 @@ CREATE INDEX index_service_desk_enabled_projects_on_id_creator_id_created_at ON CREATE INDEX index_services_on_inherit_from_id ON services USING btree (inherit_from_id); -CREATE INDEX index_services_on_project_id_and_type ON services USING btree (project_id, type); +CREATE UNIQUE INDEX index_services_on_project_id_and_type_unique ON services USING btree (project_id, type); CREATE INDEX index_services_on_template ON services USING btree (template); @@ -22967,6 +23427,10 @@ CREATE INDEX index_software_licenses_on_spdx_identifier ON software_licenses USI CREATE UNIQUE INDEX index_software_licenses_on_unique_name ON software_licenses USING btree (name); +CREATE UNIQUE INDEX index_sop_configs_on_project_id ON security_orchestration_policy_configurations USING btree (project_id); + +CREATE UNIQUE INDEX index_sop_configs_on_security_policy_management_project_id ON security_orchestration_policy_configurations USING btree (security_policy_management_project_id); + CREATE INDEX index_sprints_on_description_trigram ON sprints USING gin (description gin_trgm_ops); CREATE INDEX index_sprints_on_due_date ON sprints USING btree (due_date); @@ -23059,6 +23523,10 @@ CREATE INDEX index_todos_on_user_id_and_id_done ON todos USING btree (user_id, i CREATE INDEX index_todos_on_user_id_and_id_pending ON todos USING btree (user_id, id) WHERE ((state)::text = 'pending'::text); +CREATE UNIQUE INDEX index_token_with_ivs_on_hashed_plaintext_token ON token_with_ivs USING btree (hashed_plaintext_token); + +CREATE UNIQUE INDEX index_token_with_ivs_on_hashed_token ON token_with_ivs USING btree (hashed_token); + CREATE UNIQUE INDEX index_trending_projects_on_project_id ON trending_projects USING btree (project_id); CREATE INDEX index_u2f_registrations_on_key_handle ON u2f_registrations USING btree (key_handle); @@ -23103,6 +23571,8 @@ CREATE INDEX index_user_preferences_on_gitpod_enabled ON user_preferences USING CREATE UNIQUE INDEX index_user_preferences_on_user_id ON user_preferences USING btree (user_id); +CREATE INDEX index_user_statuses_on_clear_status_at_not_null ON user_statuses USING btree (clear_status_at) WHERE (clear_status_at IS NOT NULL); + CREATE INDEX index_user_statuses_on_user_id ON user_statuses USING btree (user_id); CREATE UNIQUE INDEX index_user_synced_attributes_metadata_on_user_id ON user_synced_attributes_metadata USING btree (user_id); @@ -23215,6 +23685,8 @@ 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_finding_fingerprints_on_finding_id ON vulnerability_finding_fingerprints USING btree (finding_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); @@ -23349,14 +23821,20 @@ 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 tmp_index_oauth_applications_on_id_where_trusted ON oauth_applications USING btree (id) WHERE (trusted = true); +CREATE INDEX tmp_idx_deduplicate_vulnerability_occurrences ON vulnerability_occurrences USING btree (project_id, report_type, location_fingerprint, primary_identifier_id, id); + +CREATE INDEX tmp_index_on_security_findings_scan_id ON security_findings USING btree (scan_id) WHERE (uuid IS NULL); CREATE INDEX tmp_index_on_vulnerabilities_non_dismissed ON vulnerabilities USING btree (id) WHERE (state <> 2); CREATE UNIQUE INDEX uniq_pkgs_deb_grp_architectures_on_distribution_id_and_name ON packages_debian_group_architectures USING btree (distribution_id, name); +CREATE UNIQUE INDEX uniq_pkgs_deb_grp_components_on_distribution_id_and_name ON packages_debian_group_components USING btree (distribution_id, name); + CREATE UNIQUE INDEX uniq_pkgs_deb_proj_architectures_on_distribution_id_and_name ON packages_debian_project_architectures USING btree (distribution_id, name); +CREATE UNIQUE INDEX uniq_pkgs_deb_proj_components_on_distribution_id_and_name ON packages_debian_project_components USING btree (distribution_id, name); + CREATE UNIQUE INDEX uniq_pkgs_debian_group_distributions_group_id_and_codename ON packages_debian_group_distributions USING btree (group_id, codename); CREATE UNIQUE INDEX uniq_pkgs_debian_group_distributions_group_id_and_suite ON packages_debian_group_distributions USING btree (group_id, suite); @@ -23367,6 +23845,8 @@ CREATE UNIQUE INDEX uniq_pkgs_debian_project_distributions_project_id_and_suite CREATE UNIQUE INDEX unique_merge_request_metrics_by_merge_request_id ON merge_request_metrics USING btree (merge_request_id); +CREATE INDEX user_follow_users_followee_id_idx ON user_follow_users USING btree (followee_id); + CREATE UNIQUE INDEX vulnerability_feedback_unique_idx ON vulnerability_feedback USING btree (project_id, category, feedback_type, project_fingerprint); CREATE UNIQUE INDEX vulnerability_occurrence_pipelines_on_unique_keys ON vulnerability_occurrence_pipelines USING btree (occurrence_id, pipeline_id); @@ -23629,6 +24109,12 @@ ALTER INDEX product_analytics_events_experimental_pkey ATTACH PARTITION gitlab_p CREATE TRIGGER table_sync_trigger_ee39a25f9d AFTER INSERT OR DELETE OR UPDATE ON audit_events FOR EACH ROW EXECUTE PROCEDURE table_sync_function_2be879775d(); +CREATE TRIGGER trigger_has_external_issue_tracker_on_delete AFTER DELETE ON services FOR EACH ROW WHEN ((((old.category)::text = 'issue_tracker'::text) AND (old.active = true) AND (old.project_id IS NOT NULL))) EXECUTE PROCEDURE set_has_external_issue_tracker(); + +CREATE TRIGGER trigger_has_external_issue_tracker_on_insert AFTER INSERT ON services FOR EACH ROW WHEN ((((new.category)::text = 'issue_tracker'::text) AND (new.active = true) AND (new.project_id IS NOT NULL))) EXECUTE PROCEDURE set_has_external_issue_tracker(); + +CREATE TRIGGER trigger_has_external_issue_tracker_on_update AFTER UPDATE ON services FOR EACH ROW WHEN ((((new.category)::text = 'issue_tracker'::text) AND (old.active <> new.active) AND (new.project_id IS NOT NULL))) EXECUTE PROCEDURE set_has_external_issue_tracker(); + CREATE TRIGGER trigger_has_external_wiki_on_delete AFTER DELETE ON services FOR EACH ROW WHEN ((((old.type)::text = 'ExternalWikiService'::text) AND (old.project_id IS NOT NULL))) EXECUTE PROCEDURE set_has_external_wiki(); CREATE TRIGGER trigger_has_external_wiki_on_insert AFTER INSERT ON services FOR EACH ROW WHEN (((new.active = true) AND ((new.type)::text = 'ExternalWikiService'::text) AND (new.project_id IS NOT NULL))) EXECUTE PROCEDURE set_has_external_wiki(); @@ -23893,6 +24379,9 @@ ALTER TABLE ONLY vulnerabilities ALTER TABLE ONLY index_statuses ADD CONSTRAINT fk_74b2492545 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; +ALTER TABLE ONLY cluster_agent_tokens + ADD CONSTRAINT fk_75008f3553 FOREIGN KEY (created_by_user_id) REFERENCES users(id) ON DELETE SET NULL; + ALTER TABLE ONLY vulnerabilities ADD CONSTRAINT fk_76bc5f5455 FOREIGN KEY (resolved_by_id) REFERENCES users(id) ON DELETE SET NULL; @@ -24058,6 +24547,9 @@ ALTER TABLE ONLY merge_requests ALTER TABLE ONLY epics ADD CONSTRAINT fk_aa5798e761 FOREIGN KEY (closed_by_id) REFERENCES users(id) ON DELETE SET NULL; +ALTER TABLE ONLY dast_profiles + ADD CONSTRAINT fk_aa76ef30e9 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; + ALTER TABLE ONLY alert_management_alerts ADD CONSTRAINT fk_aad61aedca FOREIGN KEY (environment_id) REFERENCES environments(id) ON DELETE SET NULL; @@ -24289,6 +24781,12 @@ ALTER TABLE ONLY ci_pipeline_variables ALTER TABLE ONLY design_management_designs_versions ADD CONSTRAINT fk_f4d25ba00c FOREIGN KEY (version_id) REFERENCES design_management_versions(id) ON DELETE CASCADE; +ALTER TABLE ONLY analytics_devops_adoption_segments + ADD CONSTRAINT fk_f5aa768998 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE; + +ALTER TABLE ONLY cluster_agents + ADD CONSTRAINT fk_f7d43dee13 FOREIGN KEY (created_by_user_id) REFERENCES users(id) ON DELETE SET NULL; + ALTER TABLE ONLY protected_tag_create_access_levels ADD CONSTRAINT fk_f7dfda8c51 FOREIGN KEY (protected_tag_id) REFERENCES protected_tags(id) ON DELETE CASCADE; @@ -24301,6 +24799,9 @@ ALTER TABLE ONLY system_note_metadata ALTER TABLE ONLY vulnerability_remediations ADD CONSTRAINT fk_fc61a535a0 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; +ALTER TABLE ONLY ci_daily_build_group_report_results + ADD CONSTRAINT fk_fd1858fefd FOREIGN KEY (group_id) REFERENCES namespaces(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; @@ -24370,6 +24871,9 @@ ALTER TABLE ONLY ci_subscriptions_projects ALTER TABLE ONLY trending_projects ADD CONSTRAINT fk_rails_09feecd872 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; +ALTER TABLE ONLY security_orchestration_policy_configurations + ADD CONSTRAINT fk_rails_0a22dcd52d FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; + ALTER TABLE ONLY project_deploy_tokens ADD CONSTRAINT fk_rails_0aca134388 FOREIGN KEY (deploy_token_id) REFERENCES deploy_tokens(id) ON DELETE CASCADE; @@ -24532,6 +25036,9 @@ ALTER TABLE ONLY service_desk_settings ALTER TABLE ONLY saml_group_links ADD CONSTRAINT fk_rails_22e312c530 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE; +ALTER TABLE ONLY dast_profiles + ADD CONSTRAINT fk_rails_23cae5abe1 FOREIGN KEY (dast_scanner_profile_id) REFERENCES dast_scanner_profiles(id) ON DELETE CASCADE; + ALTER TABLE ONLY group_custom_attributes ADD CONSTRAINT fk_rails_246e0db83a FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE; @@ -24577,6 +25084,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 packages_debian_group_component_files + ADD CONSTRAINT fk_rails_2b8992dd83 FOREIGN KEY (architecture_id) REFERENCES packages_debian_group_architectures(id) ON DELETE RESTRICT; + ALTER TABLE ONLY boards_epic_board_labels ADD CONSTRAINT fk_rails_2bedeb8799 FOREIGN KEY (label_id) REFERENCES labels(id) ON DELETE CASCADE; @@ -24703,6 +25213,9 @@ ALTER TABLE ONLY epic_issues ALTER TABLE ONLY ci_refs ADD CONSTRAINT fk_rails_4249db8cc3 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; +ALTER TABLE ONLY security_orchestration_policy_configurations + ADD CONSTRAINT fk_rails_42ed6c25ec FOREIGN KEY (security_policy_management_project_id) REFERENCES projects(id) ON DELETE RESTRICT; + ALTER TABLE ONLY ci_resources ADD CONSTRAINT fk_rails_430336af2d FOREIGN KEY (resource_group_id) REFERENCES ci_resource_groups(id) ON DELETE CASCADE; @@ -24721,9 +25234,6 @@ 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; @@ -24784,6 +25294,9 @@ ALTER TABLE ONLY aws_roles ALTER TABLE ONLY security_scans ADD CONSTRAINT fk_rails_4ef1e6b4c6 FOREIGN KEY (build_id) REFERENCES ci_builds(id) ON DELETE CASCADE; +ALTER TABLE ONLY packages_debian_publications + ADD CONSTRAINT fk_rails_4fc8ebd03e FOREIGN KEY (distribution_id) REFERENCES packages_debian_project_distributions(id) ON DELETE CASCADE; + ALTER TABLE ONLY merge_request_diff_files ADD CONSTRAINT fk_rails_501aa0a391 FOREIGN KEY (merge_request_diff_id) REFERENCES merge_request_diffs(id) ON DELETE CASCADE; @@ -24793,6 +25306,9 @@ ALTER TABLE ONLY resource_iteration_events ALTER TABLE ONLY status_page_settings ADD CONSTRAINT fk_rails_506e5ba391 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; +ALTER TABLE ONLY ci_project_monthly_usages + ADD CONSTRAINT fk_rails_508bcd4aa6 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; + ALTER TABLE ONLY project_repository_storage_moves ADD CONSTRAINT fk_rails_5106dbd44a FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; @@ -25027,6 +25543,9 @@ ALTER TABLE ONLY x509_certificates ALTER TABLE ONLY pages_domain_acme_orders ADD CONSTRAINT fk_rails_76581b1c16 FOREIGN KEY (pages_domain_id) REFERENCES pages_domains(id) ON DELETE CASCADE; +ALTER TABLE ONLY packages_debian_publications + ADD CONSTRAINT fk_rails_7668c1d606 FOREIGN KEY (package_id) REFERENCES packages_packages(id) ON DELETE CASCADE; + ALTER TABLE ONLY boards_epic_user_preferences ADD CONSTRAINT fk_rails_76c4e9732d FOREIGN KEY (epic_id) REFERENCES epics(id) ON DELETE CASCADE; @@ -25171,12 +25690,18 @@ ALTER TABLE ONLY scim_identities ALTER TABLE ONLY packages_debian_project_distributions ADD CONSTRAINT fk_rails_94b95e1f84 FOREIGN KEY (creator_id) REFERENCES users(id) ON DELETE SET NULL; +ALTER TABLE ONLY packages_rubygems_metadata + ADD CONSTRAINT fk_rails_95a3f5ce78 FOREIGN KEY (package_id) REFERENCES packages_packages(id) ON DELETE CASCADE; + ALTER TABLE ONLY packages_pypi_metadata ADD CONSTRAINT fk_rails_9698717cdd FOREIGN KEY (package_id) REFERENCES packages_packages(id) ON DELETE CASCADE; ALTER TABLE ONLY packages_dependency_links ADD CONSTRAINT fk_rails_96ef1c00d3 FOREIGN KEY (package_id) REFERENCES packages_packages(id) ON DELETE CASCADE; +ALTER TABLE ONLY group_repository_storage_moves + ADD CONSTRAINT fk_rails_982bb5daf1 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE; + ALTER TABLE ONLY resource_label_events ADD CONSTRAINT fk_rails_9851a00031 FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE; @@ -25201,6 +25726,9 @@ ALTER TABLE ONLY users_ops_dashboard_projects ALTER TABLE ONLY project_incident_management_settings ADD CONSTRAINT fk_rails_9c2ea1b7dd FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; +ALTER TABLE ONLY packages_debian_project_components + ADD CONSTRAINT fk_rails_9d072b5073 FOREIGN KEY (distribution_id) REFERENCES packages_debian_project_distributions(id) ON DELETE CASCADE; + ALTER TABLE ONLY gpg_keys ADD CONSTRAINT fk_rails_9d1f5d8719 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE; @@ -25336,14 +25864,17 @@ ALTER TABLE ONLY merge_trains ALTER TABLE ONLY application_settings ADD CONSTRAINT fk_rails_b53e481273 FOREIGN KEY (custom_project_templates_group_id) REFERENCES namespaces(id) ON DELETE SET NULL; +ALTER TABLE ONLY packages_debian_project_component_files + ADD CONSTRAINT fk_rails_b543a9622b FOREIGN KEY (architecture_id) REFERENCES packages_debian_project_architectures(id) ON DELETE RESTRICT; + ALTER TABLE ONLY namespace_aggregation_schedules ADD CONSTRAINT fk_rails_b565c8d16c FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE; ALTER TABLE ONLY approval_project_rules_protected_branches ADD CONSTRAINT fk_rails_b7567b031b FOREIGN KEY (protected_branch_id) REFERENCES protected_branches(id) ON DELETE CASCADE; -ALTER TABLE ONLY alerts_service_data - ADD CONSTRAINT fk_rails_b93215a42c FOREIGN KEY (service_id) REFERENCES services(id) ON DELETE CASCADE; +ALTER TABLE ONLY packages_composer_cache_files + ADD CONSTRAINT fk_rails_b82cea43a0 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE SET NULL; ALTER TABLE ONLY merge_trains ADD CONSTRAINT fk_rails_b9d67af01d FOREIGN KEY (target_project_id) REFERENCES projects(id) ON DELETE CASCADE; @@ -25357,6 +25888,9 @@ ALTER TABLE ONLY lists ALTER TABLE ONLY security_findings ADD CONSTRAINT fk_rails_bb63863cf1 FOREIGN KEY (scan_id) REFERENCES security_scans(id) ON DELETE CASCADE; +ALTER TABLE ONLY packages_debian_project_component_files + ADD CONSTRAINT fk_rails_bbe9ebfbd9 FOREIGN KEY (component_id) REFERENCES packages_debian_project_components(id) ON DELETE RESTRICT; + ALTER TABLE ONLY approval_merge_request_rules_users ADD CONSTRAINT fk_rails_bc8972fa55 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE; @@ -25525,6 +26059,9 @@ ALTER TABLE ONLY vulnerability_occurrence_pipelines ALTER TABLE ONLY deployment_merge_requests ADD CONSTRAINT fk_rails_dcbce9f4df FOREIGN KEY (deployment_id) REFERENCES deployments(id) ON DELETE CASCADE; +ALTER TABLE ONLY packages_debian_group_component_files + ADD CONSTRAINT fk_rails_dd262386e9 FOREIGN KEY (component_id) REFERENCES packages_debian_group_components(id) ON DELETE RESTRICT; + ALTER TABLE ONLY user_callouts ADD CONSTRAINT fk_rails_ddfdd80f3d FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE; @@ -25606,6 +26143,9 @@ ALTER TABLE ONLY alert_management_alert_user_mentions ALTER TABLE ONLY snippet_statistics ADD CONSTRAINT fk_rails_ebc283ccf1 FOREIGN KEY (snippet_id) REFERENCES snippets(id) ON DELETE CASCADE; +ALTER TABLE ONLY dast_profiles + ADD CONSTRAINT fk_rails_ed1e66fbbf FOREIGN KEY (dast_site_profile_id) REFERENCES dast_site_profiles(id) ON DELETE CASCADE; + ALTER TABLE ONLY project_security_settings ADD CONSTRAINT fk_rails_ed4abe1338 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; @@ -25660,6 +26200,9 @@ ALTER TABLE ONLY board_group_recent_visits ALTER TABLE ONLY resource_state_events ADD CONSTRAINT fk_rails_f5827a7ccd FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL; +ALTER TABLE ONLY packages_debian_group_components + ADD CONSTRAINT fk_rails_f5f1ef54c6 FOREIGN KEY (distribution_id) REFERENCES packages_debian_group_distributions(id) ON DELETE CASCADE; + ALTER TABLE ONLY incident_management_oncall_shifts ADD CONSTRAINT fk_rails_f6eef06841 FOREIGN KEY (participant_id) REFERENCES incident_management_oncall_participants(id) ON DELETE CASCADE; @@ -25684,6 +26227,9 @@ ALTER TABLE ONLY merge_trains ALTER TABLE ONLY ci_runner_namespaces ADD CONSTRAINT fk_rails_f9d9ed3308 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE; +ALTER TABLE ONLY vulnerability_finding_fingerprints + ADD CONSTRAINT fk_rails_fa411253b2 FOREIGN KEY (finding_id) REFERENCES vulnerability_occurrences(id) ON DELETE CASCADE; + ALTER TABLE ONLY requirements_management_test_reports ADD CONSTRAINT fk_rails_fb3308ad55 FOREIGN KEY (requirement_id) REFERENCES requirements(id) ON DELETE CASCADE; @@ -25730,6 +26276,12 @@ ALTER TABLE ONLY u2f_registrations ADD CONSTRAINT fk_u2f_registrations_user_id FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE; ALTER TABLE product_analytics_events_experimental - ADD CONSTRAINT product_analytics_events_experimental_project_id_fkey FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;-- schema_migrations.version information is no longer stored in this file, + ADD CONSTRAINT product_analytics_events_experimental_project_id_fkey FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; + +ALTER TABLE ONLY user_follow_users + ADD CONSTRAINT user_follow_users_followee_id_fkey FOREIGN KEY (followee_id) REFERENCES users(id) ON DELETE CASCADE; + +ALTER TABLE ONLY user_follow_users + ADD CONSTRAINT user_follow_users_follower_id_fkey FOREIGN KEY (follower_id) REFERENCES users(id) ON DELETE CASCADE;-- schema_migrations.version information is no longer stored in this file, -- but instead tracked in the db/schema_migrations directory -- see https://gitlab.com/gitlab-org/gitlab/-/issues/218590 for details |