diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 14:34:42 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 14:34:42 +0000 |
commit | 9f46488805e86b1bc341ea1620b866016c2ce5ed (patch) | |
tree | f9748c7e287041e37d6da49e0a29c9511dc34768 /db | |
parent | dfc92d081ea0332d69c8aca2f0e745cb48ae5e6d (diff) | |
download | gitlab-ce-9f46488805e86b1bc341ea1620b866016c2ce5ed.tar.gz |
Add latest changes from gitlab-org/gitlab@13-0-stable-ee
Diffstat (limited to 'db')
374 files changed, 3618 insertions, 297 deletions
diff --git a/db/migrate/20171230123729_init_schema.rb b/db/migrate/20171230123729_init_schema.rb index 79c9ebbb691..99ff85ff01f 100644 --- a/db/migrate/20171230123729_init_schema.rb +++ b/db/migrate/20171230123729_init_schema.rb @@ -5,7 +5,8 @@ # rubocop:disable Metrics/AbcSize # rubocop:disable Migration/AddConcurrentForeignKey # rubocop:disable Style/WordArray -# rubocop:disable Migration/AddLimitToStringColumns +# rubocop:disable Migration/PreventStrings +# rubocop:disable Migration/AddLimitToTextColumns # rubocop:disable Migration/Datetime class InitSchema < ActiveRecord::Migration[4.2] @@ -1854,4 +1855,5 @@ class InitSchema < ActiveRecord::Migration[4.2] raise ActiveRecord::IrreversibleMigration, "The initial migration is not revertable" end end -# rubocop:enable Migration/AddLimitToStringColumns +# rubocop:enable Migration/AddLimitToTextColumns +# rubocop:enable Migration/PreventStrings diff --git a/db/migrate/20180101160629_create_prometheus_metrics.rb b/db/migrate/20180101160629_create_prometheus_metrics.rb index a098b999a0a..f94abd0e76e 100644 --- a/db/migrate/20180101160629_create_prometheus_metrics.rb +++ b/db/migrate/20180101160629_create_prometheus_metrics.rb @@ -3,8 +3,8 @@ class CreatePrometheusMetrics < ActiveRecord::Migration[4.2] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change - # rubocop:disable Migration/AddLimitToStringColumns create_table :prometheus_metrics do |t| t.references :project, index: true, foreign_key: { on_delete: :cascade }, null: false t.string :title, null: false @@ -15,6 +15,6 @@ class CreatePrometheusMetrics < ActiveRecord::Migration[4.2] t.integer :group, null: false, index: true t.timestamps_with_timezone null: false end - # rubocop:enable Migration/AddLimitToStringColumns end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20180115094742_add_default_project_creation_setting.rb b/db/migrate/20180115094742_add_default_project_creation_setting.rb index 465a89c39e8..b19e588ece3 100644 --- a/db/migrate/20180115094742_add_default_project_creation_setting.rb +++ b/db/migrate/20180115094742_add_default_project_creation_setting.rb @@ -7,7 +7,7 @@ class AddDefaultProjectCreationSetting < ActiveRecord::Migration[4.2] def up unless column_exists?(:application_settings, :default_project_creation) - add_column_with_default(:application_settings, :default_project_creation, :integer, default: 2) + add_column_with_default(:application_settings, :default_project_creation, :integer, default: 2) # rubocop:disable Migration/AddColumnWithDefault end end diff --git a/db/migrate/20180116193854_create_lfs_file_locks.rb b/db/migrate/20180116193854_create_lfs_file_locks.rb index b94f69ad42e..6d49281dca2 100644 --- a/db/migrate/20180116193854_create_lfs_file_locks.rb +++ b/db/migrate/20180116193854_create_lfs_file_locks.rb @@ -10,7 +10,7 @@ class CreateLfsFileLocks < ActiveRecord::Migration[4.2] t.references :project, null: false, foreign_key: { on_delete: :cascade } t.references :user, null: false, index: true, foreign_key: { on_delete: :cascade } t.datetime :created_at, null: false # rubocop:disable Migration/Datetime - t.string :path, limit: 511 + t.string :path, limit: 511 # rubocop:disable Migration/PreventStrings end add_index :lfs_file_locks, [:project_id, :path], unique: true diff --git a/db/migrate/20180122162010_add_auto_devops_domain_to_application_settings.rb b/db/migrate/20180122162010_add_auto_devops_domain_to_application_settings.rb index eb446ad0d72..603f4eb13db 100644 --- a/db/migrate/20180122162010_add_auto_devops_domain_to_application_settings.rb +++ b/db/migrate/20180122162010_add_auto_devops_domain_to_application_settings.rb @@ -7,7 +7,9 @@ class AddAutoDevopsDomainToApplicationSettings < ActiveRecord::Migration[4.2] # Set this constant to true if this migration requires downtime. DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change - add_column :application_settings, :auto_devops_domain, :string # rubocop:disable Migration/AddLimitToStringColumns + add_column :application_settings, :auto_devops_domain, :string end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20180129193323_add_uploads_builder_context.rb b/db/migrate/20180129193323_add_uploads_builder_context.rb index 710fa7b3ba8..308b732dca4 100644 --- a/db/migrate/20180129193323_add_uploads_builder_context.rb +++ b/db/migrate/20180129193323_add_uploads_builder_context.rb @@ -7,10 +7,10 @@ class AddUploadsBuilderContext < ActiveRecord::Migration[4.2] # Set this constant to true if this migration requires downtime. DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change - # rubocop:disable Migration/AddLimitToStringColumns add_column :uploads, :mount_point, :string add_column :uploads, :secret, :string - # rubocop:enable Migration/AddLimitToStringColumns end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20180209115333_create_chatops_tables.rb b/db/migrate/20180209115333_create_chatops_tables.rb index 2cfb71e1007..9e11dfde7a3 100644 --- a/db/migrate/20180209115333_create_chatops_tables.rb +++ b/db/migrate/20180209115333_create_chatops_tables.rb @@ -9,7 +9,7 @@ class CreateChatopsTables < ActiveRecord::Migration[4.2] create_table :ci_pipeline_chat_data, id: :bigserial do |t| t.integer :pipeline_id, null: false t.references :chat_name, foreign_key: { on_delete: :cascade }, null: false - t.text :response_url, null: false + t.text :response_url, null: false # rubocop:disable Migration/AddLimitToTextColumns # A pipeline can only contain one row in this table, hence this index is # unique. diff --git a/db/migrate/20180212030105_add_external_ip_to_clusters_applications_ingress.rb b/db/migrate/20180212030105_add_external_ip_to_clusters_applications_ingress.rb index 78aa2014601..78bb49b8b84 100644 --- a/db/migrate/20180212030105_add_external_ip_to_clusters_applications_ingress.rb +++ b/db/migrate/20180212030105_add_external_ip_to_clusters_applications_ingress.rb @@ -3,7 +3,9 @@ class AddExternalIpToClustersApplicationsIngress < ActiveRecord::Migration[4.2] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change - add_column :clusters_applications_ingress, :external_ip, :string # rubocop:disable Migration/AddLimitToStringColumns + add_column :clusters_applications_ingress, :external_ip, :string end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20180214093516_create_badges.rb b/db/migrate/20180214093516_create_badges.rb index fe27d465571..7a0d82d2d81 100644 --- a/db/migrate/20180214093516_create_badges.rb +++ b/db/migrate/20180214093516_create_badges.rb @@ -1,8 +1,8 @@ class CreateBadges < ActiveRecord::Migration[4.2] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change - # rubocop:disable Migration/AddLimitToStringColumns create_table :badges do |t| t.string :link_url, null: false t.string :image_url, null: false @@ -12,9 +12,10 @@ class CreateBadges < ActiveRecord::Migration[4.2] t.timestamps_with_timezone null: false end - # rubocop:enable Migration/AddLimitToStringColumns # rubocop:disable Migration/AddConcurrentForeignKey add_foreign_key :badges, :namespaces, column: :group_id, on_delete: :cascade + # rubocop:enable Migration/AddConcurrentForeignKey end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20180214155405_create_clusters_applications_runners.rb b/db/migrate/20180214155405_create_clusters_applications_runners.rb index f611fefbb0d..e6025007507 100644 --- a/db/migrate/20180214155405_create_clusters_applications_runners.rb +++ b/db/migrate/20180214155405_create_clusters_applications_runners.rb @@ -13,8 +13,8 @@ class CreateClustersApplicationsRunners < ActiveRecord::Migration[4.2] t.index :cluster_id, unique: true t.integer :status, null: false t.timestamps_with_timezone null: false - t.string :version, null: false # rubocop:disable Migration/AddLimitToStringColumns - t.text :status_reason + t.string :version, null: false # rubocop:disable Migration/PreventStrings + t.text :status_reason # rubocop:disable Migration/AddLimitToTextColumns end add_concurrent_foreign_key :clusters_applications_runners, :ci_runners, diff --git a/db/migrate/20180216120000_add_pages_domain_verification.rb b/db/migrate/20180216120000_add_pages_domain_verification.rb index b2f19f2e1a9..0600fe633a7 100644 --- a/db/migrate/20180216120000_add_pages_domain_verification.rb +++ b/db/migrate/20180216120000_add_pages_domain_verification.rb @@ -3,6 +3,6 @@ class AddPagesDomainVerification < ActiveRecord::Migration[4.2] def change add_column :pages_domains, :verified_at, :datetime_with_timezone - add_column :pages_domains, :verification_code, :string # rubocop:disable Migration/AddLimitToStringColumns + add_column :pages_domains, :verification_code, :string # rubocop:disable Migration/PreventStrings end end diff --git a/db/migrate/20180222043024_add_ip_address_to_runner.rb b/db/migrate/20180222043024_add_ip_address_to_runner.rb index 08fb0bd900c..cc183112f6f 100644 --- a/db/migrate/20180222043024_add_ip_address_to_runner.rb +++ b/db/migrate/20180222043024_add_ip_address_to_runner.rb @@ -4,6 +4,6 @@ class AddIpAddressToRunner < ActiveRecord::Migration[4.2] DOWNTIME = false def change - add_column :ci_runners, :ip_address, :string # rubocop:disable Migration/AddLimitToStringColumns + add_column :ci_runners, :ip_address, :string # rubocop:disable Migration/PreventStrings end end diff --git a/db/migrate/20180223144945_add_allow_local_requests_from_hooks_and_services_to_application_settings.rb b/db/migrate/20180223144945_add_allow_local_requests_from_hooks_and_services_to_application_settings.rb index 3bd7d6fd827..3171ff56299 100644 --- a/db/migrate/20180223144945_add_allow_local_requests_from_hooks_and_services_to_application_settings.rb +++ b/db/migrate/20180223144945_add_allow_local_requests_from_hooks_and_services_to_application_settings.rb @@ -6,7 +6,7 @@ class AddAllowLocalRequestsFromHooksAndServicesToApplicationSettings < ActiveRec disable_ddl_transaction! def up - add_column_with_default(:application_settings, :allow_local_requests_from_hooks_and_services, + add_column_with_default(:application_settings, :allow_local_requests_from_hooks_and_services, # rubocop:disable Migration/AddColumnWithDefault :boolean, default: false, allow_null: false) diff --git a/db/migrate/20180305144721_add_privileged_to_runner.rb b/db/migrate/20180305144721_add_privileged_to_runner.rb index 359498bf9b0..1ad3c045d60 100644 --- a/db/migrate/20180305144721_add_privileged_to_runner.rb +++ b/db/migrate/20180305144721_add_privileged_to_runner.rb @@ -9,7 +9,7 @@ class AddPrivilegedToRunner < ActiveRecord::Migration[4.2] disable_ddl_transaction! def up - add_column_with_default :clusters_applications_runners, :privileged, :boolean, default: true, allow_null: false + add_column_with_default :clusters_applications_runners, :privileged, :boolean, default: true, allow_null: false # rubocop:disable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20180308125206_add_user_internal_regex_to_application_setting.rb b/db/migrate/20180308125206_add_user_internal_regex_to_application_setting.rb index 9bdd44baf58..d97d2953677 100644 --- a/db/migrate/20180308125206_add_user_internal_regex_to_application_setting.rb +++ b/db/migrate/20180308125206_add_user_internal_regex_to_application_setting.rb @@ -3,9 +3,11 @@ class AddUserInternalRegexToApplicationSetting < ActiveRecord::Migration[4.2] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def up - add_column :application_settings, :user_default_internal_regex, :string, null: true # rubocop:disable Migration/AddLimitToStringColumns + add_column :application_settings, :user_default_internal_regex, :string, null: true end + # rubocop:enable Migration/PreventStrings def down remove_column :application_settings, :user_default_internal_regex diff --git a/db/migrate/20180314145917_add_header_and_footer_banners_to_appearances_table.rb b/db/migrate/20180314145917_add_header_and_footer_banners_to_appearances_table.rb index 8aba3448035..a6f2605c906 100644 --- a/db/migrate/20180314145917_add_header_and_footer_banners_to_appearances_table.rb +++ b/db/migrate/20180314145917_add_header_and_footer_banners_to_appearances_table.rb @@ -6,6 +6,7 @@ class AddHeaderAndFooterBannersToAppearancesTable < ActiveRecord::Migration[4.2] DOWNTIME = false def change + # rubocop:disable Migration/AddLimitToTextColumns add_column :appearances, :header_message, :text add_column :appearances, :header_message_html, :text @@ -14,5 +15,6 @@ class AddHeaderAndFooterBannersToAppearancesTable < ActiveRecord::Migration[4.2] add_column :appearances, :message_background_color, :text add_column :appearances, :message_font_color, :text + # rubocop:enable Migration/AddLimitToTextColumns end end diff --git a/db/migrate/20180315160435_add_external_auth_mutual_tls_fields_to_project_settings.rb b/db/migrate/20180315160435_add_external_auth_mutual_tls_fields_to_project_settings.rb index c379d207ff0..dd40c5fdf4d 100644 --- a/db/migrate/20180315160435_add_external_auth_mutual_tls_fields_to_project_settings.rb +++ b/db/migrate/20180315160435_add_external_auth_mutual_tls_fields_to_project_settings.rb @@ -1,8 +1,9 @@ class AddExternalAuthMutualTlsFieldsToProjectSettings < ActiveRecord::Migration[4.2] DOWNTIME = false + # rubocop:disable Migration/PreventStrings + # rubocop:disable Migration/AddLimitToTextColumns def change - # rubocop:disable Migration/AddLimitToStringColumns add_column :application_settings, :external_auth_client_cert, :text add_column :application_settings, @@ -13,6 +14,7 @@ class AddExternalAuthMutualTlsFieldsToProjectSettings < ActiveRecord::Migration[ :encrypted_external_auth_client_key_pass, :string add_column :application_settings, :encrypted_external_auth_client_key_pass_iv, :string - # rubocop:enable Migration/AddLimitToStringColumns end + # rubocop:enable Migration/AddLimitToTextColumns + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20180319190020_create_deploy_tokens.rb b/db/migrate/20180319190020_create_deploy_tokens.rb index f444521b3ae..019543cb2f1 100644 --- a/db/migrate/20180319190020_create_deploy_tokens.rb +++ b/db/migrate/20180319190020_create_deploy_tokens.rb @@ -1,8 +1,8 @@ class CreateDeployTokens < ActiveRecord::Migration[4.2] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change - # rubocop:disable Migration/AddLimitToStringColumns create_table :deploy_tokens do |t| t.boolean :revoked, default: false t.boolean :read_repository, null: false, default: false @@ -16,6 +16,6 @@ class CreateDeployTokens < ActiveRecord::Migration[4.2] t.index [:token, :expires_at, :id], where: "(revoked IS FALSE)" end - # rubocop:enable Migration/AddLimitToStringColumns end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20180424134533_create_application_setting_terms.rb b/db/migrate/20180424134533_create_application_setting_terms.rb index 8741f20daeb..41edb8a9559 100644 --- a/db/migrate/20180424134533_create_application_setting_terms.rb +++ b/db/migrate/20180424134533_create_application_setting_terms.rb @@ -3,6 +3,7 @@ class CreateApplicationSettingTerms < ActiveRecord::Migration[4.2] DOWNTIME = false + # rubocop:disable Migration/AddLimitToTextColumns def change create_table :application_setting_terms do |t| t.integer :cached_markdown_version @@ -10,4 +11,5 @@ class CreateApplicationSettingTerms < ActiveRecord::Migration[4.2] t.text :terms_html end end + # rubocop:enable Migration/AddLimitToTextColumns end diff --git a/db/migrate/20180502122856_create_project_mirror_data.rb b/db/migrate/20180502122856_create_project_mirror_data.rb index 04367e1c98b..1ecfd8926fb 100644 --- a/db/migrate/20180502122856_create_project_mirror_data.rb +++ b/db/migrate/20180502122856_create_project_mirror_data.rb @@ -3,7 +3,8 @@ class CreateProjectMirrorData < ActiveRecord::Migration[4.2] DOWNTIME = false - # rubocop:disable Migration/AddLimitToStringColumns + # rubocop:disable Migration/PreventStrings + # rubocop:disable Migration/AddLimitToTextColumns def up if table_exists?(:project_mirror_data) add_column :project_mirror_data, :status, :string unless column_exists?(:project_mirror_data, :status) @@ -18,7 +19,8 @@ class CreateProjectMirrorData < ActiveRecord::Migration[4.2] end end end - # rubocop:enable Migration/AddLimitToStringColumns + # rubocop:enable Migration/AddLimitToTextColumns + # rubocop:enable Migration/PreventStrings def down remove_column :project_mirror_data, :status diff --git a/db/migrate/20180503131624_create_remote_mirrors.rb b/db/migrate/20180503131624_create_remote_mirrors.rb index 80090c14314..330a0d8f62d 100644 --- a/db/migrate/20180503131624_create_remote_mirrors.rb +++ b/db/migrate/20180503131624_create_remote_mirrors.rb @@ -5,7 +5,7 @@ class CreateRemoteMirrors < ActiveRecord::Migration[4.2] disable_ddl_transaction! - # rubocop:disable Migration/AddLimitToStringColumns + # rubocop:disable Migration/PreventStrings def up return if table_exists?(:remote_mirrors) @@ -20,7 +20,7 @@ class CreateRemoteMirrors < ActiveRecord::Migration[4.2] t.string :last_error t.boolean :only_protected_branches, default: false, null: false t.string :remote_name - t.text :encrypted_credentials + t.text :encrypted_credentials # rubocop:disable Migration/AddLimitToTextColumns t.string :encrypted_credentials_iv t.string :encrypted_credentials_salt @@ -28,7 +28,7 @@ class CreateRemoteMirrors < ActiveRecord::Migration[4.2] t.timestamps null: false end end - # rubocop:enable Migration/AddLimitToStringColumns + # rubocop:enable Migration/PreventStrings def down # ee/db/migrate/20160321161032_create_remote_mirrors_ee.rb will remove the table diff --git a/db/migrate/20180503175053_ensure_missing_columns_to_project_mirror_data.rb b/db/migrate/20180503175053_ensure_missing_columns_to_project_mirror_data.rb index f00493ed515..12ebac47850 100644 --- a/db/migrate/20180503175053_ensure_missing_columns_to_project_mirror_data.rb +++ b/db/migrate/20180503175053_ensure_missing_columns_to_project_mirror_data.rb @@ -3,11 +3,15 @@ class EnsureMissingColumnsToProjectMirrorData < ActiveRecord::Migration[4.2] DOWNTIME = false + # rubocop:disable Migration/AddLimitToTextColumns + # rubocop:disable Migration/PreventStrings def up - add_column :project_mirror_data, :status, :string unless column_exists?(:project_mirror_data, :status) # rubocop:disable Migration/AddLimitToStringColumns - add_column :project_mirror_data, :jid, :string unless column_exists?(:project_mirror_data, :jid) # rubocop:disable Migration/AddLimitToStringColumns + add_column :project_mirror_data, :status, :string unless column_exists?(:project_mirror_data, :status) + add_column :project_mirror_data, :jid, :string unless column_exists?(:project_mirror_data, :jid) add_column :project_mirror_data, :last_error, :text unless column_exists?(:project_mirror_data, :last_error) end + # rubocop:enable Migration/PreventStrings + # rubocop:enable Migration/AddLimitToTextColumns def down # db/migrate/20180502122856_create_project_mirror_data.rb will remove the table diff --git a/db/migrate/20180503193953_add_mirror_available_to_application_settings.rb b/db/migrate/20180503193953_add_mirror_available_to_application_settings.rb index d6a04035d48..117887a8bc2 100644 --- a/db/migrate/20180503193953_add_mirror_available_to_application_settings.rb +++ b/db/migrate/20180503193953_add_mirror_available_to_application_settings.rb @@ -6,7 +6,9 @@ class AddMirrorAvailableToApplicationSettings < ActiveRecord::Migration[4.2] disable_ddl_transaction! def up + # rubocop:disable Migration/AddColumnWithDefault add_column_with_default(:application_settings, :mirror_available, :boolean, default: true, allow_null: false) unless column_exists?(:application_settings, :mirror_available) + # rubocop:enable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20180511131058_create_clusters_applications_jupyter.rb b/db/migrate/20180511131058_create_clusters_applications_jupyter.rb index 4633d930e2d..908a6113f98 100644 --- a/db/migrate/20180511131058_create_clusters_applications_jupyter.rb +++ b/db/migrate/20180511131058_create_clusters_applications_jupyter.rb @@ -6,20 +6,20 @@ class CreateClustersApplicationsJupyter < ActiveRecord::Migration[4.2] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change - # rubocop:disable Migration/AddLimitToStringColumns create_table :clusters_applications_jupyter do |t| t.references :cluster, null: false, unique: true, foreign_key: { on_delete: :cascade } t.references :oauth_application, foreign_key: { on_delete: :nullify } t.integer :status, null: false - t.string :version, null: false # rubocop:disable Migration/AddLimitToStringColumns - t.string :hostname # rubocop:disable Migration/AddLimitToStringColumns + t.string :version, null: false + t.string :hostname t.timestamps_with_timezone null: false - t.text :status_reason + t.text :status_reason # rubocop:disable Migration/AddLimitToTextColumns end - # rubocop:enable Migration/AddLimitToStringColumns end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20180515121227_create_notes_diff_files.rb b/db/migrate/20180515121227_create_notes_diff_files.rb index 5f6dba11ff9..1797a86c679 100644 --- a/db/migrate/20180515121227_create_notes_diff_files.rb +++ b/db/migrate/20180515121227_create_notes_diff_files.rb @@ -3,8 +3,9 @@ class CreateNotesDiffFiles < ActiveRecord::Migration[4.2] disable_ddl_transaction! + # rubocop:disable Migration/AddLimitToTextColumns + # rubocop:disable Migration/PreventStrings def change - # rubocop:disable Migration/AddLimitToStringColumns create_table :note_diff_files do |t| t.references :diff_note, references: :notes, null: false, index: { unique: true } t.text :diff, null: false @@ -19,6 +20,8 @@ class CreateNotesDiffFiles < ActiveRecord::Migration[4.2] # rubocop:disable Migration/AddConcurrentForeignKey add_foreign_key :note_diff_files, :notes, column: :diff_note_id, on_delete: :cascade - # rubocop:enable Migration/AddLimitToStringColumns + # rubocop:enable Migration/AddConcurrentForeignKey end + # rubocop:enable Migration/PreventStrings + # rubocop:enable Migration/AddLimitToTextColumns end diff --git a/db/migrate/20180529093006_ensure_remote_mirror_columns.rb b/db/migrate/20180529093006_ensure_remote_mirror_columns.rb index a0a1150f022..8cf636e1da6 100644 --- a/db/migrate/20180529093006_ensure_remote_mirror_columns.rb +++ b/db/migrate/20180529093006_ensure_remote_mirror_columns.rb @@ -5,19 +5,22 @@ class EnsureRemoteMirrorColumns < ActiveRecord::Migration[4.2] disable_ddl_transaction! + # rubocop:disable Migration/Datetime + # rubocop:disable Migration/PreventStrings def up - # rubocop:disable Migration/Datetime add_column :remote_mirrors, :last_update_started_at, :datetime unless column_exists?(:remote_mirrors, :last_update_started_at) - add_column :remote_mirrors, :remote_name, :string unless column_exists?(:remote_mirrors, :remote_name) # rubocop:disable Migration/AddLimitToStringColumns + add_column :remote_mirrors, :remote_name, :string unless column_exists?(:remote_mirrors, :remote_name) unless column_exists?(:remote_mirrors, :only_protected_branches) - add_column_with_default(:remote_mirrors, + add_column_with_default(:remote_mirrors, # rubocop:disable Migration/AddColumnWithDefault :only_protected_branches, :boolean, default: false, allow_null: false) end end + # rubocop:enable Migration/PreventStrings + # rubocop:enable Migration/Datetime def down # db/migrate/20180503131624_create_remote_mirrors.rb will remove the table diff --git a/db/migrate/20180531185349_add_repository_languages.rb b/db/migrate/20180531185349_add_repository_languages.rb index d517c21c26c..08871e8b6f0 100644 --- a/db/migrate/20180531185349_add_repository_languages.rb +++ b/db/migrate/20180531185349_add_repository_languages.rb @@ -3,8 +3,8 @@ class AddRepositoryLanguages < ActiveRecord::Migration[4.2] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def up - # rubocop:disable Migration/AddLimitToStringColumns create_table(:programming_languages) do |t| t.string :name, null: false t.string :color, null: false @@ -20,8 +20,8 @@ class AddRepositoryLanguages < ActiveRecord::Migration[4.2] add_index :programming_languages, :name, unique: true add_index :repository_languages, [:project_id, :programming_language_id], unique: true, name: "index_repository_languages_on_project_and_languages_id" - # rubocop:enable Migration/AddLimitToStringColumns end + # rubocop:enable Migration/PreventStrings def down drop_table :repository_languages diff --git a/db/migrate/20180601213245_add_deploy_strategy_to_project_auto_devops.rb b/db/migrate/20180601213245_add_deploy_strategy_to_project_auto_devops.rb index 78a3617ec93..67d20b949d9 100644 --- a/db/migrate/20180601213245_add_deploy_strategy_to_project_auto_devops.rb +++ b/db/migrate/20180601213245_add_deploy_strategy_to_project_auto_devops.rb @@ -10,7 +10,7 @@ class AddDeployStrategyToProjectAutoDevops < ActiveRecord::Migration[4.2] disable_ddl_transaction! def up - add_column_with_default :project_auto_devops, :deploy_strategy, :integer, default: 0, allow_null: false + add_column_with_default :project_auto_devops, :deploy_strategy, :integer, default: 0, allow_null: false # rubocop:disable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20180607071808_add_push_events_branch_filter_to_web_hooks.rb b/db/migrate/20180607071808_add_push_events_branch_filter_to_web_hooks.rb index e6a1daaffc2..42bb0a784bb 100644 --- a/db/migrate/20180607071808_add_push_events_branch_filter_to_web_hooks.rb +++ b/db/migrate/20180607071808_add_push_events_branch_filter_to_web_hooks.rb @@ -7,6 +7,6 @@ class AddPushEventsBranchFilterToWebHooks < ActiveRecord::Migration[4.2] DOWNTIME = false def change - add_column :web_hooks, :push_events_branch_filter, :text + add_column :web_hooks, :push_events_branch_filter, :text # rubocop:disable Migration/AddLimitToTextColumns end end diff --git a/db/migrate/20180612103626_add_columns_for_helm_tiller_certificates.rb b/db/migrate/20180612103626_add_columns_for_helm_tiller_certificates.rb index d7273dff48e..515aab45145 100644 --- a/db/migrate/20180612103626_add_columns_for_helm_tiller_certificates.rb +++ b/db/migrate/20180612103626_add_columns_for_helm_tiller_certificates.rb @@ -4,9 +4,11 @@ class AddColumnsForHelmTillerCertificates < ActiveRecord::Migration[4.2] DOWNTIME = false + # rubocop:disable Migration/AddLimitToTextColumns def change add_column :clusters_applications_helm, :encrypted_ca_key, :text add_column :clusters_applications_helm, :encrypted_ca_key_iv, :text add_column :clusters_applications_helm, :ca_cert, :text end + # rubocop:enable Migration/AddLimitToTextColumns end diff --git a/db/migrate/20180613081317_create_ci_builds_runner_session.rb b/db/migrate/20180613081317_create_ci_builds_runner_session.rb index 68af38834d2..29e133de1b7 100644 --- a/db/migrate/20180613081317_create_ci_builds_runner_session.rb +++ b/db/migrate/20180613081317_create_ci_builds_runner_session.rb @@ -7,8 +7,8 @@ class CreateCiBuildsRunnerSession < ActiveRecord::Migration[4.2] # Set this constant to true if this migration requires downtime. DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change - # rubocop:disable Migration/AddLimitToStringColumns create_table :ci_builds_runner_session, id: :bigserial do |t| t.integer :build_id, null: false t.string :url, null: false @@ -18,6 +18,6 @@ class CreateCiBuildsRunnerSession < ActiveRecord::Migration[4.2] t.foreign_key :ci_builds, column: :build_id, on_delete: :cascade t.index :build_id, unique: true end - # rubocop:enable Migration/AddLimitToStringColumns end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20180625113853_create_import_export_uploads.rb b/db/migrate/20180625113853_create_import_export_uploads.rb index d76b3e8cc15..2fe5a1e7f6b 100644 --- a/db/migrate/20180625113853_create_import_export_uploads.rb +++ b/db/migrate/20180625113853_create_import_export_uploads.rb @@ -1,6 +1,7 @@ class CreateImportExportUploads < ActiveRecord::Migration[4.2] DOWNTIME = false + # rubocop:disable Migration/AddLimitToTextColumns def change create_table :import_export_uploads do |t| t.datetime_with_timezone :updated_at, null: false @@ -13,4 +14,5 @@ class CreateImportExportUploads < ActiveRecord::Migration[4.2] add_index :import_export_uploads, :updated_at end + # rubocop:enable Migration/AddLimitToTextColumns end diff --git a/db/migrate/20180704204006_add_hide_third_party_offers_to_application_settings.rb b/db/migrate/20180704204006_add_hide_third_party_offers_to_application_settings.rb index 03afbe217b5..b037f72a964 100644 --- a/db/migrate/20180704204006_add_hide_third_party_offers_to_application_settings.rb +++ b/db/migrate/20180704204006_add_hide_third_party_offers_to_application_settings.rb @@ -6,7 +6,7 @@ class AddHideThirdPartyOffersToApplicationSettings < ActiveRecord::Migration[4.2 disable_ddl_transaction! def up - add_column_with_default(:application_settings, :hide_third_party_offers, + add_column_with_default(:application_settings, :hide_third_party_offers, # rubocop:disable Migration/AddColumnWithDefault :boolean, default: false, allow_null: false) diff --git a/db/migrate/20180713092803_create_user_statuses.rb b/db/migrate/20180713092803_create_user_statuses.rb index 3abab4e45a9..79a12c9b8ee 100644 --- a/db/migrate/20180713092803_create_user_statuses.rb +++ b/db/migrate/20180713092803_create_user_statuses.rb @@ -5,8 +5,8 @@ class CreateUserStatuses < ActiveRecord::Migration[4.2] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change - # rubocop:disable Migration/AddLimitToStringColumns create_table :user_statuses, id: false, primary_key: :user_id do |t| t.references :user, foreign_key: { on_delete: :cascade }, @@ -17,6 +17,6 @@ class CreateUserStatuses < ActiveRecord::Migration[4.2] t.string :message, limit: 100 t.string :message_html end - # rubocop:enable Migration/AddLimitToStringColumns end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20180718005113_add_instance_statistics_visibility_to_application_setting.rb b/db/migrate/20180718005113_add_instance_statistics_visibility_to_application_setting.rb index ed5fa58b481..9e453be8c57 100644 --- a/db/migrate/20180718005113_add_instance_statistics_visibility_to_application_setting.rb +++ b/db/migrate/20180718005113_add_instance_statistics_visibility_to_application_setting.rb @@ -8,7 +8,7 @@ class AddInstanceStatisticsVisibilityToApplicationSetting < ActiveRecord::Migrat disable_ddl_transaction! def up - add_column_with_default(:application_settings, :instance_statistics_visibility_private, + add_column_with_default(:application_settings, :instance_statistics_visibility_private, # rubocop:disable Migration/AddColumnWithDefault :boolean, default: false, allow_null: false) diff --git a/db/migrate/20180723135214_add_web_ide_client_side_preview_enabled_to_application_settings.rb b/db/migrate/20180723135214_add_web_ide_client_side_preview_enabled_to_application_settings.rb index 23b8e04674a..96b5c43d0a3 100644 --- a/db/migrate/20180723135214_add_web_ide_client_side_preview_enabled_to_application_settings.rb +++ b/db/migrate/20180723135214_add_web_ide_client_side_preview_enabled_to_application_settings.rb @@ -8,7 +8,7 @@ class AddWebIdeClientSidePreviewEnabledToApplicationSettings < ActiveRecord::Mig disable_ddl_transaction! def up - add_column_with_default(:application_settings, :web_ide_clientside_preview_enabled, + add_column_with_default(:application_settings, :web_ide_clientside_preview_enabled, # rubocop:disable Migration/AddColumnWithDefault :boolean, default: false, allow_null: false) diff --git a/db/migrate/20180808162000_add_user_show_add_ssh_key_message_to_application_settings.rb b/db/migrate/20180808162000_add_user_show_add_ssh_key_message_to_application_settings.rb index 946d99a4c5f..6bf54f79644 100644 --- a/db/migrate/20180808162000_add_user_show_add_ssh_key_message_to_application_settings.rb +++ b/db/migrate/20180808162000_add_user_show_add_ssh_key_message_to_application_settings.rb @@ -10,7 +10,9 @@ class AddUserShowAddSshKeyMessageToApplicationSettings < ActiveRecord::Migration disable_ddl_transaction! def up + # rubocop:disable Migration/AddColumnWithDefault add_column_with_default :application_settings, :user_show_add_ssh_key_message, :boolean, default: true, allow_null: false + # rubocop:enable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20180814153625_add_commit_email_to_users.rb b/db/migrate/20180814153625_add_commit_email_to_users.rb index 303be9b2312..c94ee9512de 100644 --- a/db/migrate/20180814153625_add_commit_email_to_users.rb +++ b/db/migrate/20180814153625_add_commit_email_to_users.rb @@ -27,11 +27,11 @@ class AddCommitEmailToUsers < ActiveRecord::Migration[4.2] # comments: # disable_ddl_transaction! - # rubocop:disable Migration/AddLimitToStringColumns + # rubocop:disable Migration/PreventStrings # rubocop:disable Migration/AddColumnsToWideTables def change add_column :users, :commit_email, :string end - # rubocop:enable Migration/AddLimitToStringColumns # rubocop:enable Migration/AddColumnsToWideTables + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20180824202952_add_outbound_requests_whitelist_to_application_settings.rb b/db/migrate/20180824202952_add_outbound_requests_whitelist_to_application_settings.rb index 4ee654ce873..7b87b04bc9d 100644 --- a/db/migrate/20180824202952_add_outbound_requests_whitelist_to_application_settings.rb +++ b/db/migrate/20180824202952_add_outbound_requests_whitelist_to_application_settings.rb @@ -3,7 +3,9 @@ class AddOutboundRequestsWhitelistToApplicationSettings < ActiveRecord::Migration[5.1] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change add_column :application_settings, :outbound_local_requests_whitelist, :string, array: true, limit: 255 end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20180831164905_add_common_to_prometheus_metrics.rb b/db/migrate/20180831164905_add_common_to_prometheus_metrics.rb index 5eb77d0480d..6654e6d1957 100644 --- a/db/migrate/20180831164905_add_common_to_prometheus_metrics.rb +++ b/db/migrate/20180831164905_add_common_to_prometheus_metrics.rb @@ -8,7 +8,7 @@ class AddCommonToPrometheusMetrics < ActiveRecord::Migration[4.2] disable_ddl_transaction! def up - add_column_with_default(:prometheus_metrics, :common, :boolean, default: false) + add_column_with_default(:prometheus_metrics, :common, :boolean, default: false) # rubocop:disable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20180831164908_add_identifier_to_prometheus_metric.rb b/db/migrate/20180831164908_add_identifier_to_prometheus_metric.rb index 8f30363c310..efdcab53920 100644 --- a/db/migrate/20180831164908_add_identifier_to_prometheus_metric.rb +++ b/db/migrate/20180831164908_add_identifier_to_prometheus_metric.rb @@ -6,6 +6,6 @@ class AddIdentifierToPrometheusMetric < ActiveRecord::Migration[4.2] DOWNTIME = false def change - add_column :prometheus_metrics, :identifier, :string # rubocop:disable Migration/AddLimitToStringColumns + add_column :prometheus_metrics, :identifier, :string # rubocop:disable Migration/PreventStrings end end diff --git a/db/migrate/20180901200537_add_resource_label_event_reference_fields.rb b/db/migrate/20180901200537_add_resource_label_event_reference_fields.rb index c8875e16914..2dc86e1ac9a 100644 --- a/db/migrate/20180901200537_add_resource_label_event_reference_fields.rb +++ b/db/migrate/20180901200537_add_resource_label_event_reference_fields.rb @@ -3,9 +3,11 @@ class AddResourceLabelEventReferenceFields < ActiveRecord::Migration[4.2] DOWNTIME = false + # rubocop:disable Migration/AddLimitToTextColumns def change add_column :resource_label_events, :cached_markdown_version, :integer add_column :resource_label_events, :reference, :text add_column :resource_label_events, :reference_html, :text end + # rubocop:enable Migration/AddLimitToTextColumns end diff --git a/db/migrate/20180907015926_add_legacy_abac_to_cluster_providers_gcp.rb b/db/migrate/20180907015926_add_legacy_abac_to_cluster_providers_gcp.rb index c57611a0f7d..8bfb0c5612a 100644 --- a/db/migrate/20180907015926_add_legacy_abac_to_cluster_providers_gcp.rb +++ b/db/migrate/20180907015926_add_legacy_abac_to_cluster_providers_gcp.rb @@ -8,7 +8,7 @@ class AddLegacyAbacToClusterProvidersGcp < ActiveRecord::Migration[4.2] disable_ddl_transaction! def up - add_column_with_default(:cluster_providers_gcp, :legacy_abac, :boolean, default: true) + add_column_with_default(:cluster_providers_gcp, :legacy_abac, :boolean, default: true) # rubocop:disable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20180910115836_add_attr_encrypted_columns_to_web_hook.rb b/db/migrate/20180910115836_add_attr_encrypted_columns_to_web_hook.rb index 9757f7fdc79..3341fd5c593 100644 --- a/db/migrate/20180910115836_add_attr_encrypted_columns_to_web_hook.rb +++ b/db/migrate/20180910115836_add_attr_encrypted_columns_to_web_hook.rb @@ -5,13 +5,13 @@ class AddAttrEncryptedColumnsToWebHook < ActiveRecord::Migration[4.2] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change - # rubocop:disable Migration/AddLimitToStringColumns add_column :web_hooks, :encrypted_token, :string add_column :web_hooks, :encrypted_token_iv, :string add_column :web_hooks, :encrypted_url, :string add_column :web_hooks, :encrypted_url_iv, :string - # rubocop:enable Migration/AddLimitToStringColumns end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20180910153412_add_token_digest_to_personal_access_tokens.rb b/db/migrate/20180910153412_add_token_digest_to_personal_access_tokens.rb index 52923f52499..4ed31bf7f39 100644 --- a/db/migrate/20180910153412_add_token_digest_to_personal_access_tokens.rb +++ b/db/migrate/20180910153412_add_token_digest_to_personal_access_tokens.rb @@ -8,7 +8,7 @@ class AddTokenDigestToPersonalAccessTokens < ActiveRecord::Migration[4.2] def up change_column :personal_access_tokens, :token, :string, null: true - add_column :personal_access_tokens, :token_digest, :string # rubocop:disable Migration/AddLimitToStringColumns + add_column :personal_access_tokens, :token_digest, :string # rubocop:disable Migration/PreventStrings end def down diff --git a/db/migrate/20180912111628_add_knative_application.rb b/db/migrate/20180912111628_add_knative_application.rb index 7c55de02d1c..cd2512cc17a 100644 --- a/db/migrate/20180912111628_add_knative_application.rb +++ b/db/migrate/20180912111628_add_knative_application.rb @@ -5,8 +5,8 @@ class AddKnativeApplication < ActiveRecord::Migration[4.2] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change - # rubocop:disable Migration/AddLimitToStringColumns create_table "clusters_applications_knative" do |t| t.references :cluster, null: false, unique: true, foreign_key: { on_delete: :cascade } @@ -15,8 +15,8 @@ class AddKnativeApplication < ActiveRecord::Migration[4.2] t.integer "status", null: false t.string "version", null: false t.string "hostname" - t.text "status_reason" + t.text "status_reason" # rubocop:disable Migration/AddLimitToTextColumns end - # rubocop:enable Migration/AddLimitToStringColumns end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20180924141949_add_diff_max_patch_bytes_to_application_settings.rb b/db/migrate/20180924141949_add_diff_max_patch_bytes_to_application_settings.rb index 5dac5f0d100..69166f8d1a4 100644 --- a/db/migrate/20180924141949_add_diff_max_patch_bytes_to_application_settings.rb +++ b/db/migrate/20180924141949_add_diff_max_patch_bytes_to_application_settings.rb @@ -12,7 +12,7 @@ class AddDiffMaxPatchBytesToApplicationSettings < ActiveRecord::Migration[4.2] disable_ddl_transaction! def up - add_column_with_default(:application_settings, + add_column_with_default(:application_settings, # rubocop:disable Migration/AddColumnWithDefault :diff_max_patch_bytes, :integer, default: 100.kilobytes, diff --git a/db/migrate/20181009190428_create_clusters_kubernetes_namespaces.rb b/db/migrate/20181009190428_create_clusters_kubernetes_namespaces.rb index b6ffb2866aa..42d0899fe31 100644 --- a/db/migrate/20181009190428_create_clusters_kubernetes_namespaces.rb +++ b/db/migrate/20181009190428_create_clusters_kubernetes_namespaces.rb @@ -4,8 +4,8 @@ class CreateClustersKubernetesNamespaces < ActiveRecord::Migration[4.2] DOWNTIME = false INDEX_NAME = 'kubernetes_namespaces_cluster_and_namespace' + # rubocop:disable Migration/PreventStrings def change - # rubocop:disable Migration/AddLimitToStringColumns create_table :clusters_kubernetes_namespaces, id: :bigserial do |t| t.references :cluster, null: false, index: true, foreign_key: { on_delete: :cascade } t.references :project, index: true, foreign_key: { on_delete: :nullify } @@ -17,10 +17,10 @@ class CreateClustersKubernetesNamespaces < ActiveRecord::Migration[4.2] t.string :namespace, null: false t.string :service_account_name - t.text :encrypted_service_account_token + t.text :encrypted_service_account_token # rubocop:disable Migration/AddLimitToTextColumns t.index [:cluster_id, :namespace], name: INDEX_NAME, unique: true end - # rubocop:enable Migration/AddLimitToStringColumns end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20181017001059_add_cluster_type_to_clusters.rb b/db/migrate/20181017001059_add_cluster_type_to_clusters.rb index d032afe1a43..75abcfedfc9 100644 --- a/db/migrate/20181017001059_add_cluster_type_to_clusters.rb +++ b/db/migrate/20181017001059_add_cluster_type_to_clusters.rb @@ -9,7 +9,7 @@ class AddClusterTypeToClusters < ActiveRecord::Migration[4.2] disable_ddl_transaction! def up - add_column_with_default(:clusters, :cluster_type, :smallint, default: PROJECT_CLUSTER_TYPE) + add_column_with_default(:clusters, :cluster_type, :smallint, default: PROJECT_CLUSTER_TYPE) # rubocop:disable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20181019032400_add_shards_table.rb b/db/migrate/20181019032400_add_shards_table.rb index 82287e5c3b5..713039c1a15 100644 --- a/db/migrate/20181019032400_add_shards_table.rb +++ b/db/migrate/20181019032400_add_shards_table.rb @@ -5,7 +5,7 @@ class AddShardsTable < ActiveRecord::Migration[4.2] def change create_table :shards do |t| - t.string :name, null: false, index: { unique: true } # rubocop:disable Migration/AddLimitToStringColumns + t.string :name, null: false, index: { unique: true } # rubocop:disable Migration/PreventStrings end end end diff --git a/db/migrate/20181019032408_add_repositories_table.rb b/db/migrate/20181019032408_add_repositories_table.rb index 5ee31b37b66..d4d3acf7029 100644 --- a/db/migrate/20181019032408_add_repositories_table.rb +++ b/db/migrate/20181019032408_add_repositories_table.rb @@ -6,7 +6,7 @@ class AddRepositoriesTable < ActiveRecord::Migration[4.2] def change create_table :repositories, id: :bigserial do |t| t.references :shard, null: false, index: true, foreign_key: { on_delete: :restrict } - t.string :disk_path, null: false, index: { unique: true } # rubocop:disable Migration/AddLimitToStringColumns + t.string :disk_path, null: false, index: { unique: true } # rubocop:disable Migration/PreventStrings end add_column :projects, :pool_repository_id, :bigint # rubocop:disable Migration/AddColumnsToWideTables diff --git a/db/migrate/20181025115728_add_private_commit_email_hostname_to_application_settings.rb b/db/migrate/20181025115728_add_private_commit_email_hostname_to_application_settings.rb index c0e4897b8d7..0923975f43a 100644 --- a/db/migrate/20181025115728_add_private_commit_email_hostname_to_application_settings.rb +++ b/db/migrate/20181025115728_add_private_commit_email_hostname_to_application_settings.rb @@ -5,7 +5,9 @@ class AddPrivateCommitEmailHostnameToApplicationSettings < ActiveRecord::Migrati DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change - add_column(:application_settings, :commit_email_hostname, :string, null: true) # rubocop:disable Migration/AddLimitToStringColumns + add_column(:application_settings, :commit_email_hostname, :string, null: true) end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20181028120717_add_first_day_of_week_to_application_settings.rb b/db/migrate/20181028120717_add_first_day_of_week_to_application_settings.rb index e9a8c1011ad..c4c25d08754 100644 --- a/db/migrate/20181028120717_add_first_day_of_week_to_application_settings.rb +++ b/db/migrate/20181028120717_add_first_day_of_week_to_application_settings.rb @@ -7,7 +7,7 @@ class AddFirstDayOfWeekToApplicationSettings < ActiveRecord::Migration[5.0] DOWNTIME = false def up - add_column_with_default(:application_settings, :first_day_of_week, :integer, default: 0) + add_column_with_default(:application_settings, :first_day_of_week, :integer, default: 0) # rubocop:disable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20181031145139_add_protected_ci_variables_to_application_settings.rb b/db/migrate/20181031145139_add_protected_ci_variables_to_application_settings.rb index 85ee34afe1e..1817677c58d 100644 --- a/db/migrate/20181031145139_add_protected_ci_variables_to_application_settings.rb +++ b/db/migrate/20181031145139_add_protected_ci_variables_to_application_settings.rb @@ -8,7 +8,7 @@ class AddProtectedCiVariablesToApplicationSettings < ActiveRecord::Migration[5.0 disable_ddl_transaction! def up - add_column_with_default(:application_settings, :protected_ci_variables, :boolean, default: false, allow_null: false) + add_column_with_default(:application_settings, :protected_ci_variables, :boolean, default: false, allow_null: false) # rubocop:disable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20181031190559_drop_gcp_clusters_table.rb b/db/migrate/20181031190559_drop_gcp_clusters_table.rb index 850fa93c75a..597fe49f4c8 100644 --- a/db/migrate/20181031190559_drop_gcp_clusters_table.rb +++ b/db/migrate/20181031190559_drop_gcp_clusters_table.rb @@ -10,7 +10,6 @@ class DropGcpClustersTable < ActiveRecord::Migration[4.2] end def down - # rubocop:disable Migration/AddLimitToStringColumns create_table :gcp_clusters do |t| # Order columns by best align scheme t.references :project, null: false, index: { unique: true }, foreign_key: { on_delete: :cascade } @@ -50,6 +49,5 @@ class DropGcpClustersTable < ActiveRecord::Migration[4.2] t.text :encrypted_gcp_token t.string :encrypted_gcp_token_iv end - # rubocop:enable Migration/AddLimitToStringColumns end end diff --git a/db/migrate/20181101191341_create_clusters_applications_cert_manager.rb b/db/migrate/20181101191341_create_clusters_applications_cert_manager.rb index 3bc20046311..95996531669 100644 --- a/db/migrate/20181101191341_create_clusters_applications_cert_manager.rb +++ b/db/migrate/20181101191341_create_clusters_applications_cert_manager.rb @@ -5,17 +5,17 @@ class CreateClustersApplicationsCertManager < ActiveRecord::Migration[4.2] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change - # rubocop:disable Migration/AddLimitToStringColumns create_table :clusters_applications_cert_managers do |t| t.references :cluster, null: false, index: false, foreign_key: { on_delete: :cascade } t.integer :status, null: false t.string :version, null: false t.string :email, null: false t.timestamps_with_timezone null: false - t.text :status_reason + t.text :status_reason # rubocop:disable Migration/AddLimitToTextColumns t.index :cluster_id, unique: true end - # rubocop:enable Migration/AddLimitToStringColumns end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20181115140140_add_encrypted_runners_token_to_settings.rb b/db/migrate/20181115140140_add_encrypted_runners_token_to_settings.rb index 124eedf7933..abb720dafb2 100644 --- a/db/migrate/20181115140140_add_encrypted_runners_token_to_settings.rb +++ b/db/migrate/20181115140140_add_encrypted_runners_token_to_settings.rb @@ -5,7 +5,9 @@ class AddEncryptedRunnersTokenToSettings < ActiveRecord::Migration[4.2] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change - add_column :application_settings, :runners_registration_token_encrypted, :string # rubocop:disable Migration/AddLimitToStringColumns + add_column :application_settings, :runners_registration_token_encrypted, :string end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20181116050532_knative_external_ip.rb b/db/migrate/20181116050532_knative_external_ip.rb index 4634b411108..4179e13c1b8 100644 --- a/db/migrate/20181116050532_knative_external_ip.rb +++ b/db/migrate/20181116050532_knative_external_ip.rb @@ -8,7 +8,9 @@ class KnativeExternalIp < ActiveRecord::Migration[4.2] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change - add_column :clusters_applications_knative, :external_ip, :string # rubocop:disable Migration/AddLimitToStringColumns + add_column :clusters_applications_knative, :external_ip, :string end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20181116141415_add_encrypted_runners_token_to_namespaces.rb b/db/migrate/20181116141415_add_encrypted_runners_token_to_namespaces.rb index 0a8ed912891..00c88140b52 100644 --- a/db/migrate/20181116141415_add_encrypted_runners_token_to_namespaces.rb +++ b/db/migrate/20181116141415_add_encrypted_runners_token_to_namespaces.rb @@ -5,7 +5,9 @@ class AddEncryptedRunnersTokenToNamespaces < ActiveRecord::Migration[4.2] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change - add_column :namespaces, :runners_token_encrypted, :string # rubocop:disable Migration/AddLimitToStringColumns + add_column :namespaces, :runners_token_encrypted, :string end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20181116141504_add_encrypted_runners_token_to_projects.rb b/db/migrate/20181116141504_add_encrypted_runners_token_to_projects.rb index f6986fcdfeb..f42239475f7 100644 --- a/db/migrate/20181116141504_add_encrypted_runners_token_to_projects.rb +++ b/db/migrate/20181116141504_add_encrypted_runners_token_to_projects.rb @@ -6,10 +6,10 @@ class AddEncryptedRunnersTokenToProjects < ActiveRecord::Migration[4.2] DOWNTIME = false # rubocop:disable Migration/AddColumnsToWideTables - # rubocop:disable Migration/AddLimitToStringColumns + # rubocop:disable Migration/PreventStrings def change add_column :projects, :runners_token_encrypted, :string end + # rubocop:enable Migration/PreventStrings # rubocop:enable Migration/AddColumnsToWideTables - # rubocop:enable Migration/AddLimitToStringColumns end diff --git a/db/migrate/20181120151656_add_token_encrypted_to_ci_runners.rb b/db/migrate/20181120151656_add_token_encrypted_to_ci_runners.rb index 2270246dfb4..2b78d390907 100644 --- a/db/migrate/20181120151656_add_token_encrypted_to_ci_runners.rb +++ b/db/migrate/20181120151656_add_token_encrypted_to_ci_runners.rb @@ -6,6 +6,6 @@ class AddTokenEncryptedToCiRunners < ActiveRecord::Migration[4.2] DOWNTIME = false def change - add_column :ci_runners, :token_encrypted, :string # rubocop:disable Migration/AddLimitToStringColumns + add_column :ci_runners, :token_encrypted, :string # rubocop:disable Migration/PreventStrings end end diff --git a/db/migrate/20181122160027_create_project_repositories.rb b/db/migrate/20181122160027_create_project_repositories.rb index 3f123daa150..9148cde2fb4 100644 --- a/db/migrate/20181122160027_create_project_repositories.rb +++ b/db/migrate/20181122160027_create_project_repositories.rb @@ -11,7 +11,7 @@ class CreateProjectRepositories < ActiveRecord::Migration[5.0] def change create_table :project_repositories, id: :bigserial do |t| t.references :shard, null: false, index: true, foreign_key: { on_delete: :restrict } - t.string :disk_path, null: false, index: { unique: true } # rubocop:disable Migration/AddLimitToStringColumns + t.string :disk_path, null: false, index: { unique: true } # rubocop:disable Migration/PreventStrings t.references :project, null: false, index: { unique: true }, foreign_key: { on_delete: :cascade } end end diff --git a/db/migrate/20181123144235_create_suggestions.rb b/db/migrate/20181123144235_create_suggestions.rb index 78888517db5..b92e8ac8027 100644 --- a/db/migrate/20181123144235_create_suggestions.rb +++ b/db/migrate/20181123144235_create_suggestions.rb @@ -3,12 +3,14 @@ class CreateSuggestions < ActiveRecord::Migration[5.0] DOWNTIME = false + # rubocop:disable Migration/PreventStrings + # rubocop:disable Migration/AddLimitToTextColumns def change create_table :suggestions, id: :bigserial do |t| t.references :note, foreign_key: { on_delete: :cascade }, null: false t.integer :relative_order, null: false, limit: 2 t.boolean :applied, null: false, default: false - t.string :commit_id # rubocop:disable Migration/AddLimitToStringColumns + t.string :commit_id t.text :from_content, null: false t.text :to_content, null: false @@ -17,4 +19,6 @@ class CreateSuggestions < ActiveRecord::Migration[5.0] unique: true end end + # rubocop:enable Migration/AddLimitToTextColumns + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20181128123704_add_state_to_pool_repository.rb b/db/migrate/20181128123704_add_state_to_pool_repository.rb index 04bbcf24f62..4d4e56390df 100644 --- a/db/migrate/20181128123704_add_state_to_pool_repository.rb +++ b/db/migrate/20181128123704_add_state_to_pool_repository.rb @@ -7,13 +7,17 @@ class AddStateToPoolRepository < ActiveRecord::Migration[5.0] # Given the table is empty, and the non concurrent methods are chosen so # the transactions don't have to be disabled - # rubocop: disable Migration/AddConcurrentForeignKey, Migration/AddIndex + # rubocop:disable Migration/AddConcurrentForeignKey + # rubocop:disable Migration/AddIndex + # rubocop:disable Migration/PreventStrings def change - add_column(:pool_repositories, :state, :string, null: true) # rubocop:disable Migration/AddLimitToStringColumns + add_column(:pool_repositories, :state, :string, null: true) add_column :pool_repositories, :source_project_id, :integer add_index :pool_repositories, :source_project_id, unique: true add_foreign_key :pool_repositories, :projects, column: :source_project_id, on_delete: :nullify end - # rubocop: enable Migration/AddConcurrentForeignKey, Migration/AddIndex + # rubocop:enable Migration/PreventStrings + # rubocop:enable Migration/AddIndex + # rubocop:enable Migration/AddConcurrentForeignKey end diff --git a/db/migrate/20181129104854_add_token_encrypted_to_ci_builds.rb b/db/migrate/20181129104854_add_token_encrypted_to_ci_builds.rb index 097cc59bcdc..b83cabd6b75 100644 --- a/db/migrate/20181129104854_add_token_encrypted_to_ci_builds.rb +++ b/db/migrate/20181129104854_add_token_encrypted_to_ci_builds.rb @@ -6,10 +6,10 @@ class AddTokenEncryptedToCiBuilds < ActiveRecord::Migration[5.0] DOWNTIME = false # rubocop:disable Migration/AddColumnsToWideTables - # rubocop:disable Migration/AddLimitToStringColumns + # rubocop:disable Migration/PreventStrings def change add_column :ci_builds, :token_encrypted, :string end + # rubocop:enable Migration/PreventStrings # rubocop:enable Migration/AddColumnsToWideTables - # rubocop:enable Migration/AddLimitToStringColumns end diff --git a/db/migrate/20181203002526_add_project_bfg_object_map_column.rb b/db/migrate/20181203002526_add_project_bfg_object_map_column.rb index d8c4fe1ecf6..7850f314ca8 100644 --- a/db/migrate/20181203002526_add_project_bfg_object_map_column.rb +++ b/db/migrate/20181203002526_add_project_bfg_object_map_column.rb @@ -4,10 +4,10 @@ class AddProjectBfgObjectMapColumn < ActiveRecord::Migration[5.0] DOWNTIME = false # rubocop:disable Migration/AddColumnsToWideTables - # rubocop:disable Migration/AddLimitToStringColumns + # rubocop:disable Migration/PreventStrings def change add_column :projects, :bfg_object_map, :string end + # rubocop:enable Migration/PreventStrings # rubocop:enable Migration/AddColumnsToWideTables - # rubocop:enable Migration/AddLimitToStringColumns end diff --git a/db/migrate/20181211092510_add_name_author_id_and_sha_to_releases.rb b/db/migrate/20181211092510_add_name_author_id_and_sha_to_releases.rb index 3ab808ba667..79711d13cfe 100644 --- a/db/migrate/20181211092510_add_name_author_id_and_sha_to_releases.rb +++ b/db/migrate/20181211092510_add_name_author_id_and_sha_to_releases.rb @@ -5,9 +5,11 @@ class AddNameAuthorIdAndShaToReleases < ActiveRecord::Migration[5.0] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change add_column :releases, :author_id, :integer - add_column :releases, :name, :string # rubocop:disable Migration/AddLimitToStringColumns - add_column :releases, :sha, :string # rubocop:disable Migration/AddLimitToStringColumns + add_column :releases, :name, :string + add_column :releases, :sha, :string end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20181212171634_create_error_tracking_settings.rb b/db/migrate/20181212171634_create_error_tracking_settings.rb index 950b9a88005..567abe6f45f 100644 --- a/db/migrate/20181212171634_create_error_tracking_settings.rb +++ b/db/migrate/20181212171634_create_error_tracking_settings.rb @@ -5,8 +5,8 @@ class CreateErrorTrackingSettings < ActiveRecord::Migration[5.0] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change - # rubocop:disable Migration/AddLimitToStringColumns create_table :project_error_tracking_settings, id: :int, primary_key: :project_id, default: nil do |t| t.boolean :enabled, null: false, default: true t.string :api_url, null: false @@ -14,6 +14,6 @@ class CreateErrorTrackingSettings < ActiveRecord::Migration[5.0] t.string :encrypted_token_iv t.foreign_key :projects, column: :project_id, on_delete: :cascade end - # rubocop:enable Migration/AddLimitToStringColumns end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20181228175414_create_releases_link_table.rb b/db/migrate/20181228175414_create_releases_link_table.rb index 168c4722cc1..9d770d0dc2f 100644 --- a/db/migrate/20181228175414_create_releases_link_table.rb +++ b/db/migrate/20181228175414_create_releases_link_table.rb @@ -5,8 +5,8 @@ class CreateReleasesLinkTable < ActiveRecord::Migration[5.0] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change - # rubocop:disable Migration/AddLimitToStringColumns create_table :release_links, id: :bigserial do |t| t.references :release, null: false, index: false, foreign_key: { on_delete: :cascade } t.string :url, null: false @@ -16,6 +16,6 @@ class CreateReleasesLinkTable < ActiveRecord::Migration[5.0] t.index [:release_id, :url], unique: true t.index [:release_id, :name], unique: true end - # rubocop:enable Migration/AddLimitToStringColumns end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20190109153125_add_merge_request_external_diffs.rb b/db/migrate/20190109153125_add_merge_request_external_diffs.rb index a680856a3d8..d787e78142a 100644 --- a/db/migrate/20190109153125_add_merge_request_external_diffs.rb +++ b/db/migrate/20190109153125_add_merge_request_external_diffs.rb @@ -11,7 +11,7 @@ class AddMergeRequestExternalDiffs < ActiveRecord::Migration[5.0] def change # Allow the merge request diff to store details about an external file - add_column :merge_request_diffs, :external_diff, :string # rubocop:disable Migration/AddLimitToStringColumns + add_column :merge_request_diffs, :external_diff, :string # rubocop:disable Migration/PreventStrings add_column :merge_request_diffs, :external_diff_store, :integer add_column :merge_request_diffs, :stored_externally, :boolean diff --git a/db/migrate/20190114172110_add_domain_to_cluster.rb b/db/migrate/20190114172110_add_domain_to_cluster.rb index d8f10af9cad..ebe588d8b77 100644 --- a/db/migrate/20190114172110_add_domain_to_cluster.rb +++ b/db/migrate/20190114172110_add_domain_to_cluster.rb @@ -4,6 +4,6 @@ class AddDomainToCluster < ActiveRecord::Migration[5.0] DOWNTIME = false def change - add_column :clusters, :domain, :string # rubocop:disable Migration/AddLimitToStringColumns + add_column :clusters, :domain, :string # rubocop:disable Migration/PreventStrings end end diff --git a/db/migrate/20190115092821_add_columns_project_error_tracking_settings.rb b/db/migrate/20190115092821_add_columns_project_error_tracking_settings.rb index afed929cce4..ee6d63b558f 100644 --- a/db/migrate/20190115092821_add_columns_project_error_tracking_settings.rb +++ b/db/migrate/20190115092821_add_columns_project_error_tracking_settings.rb @@ -5,12 +5,14 @@ class AddColumnsProjectErrorTrackingSettings < ActiveRecord::Migration[5.0] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change - add_column :project_error_tracking_settings, :project_name, :string # rubocop:disable Migration/AddLimitToStringColumns - add_column :project_error_tracking_settings, :organization_name, :string # rubocop:disable Migration/AddLimitToStringColumns + add_column :project_error_tracking_settings, :project_name, :string + add_column :project_error_tracking_settings, :organization_name, :string change_column_default :project_error_tracking_settings, :enabled, from: true, to: false change_column_null :project_error_tracking_settings, :api_url, true end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20190116234221_add_sorting_fields_to_user_preference.rb b/db/migrate/20190116234221_add_sorting_fields_to_user_preference.rb index 39aab600546..5d33f6f4339 100644 --- a/db/migrate/20190116234221_add_sorting_fields_to_user_preference.rb +++ b/db/migrate/20190116234221_add_sorting_fields_to_user_preference.rb @@ -9,10 +9,12 @@ class AddSortingFieldsToUserPreference < ActiveRecord::Migration[5.0] # Set this constant to true if this migration requires downtime. DOWNTIME = false + # rubocop:disable Migration/PreventStrings def up - add_column :user_preferences, :issues_sort, :string # rubocop:disable Migration/AddLimitToStringColumns - add_column :user_preferences, :merge_requests_sort, :string # rubocop:disable Migration/AddLimitToStringColumns + add_column :user_preferences, :issues_sort, :string + add_column :user_preferences, :merge_requests_sort, :string end + # rubocop:enable Migration/PreventStrings def down remove_column :user_preferences, :issues_sort diff --git a/db/migrate/20190218134158_add_masked_to_ci_variables.rb b/db/migrate/20190218134158_add_masked_to_ci_variables.rb index b4999d5b4a9..60dcc0d7af5 100644 --- a/db/migrate/20190218134158_add_masked_to_ci_variables.rb +++ b/db/migrate/20190218134158_add_masked_to_ci_variables.rb @@ -12,7 +12,7 @@ class AddMaskedToCiVariables < ActiveRecord::Migration[5.0] disable_ddl_transaction! def up - add_column_with_default :ci_variables, :masked, :boolean, default: false, allow_null: false + add_column_with_default :ci_variables, :masked, :boolean, default: false, allow_null: false # rubocop:disable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20190218134209_add_masked_to_ci_group_variables.rb b/db/migrate/20190218134209_add_masked_to_ci_group_variables.rb index 8633875b341..c25881410d0 100644 --- a/db/migrate/20190218134209_add_masked_to_ci_group_variables.rb +++ b/db/migrate/20190218134209_add_masked_to_ci_group_variables.rb @@ -12,7 +12,7 @@ class AddMaskedToCiGroupVariables < ActiveRecord::Migration[5.0] disable_ddl_transaction! def up - add_column_with_default :ci_group_variables, :masked, :boolean, default: false, allow_null: false + add_column_with_default :ci_group_variables, :masked, :boolean, default: false, allow_null: false # rubocop:disable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20190219201635_add_asset_proxy_settings.rb b/db/migrate/20190219201635_add_asset_proxy_settings.rb index 9de38cf8a89..173b2916c4d 100644 --- a/db/migrate/20190219201635_add_asset_proxy_settings.rb +++ b/db/migrate/20190219201635_add_asset_proxy_settings.rb @@ -6,11 +6,15 @@ class AddAssetProxySettings < ActiveRecord::Migration[5.0] # Set this constant to true if this migration requires downtime. DOWNTIME = false + # rubocop:disable Migration/PreventStrings + # rubocop:disable Migration/AddLimitToTextColumns def change add_column :application_settings, :asset_proxy_enabled, :boolean, default: false, null: false - add_column :application_settings, :asset_proxy_url, :string # rubocop:disable Migration/AddLimitToStringColumns + add_column :application_settings, :asset_proxy_url, :string add_column :application_settings, :asset_proxy_whitelist, :text add_column :application_settings, :encrypted_asset_proxy_secret_key, :text - add_column :application_settings, :encrypted_asset_proxy_secret_key_iv, :string # rubocop:disable Migration/AddLimitToStringColumns + add_column :application_settings, :encrypted_asset_proxy_secret_key_iv, :string end + # rubocop:enable Migration/AddLimitToTextColumns + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20190220142344_add_email_header_and_footer_enabled_flag_to_appearances_table.rb b/db/migrate/20190220142344_add_email_header_and_footer_enabled_flag_to_appearances_table.rb index 85b9e0580f4..33fb6b8ef0d 100644 --- a/db/migrate/20190220142344_add_email_header_and_footer_enabled_flag_to_appearances_table.rb +++ b/db/migrate/20190220142344_add_email_header_and_footer_enabled_flag_to_appearances_table.rb @@ -8,7 +8,7 @@ class AddEmailHeaderAndFooterEnabledFlagToAppearancesTable < ActiveRecord::Migra DOWNTIME = false def up - add_column_with_default(:appearances, :email_header_and_footer_enabled, :boolean, default: false) + add_column_with_default(:appearances, :email_header_and_footer_enabled, :boolean, default: false) # rubocop:disable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20190228192410_add_multi_line_attributes_to_suggestion.rb b/db/migrate/20190228192410_add_multi_line_attributes_to_suggestion.rb index 856dfc89fa3..4daabb6baa8 100644 --- a/db/migrate/20190228192410_add_multi_line_attributes_to_suggestion.rb +++ b/db/migrate/20190228192410_add_multi_line_attributes_to_suggestion.rb @@ -8,9 +8,9 @@ class AddMultiLineAttributesToSuggestion < ActiveRecord::Migration[5.0] disable_ddl_transaction! def up - add_column_with_default :suggestions, :lines_above, :integer, default: 0, allow_null: false - add_column_with_default :suggestions, :lines_below, :integer, default: 0, allow_null: false - add_column_with_default :suggestions, :outdated, :boolean, default: false, allow_null: false + add_column_with_default :suggestions, :lines_above, :integer, default: 0, allow_null: false # rubocop:disable Migration/AddColumnWithDefault + add_column_with_default :suggestions, :lines_below, :integer, default: 0, allow_null: false # rubocop:disable Migration/AddColumnWithDefault + add_column_with_default :suggestions, :outdated, :boolean, default: false, allow_null: false # rubocop:disable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20190301182457_add_external_hostname_to_ingress_and_knative.rb b/db/migrate/20190301182457_add_external_hostname_to_ingress_and_knative.rb index 37ba1090cf0..4cb6053fbe1 100644 --- a/db/migrate/20190301182457_add_external_hostname_to_ingress_and_knative.rb +++ b/db/migrate/20190301182457_add_external_hostname_to_ingress_and_knative.rb @@ -3,8 +3,10 @@ class AddExternalHostnameToIngressAndKnative < ActiveRecord::Migration[5.0] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change - add_column :clusters_applications_ingress, :external_hostname, :string # rubocop:disable Migration/AddLimitToStringColumns - add_column :clusters_applications_knative, :external_hostname, :string # rubocop:disable Migration/AddLimitToStringColumns + add_column :clusters_applications_ingress, :external_hostname, :string + add_column :clusters_applications_knative, :external_hostname, :string end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20190320174702_add_lets_encrypt_notification_email_to_application_settings.rb b/db/migrate/20190320174702_add_lets_encrypt_notification_email_to_application_settings.rb index aeabf4e3cb4..e0ec10ca204 100644 --- a/db/migrate/20190320174702_add_lets_encrypt_notification_email_to_application_settings.rb +++ b/db/migrate/20190320174702_add_lets_encrypt_notification_email_to_application_settings.rb @@ -9,7 +9,9 @@ class AddLetsEncryptNotificationEmailToApplicationSettings < ActiveRecord::Migra # Set this constant to true if this migration requires downtime. DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change - add_column :application_settings, :lets_encrypt_notification_email, :string # rubocop:disable Migration/AddLimitToStringColumns + add_column :application_settings, :lets_encrypt_notification_email, :string end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20190322164830_add_auto_ssl_enabled_to_pages_domain.rb b/db/migrate/20190322164830_add_auto_ssl_enabled_to_pages_domain.rb index e74a9535ddf..41552b0e2e3 100644 --- a/db/migrate/20190322164830_add_auto_ssl_enabled_to_pages_domain.rb +++ b/db/migrate/20190322164830_add_auto_ssl_enabled_to_pages_domain.rb @@ -8,7 +8,7 @@ class AddAutoSslEnabledToPagesDomain < ActiveRecord::Migration[5.0] disable_ddl_transaction! def up - add_column_with_default :pages_domains, :auto_ssl_enabled, :boolean, default: false + add_column_with_default :pages_domains, :auto_ssl_enabled, :boolean, default: false # rubocop:disable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20190325105715_add_fields_to_user_preferences.rb b/db/migrate/20190325105715_add_fields_to_user_preferences.rb index 4da5c496147..78ccbd65c84 100644 --- a/db/migrate/20190325105715_add_fields_to_user_preferences.rb +++ b/db/migrate/20190325105715_add_fields_to_user_preferences.rb @@ -11,7 +11,7 @@ class AddFieldsToUserPreferences < ActiveRecord::Migration[5.0] DOWNTIME = false def up - add_column(:user_preferences, :timezone, :string) # rubocop:disable Migration/AddLimitToStringColumns + add_column(:user_preferences, :timezone, :string) # rubocop:disable Migration/PreventStrings add_column(:user_preferences, :time_display_relative, :boolean) add_column(:user_preferences, :time_format_in_24h, :boolean) end diff --git a/db/migrate/20190325165127_add_managed_to_cluster.rb b/db/migrate/20190325165127_add_managed_to_cluster.rb index e960df9d502..14ed4db143e 100644 --- a/db/migrate/20190325165127_add_managed_to_cluster.rb +++ b/db/migrate/20190325165127_add_managed_to_cluster.rb @@ -8,7 +8,7 @@ class AddManagedToCluster < ActiveRecord::Migration[5.0] DOWNTIME = false def up - add_column_with_default(:clusters, :managed, :boolean, default: true) + add_column_with_default(:clusters, :managed, :boolean, default: true) # rubocop:disable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20190327163904_add_notification_email_to_notification_settings.rb b/db/migrate/20190327163904_add_notification_email_to_notification_settings.rb index d912f922510..d8a7e96f902 100644 --- a/db/migrate/20190327163904_add_notification_email_to_notification_settings.rb +++ b/db/migrate/20190327163904_add_notification_email_to_notification_settings.rb @@ -5,7 +5,9 @@ class AddNotificationEmailToNotificationSettings < ActiveRecord::Migration[5.0] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change - add_column :notification_settings, :notification_email, :string # rubocop:disable Migration/AddLimitToStringColumns + add_column :notification_settings, :notification_email, :string end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20190329085614_add_lets_encrypt_terms_of_service_accepted_to_application_settings.rb b/db/migrate/20190329085614_add_lets_encrypt_terms_of_service_accepted_to_application_settings.rb index 16de63f207f..36641e24e45 100644 --- a/db/migrate/20190329085614_add_lets_encrypt_terms_of_service_accepted_to_application_settings.rb +++ b/db/migrate/20190329085614_add_lets_encrypt_terms_of_service_accepted_to_application_settings.rb @@ -12,7 +12,7 @@ class AddLetsEncryptTermsOfServiceAcceptedToApplicationSettings < ActiveRecord:: disable_ddl_transaction! def up - add_column_with_default(:application_settings, :lets_encrypt_terms_of_service_accepted, :boolean, default: false) + add_column_with_default(:application_settings, :lets_encrypt_terms_of_service_accepted, :boolean, default: false) # rubocop:disable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20190402150158_backport_enterprise_schema.rb b/db/migrate/20190402150158_backport_enterprise_schema.rb index d1e911a04e6..694c0feba0a 100644 --- a/db/migrate/20190402150158_backport_enterprise_schema.rb +++ b/db/migrate/20190402150158_backport_enterprise_schema.rb @@ -2,7 +2,8 @@ # rubocop: disable Metrics/AbcSize # rubocop: disable Migration/Datetime -# rubocop: disable Migration/AddLimitToStringColumns +# rubocop: disable Migration/PreventStrings +# rubocop: disable Migration/AddLimitToTextColumns class BackportEnterpriseSchema < ActiveRecord::Migration[5.0] include Gitlab::Database::MigrationHelpers @@ -197,7 +198,7 @@ class BackportEnterpriseSchema < ActiveRecord::Migration[5.0] def add_column_with_default_if_not_exists(table, name, *args) unless column_exists?(table, name) - add_column_with_default(table, name, *args) + add_column_with_default(table, name, *args) # rubocop:disable Migration/AddColumnWithDefault end end @@ -2188,4 +2189,5 @@ class BackportEnterpriseSchema < ActiveRecord::Migration[5.0] end # rubocop: enable Metrics/AbcSize # rubocop: enable Migration/Datetime -# rubocop: enable Migration/AddLimitToStringColumns +# rubocop: enable Migration/PreventStrings +# rubocop: enable Migration/AddLimitToTextColumns diff --git a/db/migrate/20190409224933_add_name_to_geo_nodes.rb b/db/migrate/20190409224933_add_name_to_geo_nodes.rb index 65c01683995..ac3eda701d1 100644 --- a/db/migrate/20190409224933_add_name_to_geo_nodes.rb +++ b/db/migrate/20190409224933_add_name_to_geo_nodes.rb @@ -10,7 +10,7 @@ class AddNameToGeoNodes < ActiveRecord::Migration[5.0] DOWNTIME = false def up - add_column :geo_nodes, :name, :string # rubocop:disable Migration/AddLimitToStringColumns + add_column :geo_nodes, :name, :string # rubocop:disable Migration/PreventStrings # url is also unique, and its type and size is identical to the name column, # so this is safe. diff --git a/db/migrate/20190414185432_add_comment_to_vulnerability_feedback.rb b/db/migrate/20190414185432_add_comment_to_vulnerability_feedback.rb index 63644a2f8fd..f2047e21d1e 100644 --- a/db/migrate/20190414185432_add_comment_to_vulnerability_feedback.rb +++ b/db/migrate/20190414185432_add_comment_to_vulnerability_feedback.rb @@ -5,7 +5,7 @@ class AddCommentToVulnerabilityFeedback < ActiveRecord::Migration[5.1] def up add_column :vulnerability_feedback, :comment_author_id, :integer - add_column :vulnerability_feedback, :comment, :text + add_column :vulnerability_feedback, :comment, :text # rubocop:disable Migration/AddLimitToTextColumns add_column :vulnerability_feedback, :comment_timestamp, :datetime_with_timezone end diff --git a/db/migrate/20190415030217_add_variable_type_to_ci_variables.rb b/db/migrate/20190415030217_add_variable_type_to_ci_variables.rb index 433f510299a..ed7af455e12 100644 --- a/db/migrate/20190415030217_add_variable_type_to_ci_variables.rb +++ b/db/migrate/20190415030217_add_variable_type_to_ci_variables.rb @@ -8,7 +8,7 @@ class AddVariableTypeToCiVariables < ActiveRecord::Migration[5.0] ENV_VAR_VARIABLE_TYPE = 1 def up - add_column_with_default(:ci_variables, :variable_type, :smallint, default: ENV_VAR_VARIABLE_TYPE) + add_column_with_default(:ci_variables, :variable_type, :smallint, default: ENV_VAR_VARIABLE_TYPE) # rubocop:disable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20190416213556_add_variable_type_to_ci_group_variables.rb b/db/migrate/20190416213556_add_variable_type_to_ci_group_variables.rb index dce73caeb5e..4d329cea1b5 100644 --- a/db/migrate/20190416213556_add_variable_type_to_ci_group_variables.rb +++ b/db/migrate/20190416213556_add_variable_type_to_ci_group_variables.rb @@ -8,7 +8,7 @@ class AddVariableTypeToCiGroupVariables < ActiveRecord::Migration[5.0] ENV_VAR_VARIABLE_TYPE = 1 def up - add_column_with_default(:ci_group_variables, :variable_type, :smallint, default: ENV_VAR_VARIABLE_TYPE) + add_column_with_default(:ci_group_variables, :variable_type, :smallint, default: ENV_VAR_VARIABLE_TYPE) # rubocop:disable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20190416213631_add_variable_type_to_ci_pipeline_schedule_variables.rb b/db/migrate/20190416213631_add_variable_type_to_ci_pipeline_schedule_variables.rb index 3079b2afd9c..b7d80cb2d0d 100644 --- a/db/migrate/20190416213631_add_variable_type_to_ci_pipeline_schedule_variables.rb +++ b/db/migrate/20190416213631_add_variable_type_to_ci_pipeline_schedule_variables.rb @@ -8,7 +8,7 @@ class AddVariableTypeToCiPipelineScheduleVariables < ActiveRecord::Migration[5.0 ENV_VAR_VARIABLE_TYPE = 1 def up - add_column_with_default(:ci_pipeline_schedule_variables, :variable_type, :smallint, default: ENV_VAR_VARIABLE_TYPE) + add_column_with_default(:ci_pipeline_schedule_variables, :variable_type, :smallint, default: ENV_VAR_VARIABLE_TYPE) # rubocop:disable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20190422082247_create_project_metrics_settings.rb b/db/migrate/20190422082247_create_project_metrics_settings.rb index a0a2ed64820..177c4820a0c 100644 --- a/db/migrate/20190422082247_create_project_metrics_settings.rb +++ b/db/migrate/20190422082247_create_project_metrics_settings.rb @@ -7,7 +7,7 @@ class CreateProjectMetricsSettings < ActiveRecord::Migration[5.0] def change create_table :project_metrics_settings, id: :int, primary_key: :project_id, default: nil do |t| - t.string :external_dashboard_url, null: false # rubocop:disable Migration/AddLimitToStringColumns + t.string :external_dashboard_url, null: false # rubocop:disable Migration/PreventStrings t.foreign_key :projects, column: :project_id, on_delete: :cascade end end diff --git a/db/migrate/20190429082448_create_pages_domain_acme_orders.rb b/db/migrate/20190429082448_create_pages_domain_acme_orders.rb index ca1796d054c..75636031193 100644 --- a/db/migrate/20190429082448_create_pages_domain_acme_orders.rb +++ b/db/migrate/20190429082448_create_pages_domain_acme_orders.rb @@ -9,8 +9,9 @@ class CreatePagesDomainAcmeOrders < ActiveRecord::Migration[5.1] # Set this constant to true if this migration requires downtime. DOWNTIME = false + # rubocop:disable Migration/PreventStrings + # rubocop:disable Migration/AddLimitToTextColumns def change - # rubocop:disable Migration/AddLimitToStringColumns create_table :pages_domain_acme_orders do |t| t.references :pages_domain, null: false, index: true, foreign_key: { on_delete: :cascade }, type: :integer @@ -25,6 +26,7 @@ class CreatePagesDomainAcmeOrders < ActiveRecord::Migration[5.1] t.text :encrypted_private_key, null: false t.text :encrypted_private_key_iv, null: false end - # rubocop:enable Migration/AddLimitToStringColumns end + # rubocop:enable Migration/AddLimitToTextColumns + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20190430131225_create_issue_tracker_data.rb b/db/migrate/20190430131225_create_issue_tracker_data.rb index d2134ad82c7..2ec9802dbcd 100644 --- a/db/migrate/20190430131225_create_issue_tracker_data.rb +++ b/db/migrate/20190430131225_create_issue_tracker_data.rb @@ -8,8 +8,8 @@ class CreateIssueTrackerData < ActiveRecord::Migration[5.1] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change - # rubocop:disable Migration/AddLimitToStringColumns create_table :issue_tracker_data do |t| t.references :service, foreign_key: { on_delete: :cascade }, type: :integer, index: true, null: false t.timestamps_with_timezone @@ -20,6 +20,6 @@ class CreateIssueTrackerData < ActiveRecord::Migration[5.1] t.string :encrypted_new_issue_url t.string :encrypted_new_issue_url_iv end - # rubocop:enable Migration/AddLimitToStringColumns end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20190430142025_create_jira_tracker_data.rb b/db/migrate/20190430142025_create_jira_tracker_data.rb index 5e53e5a701a..2144c60a267 100644 --- a/db/migrate/20190430142025_create_jira_tracker_data.rb +++ b/db/migrate/20190430142025_create_jira_tracker_data.rb @@ -8,8 +8,8 @@ class CreateJiraTrackerData < ActiveRecord::Migration[5.1] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change - # rubocop:disable Migration/AddLimitToStringColumns create_table :jira_tracker_data do |t| t.references :service, foreign_key: { on_delete: :cascade }, type: :integer, index: true, null: false t.timestamps_with_timezone @@ -23,6 +23,6 @@ class CreateJiraTrackerData < ActiveRecord::Migration[5.1] t.string :encrypted_password_iv t.string :jira_issue_transition_id end - # rubocop:enable Migration/AddLimitToStringColumns end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20190514105711_create_ip_restriction.rb b/db/migrate/20190514105711_create_ip_restriction.rb index 69f8c1b8c4e..51e711ca32b 100644 --- a/db/migrate/20190514105711_create_ip_restriction.rb +++ b/db/migrate/20190514105711_create_ip_restriction.rb @@ -12,7 +12,7 @@ class CreateIpRestriction < ActiveRecord::Migration[5.1] type: :integer, null: false, index: true - t.string :range, null: false # rubocop:disable Migration/AddLimitToStringColumns + t.string :range, null: false # rubocop:disable Migration/PreventStrings end add_foreign_key(:ip_restrictions, :namespaces, column: :group_id, on_delete: :cascade) # rubocop: disable Migration/AddConcurrentForeignKey diff --git a/db/migrate/20190516151857_add_lets_encrypt_private_key_to_application_settings.rb b/db/migrate/20190516151857_add_lets_encrypt_private_key_to_application_settings.rb index e1d3cca48d6..a2692ad32e9 100644 --- a/db/migrate/20190516151857_add_lets_encrypt_private_key_to_application_settings.rb +++ b/db/migrate/20190516151857_add_lets_encrypt_private_key_to_application_settings.rb @@ -9,8 +9,10 @@ class AddLetsEncryptPrivateKeyToApplicationSettings < ActiveRecord::Migration[5. # Set this constant to true if this migration requires downtime. DOWNTIME = false + # rubocop:disable Migration/AddLimitToTextColumns def change add_column :application_settings, :encrypted_lets_encrypt_private_key, :text add_column :application_settings, :encrypted_lets_encrypt_private_key_iv, :text end + # rubocop:enable Migration/AddLimitToTextColumns end diff --git a/db/migrate/20190520200123_add_rule_type_to_approval_merge_request_approval_rules.rb b/db/migrate/20190520200123_add_rule_type_to_approval_merge_request_approval_rules.rb index 7339a4fccba..7bdb48f3eec 100644 --- a/db/migrate/20190520200123_add_rule_type_to_approval_merge_request_approval_rules.rb +++ b/db/migrate/20190520200123_add_rule_type_to_approval_merge_request_approval_rules.rb @@ -12,7 +12,7 @@ class AddRuleTypeToApprovalMergeRequestApprovalRules < ActiveRecord::Migration[5 disable_ddl_transaction! def up - add_column_with_default(:approval_merge_request_rules, :rule_type, :integer, limit: 2, default: 1) + add_column_with_default(:approval_merge_request_rules, :rule_type, :integer, limit: 2, default: 1) # rubocop:disable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20190527011309_add_required_template_name_to_application_settings.rb b/db/migrate/20190527011309_add_required_template_name_to_application_settings.rb index 5c47e6f33c2..9e0f5c5b1e7 100644 --- a/db/migrate/20190527011309_add_required_template_name_to_application_settings.rb +++ b/db/migrate/20190527011309_add_required_template_name_to_application_settings.rb @@ -9,7 +9,9 @@ class AddRequiredTemplateNameToApplicationSettings < ActiveRecord::Migration[5.1 # Set this constant to true if this migration requires downtime. DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change - add_column :application_settings, :required_instance_ci_template, :string, null: true # rubocop:disable Migration/AddLimitToStringColumns + add_column :application_settings, :required_instance_ci_template, :string, null: true end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20190529142545_add_dns_rebinding_protection_enabled_to_application_settings.rb b/db/migrate/20190529142545_add_dns_rebinding_protection_enabled_to_application_settings.rb index 8835dc8b7ba..b50845c85b3 100644 --- a/db/migrate/20190529142545_add_dns_rebinding_protection_enabled_to_application_settings.rb +++ b/db/migrate/20190529142545_add_dns_rebinding_protection_enabled_to_application_settings.rb @@ -11,7 +11,7 @@ class AddDnsRebindingProtectionEnabledToApplicationSettings < ActiveRecord::Migr disable_ddl_transaction! def up - add_column_with_default(:application_settings, :dns_rebinding_protection_enabled, + add_column_with_default(:application_settings, :dns_rebinding_protection_enabled, # rubocop:disable Migration/AddColumnWithDefault :boolean, default: true, allow_null: false) diff --git a/db/migrate/20190604091310_add_ldap_membership_lock.rb b/db/migrate/20190604091310_add_ldap_membership_lock.rb index 1afc6aeefd5..d2e99f33b87 100644 --- a/db/migrate/20190604091310_add_ldap_membership_lock.rb +++ b/db/migrate/20190604091310_add_ldap_membership_lock.rb @@ -11,7 +11,7 @@ class AddLdapMembershipLock < ActiveRecord::Migration[5.1] disable_ddl_transaction! def up - add_column_with_default(:application_settings, :lock_memberships_to_ldap, :boolean, default: false) + add_column_with_default(:application_settings, :lock_memberships_to_ldap, :boolean, default: false) # rubocop:disable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20190605104727_add_default_project_deletion_protection_to_application_settings.rb b/db/migrate/20190605104727_add_default_project_deletion_protection_to_application_settings.rb index ee04b49813b..e660c918fa4 100644 --- a/db/migrate/20190605104727_add_default_project_deletion_protection_to_application_settings.rb +++ b/db/migrate/20190605104727_add_default_project_deletion_protection_to_application_settings.rb @@ -11,7 +11,9 @@ class AddDefaultProjectDeletionProtectionToApplicationSettings < ActiveRecord::M disable_ddl_transaction! def up + # rubocop:disable Migration/AddColumnWithDefault add_column_with_default :application_settings, :default_project_deletion_protection, :boolean, default: false, allow_null: false + # rubocop:enable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20190606054742_add_token_encrypted_to_operations_feature_flags_clients.rb b/db/migrate/20190606054742_add_token_encrypted_to_operations_feature_flags_clients.rb index 2db4dc85750..01cd49ac219 100644 --- a/db/migrate/20190606054742_add_token_encrypted_to_operations_feature_flags_clients.rb +++ b/db/migrate/20190606054742_add_token_encrypted_to_operations_feature_flags_clients.rb @@ -5,7 +5,9 @@ class AddTokenEncryptedToOperationsFeatureFlagsClients < ActiveRecord::Migration DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change - add_column :operations_feature_flags_clients, :token_encrypted, :string # rubocop:disable Migration/AddLimitToStringColumns + add_column :operations_feature_flags_clients, :token_encrypted, :string end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20190606202100_add_name_to_badges.rb b/db/migrate/20190606202100_add_name_to_badges.rb index 472e1202ad8..7b386a6e690 100644 --- a/db/migrate/20190606202100_add_name_to_badges.rb +++ b/db/migrate/20190606202100_add_name_to_badges.rb @@ -6,6 +6,6 @@ class AddNameToBadges < ActiveRecord::Migration[5.0] DOWNTIME = false def change - add_column :badges, :name, :string, null: true, limit: 255 + add_column :badges, :name, :string, null: true, limit: 255 # rubocop:disable Migration/PreventStrings end end diff --git a/db/migrate/20190607085356_add_source_to_pages_domains.rb b/db/migrate/20190607085356_add_source_to_pages_domains.rb index 0a845d7d11f..d681ab67431 100644 --- a/db/migrate/20190607085356_add_source_to_pages_domains.rb +++ b/db/migrate/20190607085356_add_source_to_pages_domains.rb @@ -12,7 +12,7 @@ class AddSourceToPagesDomains < ActiveRecord::Migration[5.1] disable_ddl_transaction! def up - add_column_with_default(:pages_domains, :certificate_source, :smallint, default: 0) + add_column_with_default(:pages_domains, :certificate_source, :smallint, default: 0) # rubocop:disable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20190611090827_add_time_tracking_limit_to_hours_to_application_settings.rb b/db/migrate/20190611090827_add_time_tracking_limit_to_hours_to_application_settings.rb index a5f8925c1db..f0a3ec1d3bc 100644 --- a/db/migrate/20190611090827_add_time_tracking_limit_to_hours_to_application_settings.rb +++ b/db/migrate/20190611090827_add_time_tracking_limit_to_hours_to_application_settings.rb @@ -12,7 +12,9 @@ class AddTimeTrackingLimitToHoursToApplicationSettings < ActiveRecord::Migration disable_ddl_transaction! def up + # rubocop:disable Migration/AddColumnWithDefault add_column_with_default :application_settings, :time_tracking_limit_to_hours, :boolean, default: false, allow_null: false + # rubocop:enable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20190611161641_add_target_project_id_to_merge_trains.rb b/db/migrate/20190611161641_add_target_project_id_to_merge_trains.rb index 553e9371ab3..7b73202ab8d 100644 --- a/db/migrate/20190611161641_add_target_project_id_to_merge_trains.rb +++ b/db/migrate/20190611161641_add_target_project_id_to_merge_trains.rb @@ -5,10 +5,14 @@ class AddTargetProjectIdToMergeTrains < ActiveRecord::Migration[5.1] DOWNTIME = false + # rubocop:disable Rails/NotNullColumn + # rubocop:disable Migration/AddReference + # rubocop:disable Migration/AddLimitToTextColumns def change - # rubocop:disable Rails/NotNullColumn, Migration/AddReference add_reference :merge_trains, :target_project, null: false, index: true, foreign_key: { on_delete: :cascade, to_table: :projects }, type: :integer add_column :merge_trains, :target_branch, :text, null: false - # rubocop:enable Rails/NotNullColumn, Migration/AddReference end + # rubocop:enable Migration/AddLimitToTextColumns + # rubocop:enable Migration/AddReference + # rubocop:enable Rails/NotNullColumn end diff --git a/db/migrate/20190613044655_add_username_to_deploy_tokens.rb b/db/migrate/20190613044655_add_username_to_deploy_tokens.rb index a0acb02013b..ac5a6589f07 100644 --- a/db/migrate/20190613044655_add_username_to_deploy_tokens.rb +++ b/db/migrate/20190613044655_add_username_to_deploy_tokens.rb @@ -4,6 +4,6 @@ class AddUsernameToDeployTokens < ActiveRecord::Migration[5.1] DOWNTIME = false def change - add_column :deploy_tokens, :username, :string # rubocop:disable Migration/AddLimitToStringColumns + add_column :deploy_tokens, :username, :string # rubocop:disable Migration/PreventStrings end end diff --git a/db/migrate/20190613073003_create_project_aliases.rb b/db/migrate/20190613073003_create_project_aliases.rb index 896d3ca5813..ee111d437e9 100644 --- a/db/migrate/20190613073003_create_project_aliases.rb +++ b/db/migrate/20190613073003_create_project_aliases.rb @@ -8,7 +8,7 @@ class CreateProjectAliases < ActiveRecord::Migration[5.1] def change create_table :project_aliases do |t| t.references :project, null: false, index: true, foreign_key: { on_delete: :cascade }, type: :integer - t.string :name, null: false, index: { unique: true } # rubocop:disable Migration/AddLimitToStringColumns + t.string :name, null: false, index: { unique: true } # rubocop:disable Migration/PreventStrings t.timestamps_with_timezone null: false end diff --git a/db/migrate/20190617123615_add_grafana_to_settings.rb b/db/migrate/20190617123615_add_grafana_to_settings.rb index f9c6f4d883e..2d2250cef27 100644 --- a/db/migrate/20190617123615_add_grafana_to_settings.rb +++ b/db/migrate/20190617123615_add_grafana_to_settings.rb @@ -8,7 +8,7 @@ class AddGrafanaToSettings < ActiveRecord::Migration[5.1] DOWNTIME = false def up - add_column_with_default(:application_settings, :grafana_enabled, :boolean, + add_column_with_default(:application_settings, :grafana_enabled, :boolean, # rubocop:disable Migration/AddColumnWithDefault default: false, allow_null: false) end diff --git a/db/migrate/20190621151636_add_merge_request_rebase_jid.rb b/db/migrate/20190621151636_add_merge_request_rebase_jid.rb index 6c1081732e8..df1b1c79375 100644 --- a/db/migrate/20190621151636_add_merge_request_rebase_jid.rb +++ b/db/migrate/20190621151636_add_merge_request_rebase_jid.rb @@ -4,6 +4,6 @@ class AddMergeRequestRebaseJid < ActiveRecord::Migration[5.1] DOWNTIME = false def change - add_column :merge_requests, :rebase_jid, :string # rubocop:disable Migration/AddLimitToStringColumns + add_column :merge_requests, :rebase_jid, :string # rubocop:disable Migration/PreventStrings end end diff --git a/db/migrate/20190624123615_add_grafana_url_to_settings.rb b/db/migrate/20190624123615_add_grafana_url_to_settings.rb index 835ec4e9094..f10014872e9 100644 --- a/db/migrate/20190624123615_add_grafana_url_to_settings.rb +++ b/db/migrate/20190624123615_add_grafana_url_to_settings.rb @@ -7,12 +7,12 @@ class AddGrafanaUrlToSettings < ActiveRecord::Migration[5.1] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def up - # rubocop:disable Migration/AddLimitToStringColumns - add_column_with_default(:application_settings, :grafana_url, :string, + add_column_with_default(:application_settings, :grafana_url, :string, # rubocop:disable Migration/AddColumnWithDefault default: '/-/grafana', allow_null: false) - # rubocop:enable Migration/AddLimitToStringColumns end + # rubocop:enable Migration/PreventStrings def down remove_column(:application_settings, :grafana_url) diff --git a/db/migrate/20190625115224_add_description_to_services.rb b/db/migrate/20190625115224_add_description_to_services.rb index d5ef3900462..bdd6d70cb0f 100644 --- a/db/migrate/20190625115224_add_description_to_services.rb +++ b/db/migrate/20190625115224_add_description_to_services.rb @@ -9,6 +9,6 @@ class AddDescriptionToServices < ActiveRecord::Migration[5.1] DOWNTIME = false def change - add_column :services, :description, :string, limit: 500 + add_column :services, :description, :string, limit: 500 # rubocop:disable Migration/PreventStrings end end diff --git a/db/migrate/20190628145246_add_strategies_to_operations_feature_flag_scopes.rb b/db/migrate/20190628145246_add_strategies_to_operations_feature_flag_scopes.rb index ed1f16ee69a..185a2b04531 100644 --- a/db/migrate/20190628145246_add_strategies_to_operations_feature_flag_scopes.rb +++ b/db/migrate/20190628145246_add_strategies_to_operations_feature_flag_scopes.rb @@ -8,7 +8,9 @@ class AddStrategiesToOperationsFeatureFlagScopes < ActiveRecord::Migration[5.1] disable_ddl_transaction! def up + # rubocop:disable Migration/AddColumnWithDefault add_column_with_default :operations_feature_flag_scopes, :strategies, :jsonb, default: [{ name: "default", parameters: {} }] + # rubocop:enable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20190709204413_add_rule_type_to_approval_project_rules.rb b/db/migrate/20190709204413_add_rule_type_to_approval_project_rules.rb index 87a228c9bf9..b11154d0f26 100644 --- a/db/migrate/20190709204413_add_rule_type_to_approval_project_rules.rb +++ b/db/migrate/20190709204413_add_rule_type_to_approval_project_rules.rb @@ -8,7 +8,7 @@ class AddRuleTypeToApprovalProjectRules < ActiveRecord::Migration[5.1] disable_ddl_transaction! def up - add_column_with_default :approval_project_rules, :rule_type, :integer, limit: 2, default: 0, allow_null: false + add_column_with_default :approval_project_rules, :rule_type, :integer, limit: 2, default: 0, allow_null: false # rubocop:disable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20190711124721_create_job_variables.rb b/db/migrate/20190711124721_create_job_variables.rb index 4ff4b031d8f..6174afc236c 100644 --- a/db/migrate/20190711124721_create_job_variables.rb +++ b/db/migrate/20190711124721_create_job_variables.rb @@ -9,8 +9,9 @@ class CreateJobVariables < ActiveRecord::Migration[5.1] # Set this constant to true if this migration requires downtime. DOWNTIME = false + # rubocop:disable Migration/PreventStrings + # rubocop:disable Migration/AddLimitToTextColumns def change - # rubocop:disable Migration/AddLimitToStringColumns create_table :ci_job_variables do |t| t.string :key, null: false t.text :encrypted_value @@ -18,8 +19,9 @@ class CreateJobVariables < ActiveRecord::Migration[5.1] t.references :job, null: false, index: true, foreign_key: { to_table: :ci_builds, on_delete: :cascade } t.integer :variable_type, null: false, limit: 2, default: 1 end - # rubocop:enable Migration/AddLimitToStringColumns add_index :ci_job_variables, [:key, :job_id], unique: true end + # rubocop:enable Migration/AddLimitToTextColumns + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20190711200508_add_token_encrypted_to_deploy_tokens.rb b/db/migrate/20190711200508_add_token_encrypted_to_deploy_tokens.rb index ea0956fdf7f..dff682e8ce7 100644 --- a/db/migrate/20190711200508_add_token_encrypted_to_deploy_tokens.rb +++ b/db/migrate/20190711200508_add_token_encrypted_to_deploy_tokens.rb @@ -5,7 +5,9 @@ class AddTokenEncryptedToDeployTokens < ActiveRecord::Migration[5.1] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change add_column :deploy_tokens, :token_encrypted, :string, limit: 255 end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20190712064021_add_namespace_per_environment_flag_to_clusters.rb b/db/migrate/20190712064021_add_namespace_per_environment_flag_to_clusters.rb index 4c8a0ab3def..771eb21c4b6 100644 --- a/db/migrate/20190712064021_add_namespace_per_environment_flag_to_clusters.rb +++ b/db/migrate/20190712064021_add_namespace_per_environment_flag_to_clusters.rb @@ -11,7 +11,7 @@ class AddNamespacePerEnvironmentFlagToClusters < ActiveRecord::Migration[5.1] disable_ddl_transaction! def up - add_column_with_default :clusters, :namespace_per_environment, :boolean, default: false + add_column_with_default :clusters, :namespace_per_environment, :boolean, default: false # rubocop:disable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20190715140740_add_event_type_to_design_management_designs_versions.rb b/db/migrate/20190715140740_add_event_type_to_design_management_designs_versions.rb index 81a8b0a3271..136a9d27e25 100644 --- a/db/migrate/20190715140740_add_event_type_to_design_management_designs_versions.rb +++ b/db/migrate/20190715140740_add_event_type_to_design_management_designs_versions.rb @@ -10,7 +10,6 @@ class AddEventTypeToDesignManagementDesignsVersions < ActiveRecord::Migration[5. # We disable these cops here because adding this column is safe. The table does not # have any data in it. # rubocop: disable Migration/AddIndex - # rubocop: disable Migration/AddColumn def up add_column(:design_management_designs_versions, :event, :integer, limit: 2, diff --git a/db/migrate/20190715173819_add_object_storage_flag_to_geo_node.rb b/db/migrate/20190715173819_add_object_storage_flag_to_geo_node.rb index 2d3243f3357..cbc353b6282 100644 --- a/db/migrate/20190715173819_add_object_storage_flag_to_geo_node.rb +++ b/db/migrate/20190715173819_add_object_storage_flag_to_geo_node.rb @@ -12,7 +12,7 @@ class AddObjectStorageFlagToGeoNode < ActiveRecord::Migration[5.2] disable_ddl_transaction! def up - add_column_with_default :geo_nodes, :sync_object_storage, :boolean, default: false + add_column_with_default :geo_nodes, :sync_object_storage, :boolean, default: false # rubocop:disable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20190716144222_create_analytics_cycle_analytics_project_stages.rb b/db/migrate/20190716144222_create_analytics_cycle_analytics_project_stages.rb index 5c005377b00..c03191013dc 100644 --- a/db/migrate/20190716144222_create_analytics_cycle_analytics_project_stages.rb +++ b/db/migrate/20190716144222_create_analytics_cycle_analytics_project_stages.rb @@ -26,7 +26,7 @@ class CreateAnalyticsCycleAnalyticsProjectStages < ActiveRecord::Migration[5.2] }) t.boolean :hidden, default: false, null: false t.boolean :custom, default: true, null: false - t.string :name, null: false, limit: 255 + t.string :name, null: false, limit: 255 # rubocop:disable Migration/PreventStrings end add_index :analytics_cycle_analytics_project_stages, [:project_id, :name], unique: true, name: INDEX_PREFIX + 'on_project_id_and_name' diff --git a/db/migrate/20190722104947_add_static_object_token_to_users.rb b/db/migrate/20190722104947_add_static_object_token_to_users.rb index 180e6a30b04..3983f076b3f 100644 --- a/db/migrate/20190722104947_add_static_object_token_to_users.rb +++ b/db/migrate/20190722104947_add_static_object_token_to_users.rb @@ -8,9 +8,13 @@ class AddStaticObjectTokenToUsers < ActiveRecord::Migration[5.2] disable_ddl_transaction! + # rubocop:disable Migration/AddColumnsToWideTables + # rubocop:disable Migration/PreventStrings def up - add_column :users, :static_object_token, :string, limit: 255 # rubocop:disable Migration/AddColumnsToWideTables + add_column :users, :static_object_token, :string, limit: 255 end + # rubocop:enable Migration/PreventStrings + # rubocop:enable Migration/AddColumnsToWideTables def down remove_column :users, :static_object_token diff --git a/db/migrate/20190722132830_add_static_objects_external_storage_columns_to_application_settings.rb b/db/migrate/20190722132830_add_static_objects_external_storage_columns_to_application_settings.rb index a23e6ed66cd..f493eae26a8 100644 --- a/db/migrate/20190722132830_add_static_objects_external_storage_columns_to_application_settings.rb +++ b/db/migrate/20190722132830_add_static_objects_external_storage_columns_to_application_settings.rb @@ -7,8 +7,10 @@ class AddStaticObjectsExternalStorageColumnsToApplicationSettings < ActiveRecord # Set this constant to true if this migration requires downtime. DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change add_column :application_settings, :static_objects_external_storage_url, :string, limit: 255 add_column :application_settings, :static_objects_external_storage_auth_token, :string, limit: 255 end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20190723153247_create_allowed_email_domains_for_groups.rb b/db/migrate/20190723153247_create_allowed_email_domains_for_groups.rb index c6c5b56ed8b..71af7434f9d 100644 --- a/db/migrate/20190723153247_create_allowed_email_domains_for_groups.rb +++ b/db/migrate/20190723153247_create_allowed_email_domains_for_groups.rb @@ -16,7 +16,7 @@ class CreateAllowedEmailDomainsForGroups < ActiveRecord::Migration[5.2] null: false, index: true t.foreign_key :namespaces, column: :group_id, on_delete: :cascade - t.string :domain, null: false, limit: 255 + t.string :domain, null: false, limit: 255 # rubocop:disable Migration/PreventStrings end end end diff --git a/db/migrate/20190729062536_create_analytics_cycle_analytics_group_stages.rb b/db/migrate/20190729062536_create_analytics_cycle_analytics_group_stages.rb index 5b327dc5332..4753a7684e7 100644 --- a/db/migrate/20190729062536_create_analytics_cycle_analytics_group_stages.rb +++ b/db/migrate/20190729062536_create_analytics_cycle_analytics_group_stages.rb @@ -26,7 +26,7 @@ class CreateAnalyticsCycleAnalyticsGroupStages < ActiveRecord::Migration[5.2] }) t.boolean :hidden, default: false, null: false t.boolean :custom, default: true, null: false - t.string :name, null: false, limit: 255 + t.string :name, null: false, limit: 255 # rubocop:disable Migration/PreventStrings end add_index :analytics_cycle_analytics_group_stages, [:group_id, :name], unique: true, name: INDEX_PREFIX + 'on_group_id_and_name' diff --git a/db/migrate/20190729180447_add_merge_requests_require_code_owner_approval_to_protected_branches.rb b/db/migrate/20190729180447_add_merge_requests_require_code_owner_approval_to_protected_branches.rb index 098fcff9ace..bfac67606d6 100644 --- a/db/migrate/20190729180447_add_merge_requests_require_code_owner_approval_to_protected_branches.rb +++ b/db/migrate/20190729180447_add_merge_requests_require_code_owner_approval_to_protected_branches.rb @@ -9,7 +9,7 @@ class AddMergeRequestsRequireCodeOwnerApprovalToProtectedBranches < ActiveRecord disable_ddl_transaction! def up - add_column_with_default( + add_column_with_default( # rubocop:disable Migration/AddColumnWithDefault :protected_branches, :code_owner_approval_required, :boolean, diff --git a/db/migrate/20190731084415_add_build_need.rb b/db/migrate/20190731084415_add_build_need.rb index 45b8abb480d..ba044260db2 100644 --- a/db/migrate/20190731084415_add_build_need.rb +++ b/db/migrate/20190731084415_add_build_need.rb @@ -11,7 +11,7 @@ class AddBuildNeed < ActiveRecord::Migration[5.2] def change create_table :ci_build_needs, id: :serial do |t| t.integer :build_id, null: false - t.text :name, null: false + t.text :name, null: false # rubocop:disable Migration/AddLimitToTextColumns t.index [:build_id, :name], unique: true t.foreign_key :ci_builds, column: :build_id, on_delete: :cascade diff --git a/db/migrate/20190801142441_add_throttle_protected_path_columns.rb b/db/migrate/20190801142441_add_throttle_protected_path_columns.rb index bb6d54f3b7b..f9e0922ad66 100644 --- a/db/migrate/20190801142441_add_throttle_protected_path_columns.rb +++ b/db/migrate/20190801142441_add_throttle_protected_path_columns.rb @@ -16,10 +16,12 @@ class AddThrottleProtectedPathColumns < ActiveRecord::Migration[5.2] '/import/github/personal_access_token' ] + # rubocop:disable Migration/PreventStrings def change add_column :application_settings, :throttle_protected_paths_enabled, :boolean, default: true, null: false add_column :application_settings, :throttle_protected_paths_requests_per_period, :integer, default: 10, null: false add_column :application_settings, :throttle_protected_paths_period_in_seconds, :integer, default: 60, null: false add_column :application_settings, :protected_paths, :string, array: true, limit: 255, default: DEFAULT_PROTECTED_PATHS end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20190806071559_remove_epic_issues_default_relative_position.rb b/db/migrate/20190806071559_remove_epic_issues_default_relative_position.rb index 3037f2ea106..0994bbbfd17 100644 --- a/db/migrate/20190806071559_remove_epic_issues_default_relative_position.rb +++ b/db/migrate/20190806071559_remove_epic_issues_default_relative_position.rb @@ -14,7 +14,7 @@ class RemoveEpicIssuesDefaultRelativePosition < ActiveRecord::Migration[5.2] change_column_null :epic_issues, :relative_position, true change_column_default :epic_issues, :relative_position, from: 1073741823, to: nil else - add_column_with_default(:epic_issues, :relative_position, :integer, default: nil, allow_null: true) + add_column_with_default(:epic_issues, :relative_position, :integer, default: nil, allow_null: true) # rubocop:disable Migration/AddColumnWithDefault end end diff --git a/db/migrate/20190808152507_add_projects_sorting_field_to_user_preferences.rb b/db/migrate/20190808152507_add_projects_sorting_field_to_user_preferences.rb index 941fead655e..5022ae843e7 100644 --- a/db/migrate/20190808152507_add_projects_sorting_field_to_user_preferences.rb +++ b/db/migrate/20190808152507_add_projects_sorting_field_to_user_preferences.rb @@ -3,9 +3,11 @@ class AddProjectsSortingFieldToUserPreferences < ActiveRecord::Migration[5.2] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def up add_column :user_preferences, :projects_sort, :string, limit: 64 end + # rubocop:enable Migration/PreventStrings def down remove_column :user_preferences, :projects_sort diff --git a/db/migrate/20190816151221_add_active_jobs_limit_to_plans.rb b/db/migrate/20190816151221_add_active_jobs_limit_to_plans.rb index 951ff41f1a8..193e6cb188e 100644 --- a/db/migrate/20190816151221_add_active_jobs_limit_to_plans.rb +++ b/db/migrate/20190816151221_add_active_jobs_limit_to_plans.rb @@ -8,7 +8,7 @@ class AddActiveJobsLimitToPlans < ActiveRecord::Migration[5.2] disable_ddl_transaction! def up - add_column_with_default :plans, :active_jobs_limit, :integer, default: 0 + add_column_with_default :plans, :active_jobs_limit, :integer, default: 0 # rubocop:disable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20190820163320_add_first_last_name_to_user.rb b/db/migrate/20190820163320_add_first_last_name_to_user.rb index 62bd1443b9d..908f55fa821 100644 --- a/db/migrate/20190820163320_add_first_last_name_to_user.rb +++ b/db/migrate/20190820163320_add_first_last_name_to_user.rb @@ -8,9 +8,11 @@ class AddFirstLastNameToUser < ActiveRecord::Migration[5.2] DOWNTIME = false # rubocop:disable Migration/AddColumnsToWideTables + # rubocop:disable Migration/PreventStrings def change add_column(:users, :first_name, :string, null: true, limit: 255) add_column(:users, :last_name, :string, null: true, limit: 255) end + # rubocop:enable Migration/PreventStrings # rubocop:enable Migration/AddColumnsToWideTables end diff --git a/db/migrate/20190821040941_create_cluster_providers_aws.rb b/db/migrate/20190821040941_create_cluster_providers_aws.rb index f80559861c4..666c33759a2 100644 --- a/db/migrate/20190821040941_create_cluster_providers_aws.rb +++ b/db/migrate/20190821040941_create_cluster_providers_aws.rb @@ -3,6 +3,8 @@ class CreateClusterProvidersAws < ActiveRecord::Migration[5.2] DOWNTIME = false + # rubocop:disable Migration/PreventStrings + # rubocop:disable Migration/AddLimitToTextColumns def change create_table :cluster_providers_aws do |t| t.references :cluster, null: false, type: :bigint, index: { unique: true }, foreign_key: { on_delete: :cascade } @@ -30,4 +32,6 @@ class CreateClusterProvidersAws < ActiveRecord::Migration[5.2] t.index [:cluster_id, :status] end end + # rubocop:enable Migration/AddLimitToTextColumns + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20190827222124_add_sourcegraph_configuration_to_application_settings.rb b/db/migrate/20190827222124_add_sourcegraph_configuration_to_application_settings.rb index e624642c2fc..1059f73db8a 100644 --- a/db/migrate/20190827222124_add_sourcegraph_configuration_to_application_settings.rb +++ b/db/migrate/20190827222124_add_sourcegraph_configuration_to_application_settings.rb @@ -9,10 +9,12 @@ class AddSourcegraphConfigurationToApplicationSettings < ActiveRecord::Migration # Set this constant to true if this migration requires downtime. DOWNTIME = false + # rubocop:disable Migration/PreventStrings def up add_column(:application_settings, :sourcegraph_enabled, :boolean, default: false, null: false) add_column(:application_settings, :sourcegraph_url, :string, null: true, limit: 255) end + # rubocop:enable Migration/PreventStrings def down remove_column(:application_settings, :sourcegraph_enabled) diff --git a/db/migrate/20190828172831_create_package_tag.rb b/db/migrate/20190828172831_create_package_tag.rb index baf0a5cf11b..3d26b7ce602 100644 --- a/db/migrate/20190828172831_create_package_tag.rb +++ b/db/migrate/20190828172831_create_package_tag.rb @@ -8,7 +8,7 @@ class CreatePackageTag < ActiveRecord::Migration[5.2] def change create_table :packages_package_tags do |t| t.references :package, index: true, null: false, foreign_key: { to_table: :packages_packages, on_delete: :cascade }, type: :integer - t.string :name, limit: 255, null: false + t.string :name, limit: 255, null: false # rubocop:disable Migration/PreventStrings end end end diff --git a/db/migrate/20190829131130_create_external_pull_requests.rb b/db/migrate/20190829131130_create_external_pull_requests.rb index 0c3168807ec..817f84017e2 100644 --- a/db/migrate/20190829131130_create_external_pull_requests.rb +++ b/db/migrate/20190829131130_create_external_pull_requests.rb @@ -6,6 +6,7 @@ class CreateExternalPullRequests < ActiveRecord::Migration[5.2] DOWNTIME = false INDEX = 'index_external_pull_requests_on_project_and_branches' + # rubocop:disable Migration/PreventStrings def change create_table :external_pull_requests do |t| t.timestamps_with_timezone null: false @@ -22,4 +23,5 @@ class CreateExternalPullRequests < ActiveRecord::Migration[5.2] t.index [:project_id, :source_branch, :target_branch], unique: true, name: INDEX end end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20190901174200_add_max_issue_count_to_list.rb b/db/migrate/20190901174200_add_max_issue_count_to_list.rb index 59359f28d6a..7408d2f1c93 100644 --- a/db/migrate/20190901174200_add_max_issue_count_to_list.rb +++ b/db/migrate/20190901174200_add_max_issue_count_to_list.rb @@ -7,7 +7,7 @@ class AddMaxIssueCountToList < ActiveRecord::Migration[4.2] DOWNTIME = false def up - add_column_with_default :lists, :max_issue_count, :integer, default: 0 + add_column_with_default :lists, :max_issue_count, :integer, default: 0 # rubocop:disable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20190903150358_create_analytics_repository_files_table.rb b/db/migrate/20190903150358_create_analytics_repository_files_table.rb index e7c30a149f9..69c9cd504f4 100644 --- a/db/migrate/20190903150358_create_analytics_repository_files_table.rb +++ b/db/migrate/20190903150358_create_analytics_repository_files_table.rb @@ -5,6 +5,7 @@ class CreateAnalyticsRepositoryFilesTable < ActiveRecord::Migration[5.2] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change create_table :analytics_repository_files do |t| t.references :project, @@ -18,4 +19,5 @@ class CreateAnalyticsRepositoryFilesTable < ActiveRecord::Migration[5.2] add_index :analytics_repository_files, [:project_id, :file_path], unique: true end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20190905140605_add_cloud_run_to_clusters_providers_gcp.rb b/db/migrate/20190905140605_add_cloud_run_to_clusters_providers_gcp.rb index e7ffd7cd4d3..cd6b2fb7d4f 100644 --- a/db/migrate/20190905140605_add_cloud_run_to_clusters_providers_gcp.rb +++ b/db/migrate/20190905140605_add_cloud_run_to_clusters_providers_gcp.rb @@ -8,7 +8,7 @@ class AddCloudRunToClustersProvidersGcp < ActiveRecord::Migration[5.2] disable_ddl_transaction! def up - add_column_with_default(:cluster_providers_gcp, :cloud_run, :boolean, default: false) + add_column_with_default(:cluster_providers_gcp, :cloud_run, :boolean, default: false) # rubocop:disable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20190906104555_create_alerts_service_data.rb b/db/migrate/20190906104555_create_alerts_service_data.rb index 8ce447a67d1..9388a205978 100644 --- a/db/migrate/20190906104555_create_alerts_service_data.rb +++ b/db/migrate/20190906104555_create_alerts_service_data.rb @@ -3,6 +3,7 @@ class CreateAlertsServiceData < ActiveRecord::Migration[5.2] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change create_table :alerts_service_data do |t| t.references :service, type: :integer, index: true, null: false, @@ -12,4 +13,5 @@ class CreateAlertsServiceData < ActiveRecord::Migration[5.2] t.string :encrypted_token_iv, limit: 255 end end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20190907184714_add_show_whitespace_in_diffs_to_user_preferences.rb b/db/migrate/20190907184714_add_show_whitespace_in_diffs_to_user_preferences.rb index 50d5d2b0574..41f9b36278a 100644 --- a/db/migrate/20190907184714_add_show_whitespace_in_diffs_to_user_preferences.rb +++ b/db/migrate/20190907184714_add_show_whitespace_in_diffs_to_user_preferences.rb @@ -11,7 +11,7 @@ class AddShowWhitespaceInDiffsToUserPreferences < ActiveRecord::Migration[5.2] disable_ddl_transaction! def up - add_column_with_default :user_preferences, :show_whitespace_in_diffs, :boolean, default: true, allow_null: false + add_column_with_default :user_preferences, :show_whitespace_in_diffs, :boolean, default: true, allow_null: false # rubocop:disable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20190910211526_create_packages_conan_file_metadata.rb b/db/migrate/20190910211526_create_packages_conan_file_metadata.rb index 0f8dacb72de..a6830a93cbc 100644 --- a/db/migrate/20190910211526_create_packages_conan_file_metadata.rb +++ b/db/migrate/20190910211526_create_packages_conan_file_metadata.rb @@ -5,6 +5,7 @@ class CreatePackagesConanFileMetadata < ActiveRecord::Migration[5.2] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change create_table :packages_conan_file_metadata do |t| t.references :package_file, index: { unique: true }, null: false, foreign_key: { to_table: :packages_package_files, on_delete: :cascade }, type: :bigint @@ -15,4 +16,5 @@ class CreatePackagesConanFileMetadata < ActiveRecord::Migration[5.2] t.integer "conan_file_type", limit: 2, null: false end end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20190913174707_add_spdx_id_to_software_licenses.rb b/db/migrate/20190913174707_add_spdx_id_to_software_licenses.rb index 66cd450895c..46e1400c394 100644 --- a/db/migrate/20190913174707_add_spdx_id_to_software_licenses.rb +++ b/db/migrate/20190913174707_add_spdx_id_to_software_licenses.rb @@ -3,9 +3,11 @@ class AddSpdxIdToSoftwareLicenses < ActiveRecord::Migration[5.2] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def up add_column :software_licenses, :spdx_identifier, :string, limit: 255 end + # rubocop:enable Migration/PreventStrings def down remove_column :software_licenses, :spdx_identifier diff --git a/db/migrate/20190918102042_create_grafana_integrations.rb b/db/migrate/20190918102042_create_grafana_integrations.rb index aac27d129db..d48aaaf45bc 100644 --- a/db/migrate/20190918102042_create_grafana_integrations.rb +++ b/db/migrate/20190918102042_create_grafana_integrations.rb @@ -3,6 +3,7 @@ class CreateGrafanaIntegrations < ActiveRecord::Migration[5.2] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change create_table :grafana_integrations do |t| t.references :project, index: true, foreign_key: { on_delete: :cascade }, unique: true, null: false @@ -12,4 +13,5 @@ class CreateGrafanaIntegrations < ActiveRecord::Migration[5.2] t.string :grafana_url, null: false, limit: 1024 end end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20190918104731_add_cleanup_status_to_cluster.rb b/db/migrate/20190918104731_add_cleanup_status_to_cluster.rb index 0ba9d8e6c89..62290fb0fa6 100644 --- a/db/migrate/20190918104731_add_cleanup_status_to_cluster.rb +++ b/db/migrate/20190918104731_add_cleanup_status_to_cluster.rb @@ -9,7 +9,7 @@ class AddCleanupStatusToCluster < ActiveRecord::Migration[5.2] disable_ddl_transaction! def up - add_column_with_default(:clusters, :cleanup_status, + add_column_with_default(:clusters, :cleanup_status, # rubocop:disable Migration/AddColumnWithDefault :smallint, default: 1, allow_null: false) diff --git a/db/migrate/20190918121135_add_cleanup_status_reason_to_cluster.rb b/db/migrate/20190918121135_add_cleanup_status_reason_to_cluster.rb index 4e71905e3a3..85293ebbe86 100644 --- a/db/migrate/20190918121135_add_cleanup_status_reason_to_cluster.rb +++ b/db/migrate/20190918121135_add_cleanup_status_reason_to_cluster.rb @@ -7,6 +7,6 @@ class AddCleanupStatusReasonToCluster < ActiveRecord::Migration[5.2] DOWNTIME = false def change - add_column :clusters, :cleanup_status_reason, :text + add_column :clusters, :cleanup_status_reason, :text # rubocop:disable Migration/AddLimitToTextColumns end end diff --git a/db/migrate/20190920224341_create_merge_request_context_commits_and_diffs.rb b/db/migrate/20190920224341_create_merge_request_context_commits_and_diffs.rb index dcc9da670f7..bd97d3d3183 100644 --- a/db/migrate/20190920224341_create_merge_request_context_commits_and_diffs.rb +++ b/db/migrate/20190920224341_create_merge_request_context_commits_and_diffs.rb @@ -6,6 +6,8 @@ class CreateMergeRequestContextCommitsAndDiffs < ActiveRecord::Migration[5.2] DOWNTIME = false + # rubocop:disable Migration/PreventStrings + # rubocop:disable Migration/AddLimitToTextColumns def change create_table :merge_request_context_commits do |t| t.references :merge_request, foreign_key: { on_delete: :cascade } @@ -38,4 +40,6 @@ class CreateMergeRequestContextCommitsAndDiffs < ActiveRecord::Migration[5.2] t.index [:merge_request_context_commit_id, :sha], name: 'idx_mr_cc_diff_files_on_mr_cc_id_and_sha' end end + # rubocop:enable Migration/AddLimitToTextColumns + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20190924124627_add_pull_mirror_branch_prefix_to_projects.rb b/db/migrate/20190924124627_add_pull_mirror_branch_prefix_to_projects.rb index f1af925c421..2750468834f 100644 --- a/db/migrate/20190924124627_add_pull_mirror_branch_prefix_to_projects.rb +++ b/db/migrate/20190924124627_add_pull_mirror_branch_prefix_to_projects.rb @@ -3,7 +3,11 @@ class AddPullMirrorBranchPrefixToProjects < ActiveRecord::Migration[5.2] DOWNTIME = false + # rubocop:disable Migration/AddColumnsToWideTables + # rubocop:disable Migration/PreventStrings def change - add_column :projects, :pull_mirror_branch_prefix, :string, limit: 50 # rubocop:disable Migration/AddColumnsToWideTables + add_column :projects, :pull_mirror_branch_prefix, :string, limit: 50 end + # rubocop:enable Migration/PreventStrings + # rubocop:enable Migration/AddColumnsToWideTables end diff --git a/db/migrate/20190926225633_create_x509_signatures.rb b/db/migrate/20190926225633_create_x509_signatures.rb index 88f6b03afba..40d2c351524 100644 --- a/db/migrate/20190926225633_create_x509_signatures.rb +++ b/db/migrate/20190926225633_create_x509_signatures.rb @@ -6,6 +6,7 @@ class CreateX509Signatures < ActiveRecord::Migration[5.2] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change create_table :x509_issuers do |t| t.timestamps_with_timezone null: false @@ -38,4 +39,5 @@ class CreateX509Signatures < ActiveRecord::Migration[5.2] t.integer :verification_status, limit: 2, default: 0, null: false end end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20190927055500_create_description_versions.rb b/db/migrate/20190927055500_create_description_versions.rb index 6ad34d4a89e..b3082533a6f 100644 --- a/db/migrate/20190927055500_create_description_versions.rb +++ b/db/migrate/20190927055500_create_description_versions.rb @@ -11,7 +11,7 @@ class CreateDescriptionVersions < ActiveRecord::Migration[5.2] t.references :issue, index: false, foreign_key: { on_delete: :cascade }, type: :integer t.references :merge_request, index: false, foreign_key: { on_delete: :cascade }, type: :integer t.references :epic, index: false, foreign_key: { on_delete: :cascade }, type: :integer - t.text :description + t.text :description # rubocop:disable Migration/AddLimitToTextColumns end add_index :description_versions, :issue_id, where: 'issue_id IS NOT NULL' diff --git a/db/migrate/20190929180751_create_vulnerabilities.rb b/db/migrate/20190929180751_create_vulnerabilities.rb index aea018c5979..e4c53b1063a 100644 --- a/db/migrate/20190929180751_create_vulnerabilities.rb +++ b/db/migrate/20190929180751_create_vulnerabilities.rb @@ -8,6 +8,7 @@ class CreateVulnerabilities < ActiveRecord::Migration[5.2] DOWNTIME = false + # rubocop:disable Migration/AddLimitToTextColumns def change create_table :vulnerabilities do |t| t.bigint "milestone_id" @@ -30,10 +31,11 @@ class CreateVulnerabilities < ActiveRecord::Migration[5.2] t.integer "confidence", limit: 2, null: false # auto-calculated as lowest-confidence finding, but overrideable t.boolean "severity_overridden", default: false t.boolean "confidence_overridden", default: false - t.string "title", limit: 255, null: false + t.string "title", limit: 255, null: false # rubocop:disable Migration/PreventStrings t.text "title_html", null: false t.text "description" t.text "description_html" end end + # rubocop:enable Migration/AddLimitToTextColumns end diff --git a/db/migrate/20190930153535_create_zoom_meetings.rb b/db/migrate/20190930153535_create_zoom_meetings.rb index 6b92c53da79..8bc9f0e89de 100644 --- a/db/migrate/20190930153535_create_zoom_meetings.rb +++ b/db/migrate/20190930153535_create_zoom_meetings.rb @@ -15,7 +15,7 @@ class CreateZoomMeetings < ActiveRecord::Migration[5.2] null: false t.timestamps_with_timezone null: false t.integer :issue_status, limit: 2, default: 1, null: false - t.string :url, limit: 255 + t.string :url, limit: 255 # rubocop:disable Migration/PreventStrings t.index [:issue_id, :issue_status], unique: true, where: "issue_status = #{ZOOM_MEETING_STATUS_ADDED}" diff --git a/db/migrate/20191001170300_create_ci_ref.rb b/db/migrate/20191001170300_create_ci_ref.rb index af25e67430b..feeb8517e6e 100644 --- a/db/migrate/20191001170300_create_ci_ref.rb +++ b/db/migrate/20191001170300_create_ci_ref.rb @@ -3,6 +3,7 @@ class CreateCiRef < ActiveRecord::Migration[5.2] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change create_table :ci_refs do |t| t.references :project, null: false, index: false, foreign_key: { on_delete: :cascade }, type: :integer @@ -16,4 +17,5 @@ class CreateCiRef < ActiveRecord::Migration[5.2] t.index [:last_updated_by_pipeline_id] end end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20191002123516_create_clusters_applications_elastic_stack.rb b/db/migrate/20191002123516_create_clusters_applications_elastic_stack.rb index 8910dc0d9fb..e1236423672 100644 --- a/db/migrate/20191002123516_create_clusters_applications_elastic_stack.rb +++ b/db/migrate/20191002123516_create_clusters_applications_elastic_stack.rb @@ -8,6 +8,7 @@ class CreateClustersApplicationsElasticStack < ActiveRecord::Migration[5.2] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change create_table :clusters_applications_elastic_stacks do |t| t.timestamps_with_timezone null: false @@ -15,8 +16,9 @@ class CreateClustersApplicationsElasticStack < ActiveRecord::Migration[5.2] t.integer :status, null: false t.string :version, null: false, limit: 255 t.string :kibana_hostname, limit: 255 - t.text :status_reason + t.text :status_reason # rubocop:disable Migration/AddLimitToTextColumns t.index :cluster_id, unique: true end end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20191003015155_add_self_managed_prometheus_alerts.rb b/db/migrate/20191003015155_add_self_managed_prometheus_alerts.rb index 71d10153422..eec6f518257 100644 --- a/db/migrate/20191003015155_add_self_managed_prometheus_alerts.rb +++ b/db/migrate/20191003015155_add_self_managed_prometheus_alerts.rb @@ -3,6 +3,7 @@ class AddSelfManagedPrometheusAlerts < ActiveRecord::Migration[5.2] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change create_table :self_managed_prometheus_alert_events do |t| t.references :project, index: false, foreign_key: { on_delete: :cascade }, null: false @@ -17,4 +18,5 @@ class AddSelfManagedPrometheusAlerts < ActiveRecord::Migration[5.2] t.index [:project_id, :payload_key], unique: true, name: 'idx_project_id_payload_key_self_managed_prometheus_alert_events' end end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20191003060227_add_push_event_hooks_limit_to_application_settings.rb b/db/migrate/20191003060227_add_push_event_hooks_limit_to_application_settings.rb index f107181bbde..4b381dca81b 100644 --- a/db/migrate/20191003060227_add_push_event_hooks_limit_to_application_settings.rb +++ b/db/migrate/20191003060227_add_push_event_hooks_limit_to_application_settings.rb @@ -8,7 +8,7 @@ class AddPushEventHooksLimitToApplicationSettings < ActiveRecord::Migration[5.2] disable_ddl_transaction! def up - add_column_with_default(:application_settings, :push_event_hooks_limit, :integer, default: 3) + add_column_with_default(:application_settings, :push_event_hooks_limit, :integer, default: 3) # rubocop:disable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20191003064615_create_aws_roles.rb b/db/migrate/20191003064615_create_aws_roles.rb index ee35953f558..960e9b28053 100644 --- a/db/migrate/20191003064615_create_aws_roles.rb +++ b/db/migrate/20191003064615_create_aws_roles.rb @@ -6,6 +6,7 @@ class CreateAwsRoles < ActiveRecord::Migration[5.2] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change create_table :aws_roles, id: false do |t| t.references :user, primary_key: true, default: nil, type: :integer, index: { unique: true }, foreign_key: { on_delete: :cascade } @@ -18,4 +19,5 @@ class CreateAwsRoles < ActiveRecord::Migration[5.2] t.index :role_external_id, unique: true end end + # rubocop:enable Migration/PreventStrings 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 c5f5a8cd70c..29ae831d4f4 100644 --- a/db/migrate/20191003195218_add_pendo_enabled_to_application_settings.rb +++ b/db/migrate/20191003195218_add_pendo_enabled_to_application_settings.rb @@ -6,7 +6,7 @@ class AddPendoEnabledToApplicationSettings < ActiveRecord::Migration[5.2] disable_ddl_transaction! def up - add_column_with_default :application_settings, :pendo_enabled, :boolean, default: false, allow_null: false + add_column_with_default :application_settings, :pendo_enabled, :boolean, default: false, allow_null: false # rubocop:disable Migration/AddColumnWithDefault end def down 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 cc0895f8bee..6763cb5544c 100644 --- a/db/migrate/20191003195620_add_pendo_url_to_application_settings.rb +++ b/db/migrate/20191003195620_add_pendo_url_to_application_settings.rb @@ -3,7 +3,9 @@ class AddPendoUrlToApplicationSettings < ActiveRecord::Migration[5.2] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change add_column :application_settings, :pendo_url, :string, limit: 255 end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20191008013056_add_push_event_activities_limit_to_application_settings.rb b/db/migrate/20191008013056_add_push_event_activities_limit_to_application_settings.rb index 84befc95d00..af206bcb8d0 100644 --- a/db/migrate/20191008013056_add_push_event_activities_limit_to_application_settings.rb +++ b/db/migrate/20191008013056_add_push_event_activities_limit_to_application_settings.rb @@ -8,7 +8,7 @@ class AddPushEventActivitiesLimitToApplicationSettings < ActiveRecord::Migration disable_ddl_transaction! def up - add_column_with_default(:application_settings, :push_event_activities_limit, :integer, default: 3) + add_column_with_default(:application_settings, :push_event_activities_limit, :integer, default: 3) # rubocop:disable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20191009222222_add_custom_http_clone_url_root_to_application_settings.rb b/db/migrate/20191009222222_add_custom_http_clone_url_root_to_application_settings.rb index 0fa8ff449f7..41876ee2cdf 100644 --- a/db/migrate/20191009222222_add_custom_http_clone_url_root_to_application_settings.rb +++ b/db/migrate/20191009222222_add_custom_http_clone_url_root_to_application_settings.rb @@ -7,7 +7,9 @@ class AddCustomHttpCloneUrlRootToApplicationSettings < ActiveRecord::Migration[5 # Set this constant to true if this migration requires downtime. DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change add_column :application_settings, :custom_http_clone_url_root, :string, limit: 511 end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20191010174846_add_snowplow_iglu_registry_url_to_application_settings.rb b/db/migrate/20191010174846_add_snowplow_iglu_registry_url_to_application_settings.rb index a40ce8dbee5..8f882bcaa50 100644 --- a/db/migrate/20191010174846_add_snowplow_iglu_registry_url_to_application_settings.rb +++ b/db/migrate/20191010174846_add_snowplow_iglu_registry_url_to_application_settings.rb @@ -3,7 +3,9 @@ class AddSnowplowIgluRegistryUrlToApplicationSettings < ActiveRecord::Migration[5.2] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change add_column :application_settings, :snowplow_iglu_registry_url, :string, limit: 255 end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20191014123159_add_expire_notification_delivered_to_personal_access_tokens.rb b/db/migrate/20191014123159_add_expire_notification_delivered_to_personal_access_tokens.rb index f172d3bdcbd..41a81e3ac87 100644 --- a/db/migrate/20191014123159_add_expire_notification_delivered_to_personal_access_tokens.rb +++ b/db/migrate/20191014123159_add_expire_notification_delivered_to_personal_access_tokens.rb @@ -8,7 +8,7 @@ class AddExpireNotificationDeliveredToPersonalAccessTokens < ActiveRecord::Migra disable_ddl_transaction! def up - add_column_with_default :personal_access_tokens, :expire_notification_delivered, :boolean, default: false + add_column_with_default :personal_access_tokens, :expire_notification_delivered, :boolean, default: false # rubocop:disable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20191017191341_create_clusters_applications_crossplane.rb b/db/migrate/20191017191341_create_clusters_applications_crossplane.rb index 8dc25c56116..42f980ed99d 100644 --- a/db/migrate/20191017191341_create_clusters_applications_crossplane.rb +++ b/db/migrate/20191017191341_create_clusters_applications_crossplane.rb @@ -5,6 +5,7 @@ class CreateClustersApplicationsCrossplane < ActiveRecord::Migration[5.2] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change create_table :clusters_applications_crossplane do |t| t.timestamps_with_timezone null: false @@ -12,8 +13,9 @@ class CreateClustersApplicationsCrossplane < ActiveRecord::Migration[5.2] t.integer :status, null: false t.string :version, null: false, limit: 255 t.string :stack, null: false, limit: 255 - t.text :status_reason + t.text :status_reason # rubocop:disable Migration/AddLimitToTextColumns t.index :cluster_id, unique: true end end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20191025092748_add_secret_token_to_snippet.rb b/db/migrate/20191025092748_add_secret_token_to_snippet.rb index 0649f58d23e..c43c1fbe2b7 100644 --- a/db/migrate/20191025092748_add_secret_token_to_snippet.rb +++ b/db/migrate/20191025092748_add_secret_token_to_snippet.rb @@ -3,8 +3,10 @@ class AddSecretTokenToSnippet < ActiveRecord::Migration[5.2] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change add_column :snippets, :encrypted_secret_token, :string, limit: 255 add_column :snippets, :encrypted_secret_token_iv, :string, limit: 255 end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20191028130054_add_max_issue_weight_to_list.rb b/db/migrate/20191028130054_add_max_issue_weight_to_list.rb index eec7c42c907..f15b65067f6 100644 --- a/db/migrate/20191028130054_add_max_issue_weight_to_list.rb +++ b/db/migrate/20191028130054_add_max_issue_weight_to_list.rb @@ -8,7 +8,7 @@ class AddMaxIssueWeightToList < ActiveRecord::Migration[5.2] DOWNTIME = false def up - add_column_with_default :lists, :max_issue_weight, :integer, default: 0 + add_column_with_default :lists, :max_issue_weight, :integer, default: 0 # rubocop:disable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20191029125305_create_packages_conan_metadata.rb b/db/migrate/20191029125305_create_packages_conan_metadata.rb index c6abc509e41..fa14b73e19b 100644 --- a/db/migrate/20191029125305_create_packages_conan_metadata.rb +++ b/db/migrate/20191029125305_create_packages_conan_metadata.rb @@ -5,6 +5,7 @@ class CreatePackagesConanMetadata < ActiveRecord::Migration[5.2] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change create_table :packages_conan_metadata do |t| t.references :package, index: { unique: true }, null: false, foreign_key: { to_table: :packages_packages, on_delete: :cascade }, type: :bigint @@ -13,4 +14,5 @@ class CreatePackagesConanMetadata < ActiveRecord::Migration[5.2] t.string "package_channel", null: false, limit: 255 end end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20191029191901_add_enabled_to_grafana_integrations.rb b/db/migrate/20191029191901_add_enabled_to_grafana_integrations.rb index 8db11724874..40e361e2150 100644 --- a/db/migrate/20191029191901_add_enabled_to_grafana_integrations.rb +++ b/db/migrate/20191029191901_add_enabled_to_grafana_integrations.rb @@ -8,7 +8,7 @@ class AddEnabledToGrafanaIntegrations < ActiveRecord::Migration[5.2] disable_ddl_transaction! def up - add_column_with_default( + add_column_with_default( # rubocop:disable Migration/AddColumnWithDefault :grafana_integrations, :enabled, :boolean, diff --git a/db/migrate/20191103202505_add_eks_credentials_to_application_settings.rb b/db/migrate/20191103202505_add_eks_credentials_to_application_settings.rb index 3a167b4c67f..5ed3e7edb3c 100644 --- a/db/migrate/20191103202505_add_eks_credentials_to_application_settings.rb +++ b/db/migrate/20191103202505_add_eks_credentials_to_application_settings.rb @@ -4,6 +4,8 @@ class AddEksCredentialsToApplicationSettings < ActiveRecord::Migration[5.2] # Set this constant to true if this migration requires downtime. DOWNTIME = false + # rubocop:disable Migration/PreventStrings + # rubocop:disable Migration/AddLimitToTextColumns def change add_column :application_settings, :eks_integration_enabled, :boolean, null: false, default: false add_column :application_settings, :eks_account_id, :string, limit: 128 @@ -11,4 +13,6 @@ class AddEksCredentialsToApplicationSettings < ActiveRecord::Migration[5.2] add_column :application_settings, :encrypted_eks_secret_access_key_iv, :string, limit: 255 add_column :application_settings, :encrypted_eks_secret_access_key, :text end + # rubocop:enable Migration/AddLimitToTextColumns + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20191105134413_create_service_desk_settings.rb b/db/migrate/20191105134413_create_service_desk_settings.rb index ee026b6f26d..dc8268f1c90 100644 --- a/db/migrate/20191105134413_create_service_desk_settings.rb +++ b/db/migrate/20191105134413_create_service_desk_settings.rb @@ -3,6 +3,7 @@ class CreateServiceDeskSettings < ActiveRecord::Migration[5.2] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change create_table :service_desk_settings, id: false do |t| t.references :project, @@ -15,4 +16,5 @@ class CreateServiceDeskSettings < ActiveRecord::Migration[5.2] t.string :issue_template_key, limit: 255 end end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20191105155113_add_secret_to_snippet.rb b/db/migrate/20191105155113_add_secret_to_snippet.rb index ae514d48494..8f0a330238b 100644 --- a/db/migrate/20191105155113_add_secret_to_snippet.rb +++ b/db/migrate/20191105155113_add_secret_to_snippet.rb @@ -9,7 +9,7 @@ class AddSecretToSnippet < ActiveRecord::Migration[5.2] def up unless column_exists?(:snippets, :secret) - add_column_with_default :snippets, :secret, :boolean, default: false + add_column_with_default :snippets, :secret, :boolean, default: false # rubocop:disable Migration/AddColumnWithDefault end add_concurrent_index :snippets, [:visibility_level, :secret] diff --git a/db/migrate/20191106144901_add_state_to_merge_trains.rb b/db/migrate/20191106144901_add_state_to_merge_trains.rb index e2256705f53..64a70575c91 100644 --- a/db/migrate/20191106144901_add_state_to_merge_trains.rb +++ b/db/migrate/20191106144901_add_state_to_merge_trains.rb @@ -9,7 +9,7 @@ class AddStateToMergeTrains < ActiveRecord::Migration[5.2] disable_ddl_transaction! def up - add_column_with_default :merge_trains, :status, :integer, limit: 2, default: MERGE_TRAIN_STATUS_CREATED + add_column_with_default :merge_trains, :status, :integer, limit: 2, default: MERGE_TRAIN_STATUS_CREATED # rubocop:disable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20191111121500_default_ci_config_path.rb b/db/migrate/20191111121500_default_ci_config_path.rb index f391f5ffe99..3914058d35b 100644 --- a/db/migrate/20191111121500_default_ci_config_path.rb +++ b/db/migrate/20191111121500_default_ci_config_path.rb @@ -3,9 +3,11 @@ class DefaultCiConfigPath < ActiveRecord::Migration[5.2] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def up add_column :application_settings, :default_ci_config_path, :string, limit: 255 end + # rubocop:enable Migration/PreventStrings def down remove_column :application_settings, :default_ci_config_path diff --git a/db/migrate/20191112090226_add_artifacts_to_ci_build_need.rb b/db/migrate/20191112090226_add_artifacts_to_ci_build_need.rb index 2fbd003b2e5..b868e0b44a8 100644 --- a/db/migrate/20191112090226_add_artifacts_to_ci_build_need.rb +++ b/db/migrate/20191112090226_add_artifacts_to_ci_build_need.rb @@ -8,7 +8,7 @@ class AddArtifactsToCiBuildNeed < ActiveRecord::Migration[5.2] disable_ddl_transaction! def up - add_column_with_default(:ci_build_needs, :artifacts, + add_column_with_default(:ci_build_needs, :artifacts, # rubocop:disable Migration/AddColumnWithDefault :boolean, default: true, allow_null: false) diff --git a/db/migrate/20191119231621_create_container_expiration_policies.rb b/db/migrate/20191119231621_create_container_expiration_policies.rb index d7108870cf1..d06ae659f41 100644 --- a/db/migrate/20191119231621_create_container_expiration_policies.rb +++ b/db/migrate/20191119231621_create_container_expiration_policies.rb @@ -3,6 +3,7 @@ class CreateContainerExpirationPolicies < ActiveRecord::Migration[5.2] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change create_table :container_expiration_policies, id: false, primary_key: :project_id do |t| t.timestamps_with_timezone null: false @@ -18,4 +19,5 @@ class CreateContainerExpirationPolicies < ActiveRecord::Migration[5.2] add_index :container_expiration_policies, [:next_run_at, :enabled], name: 'index_container_expiration_policies_on_next_run_at_and_enabled' end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20191120084627_add_encrypted_fields_to_application_settings.rb b/db/migrate/20191120084627_add_encrypted_fields_to_application_settings.rb index 4e0886a5121..7bb2d9c6301 100644 --- a/db/migrate/20191120084627_add_encrypted_fields_to_application_settings.rb +++ b/db/migrate/20191120084627_add_encrypted_fields_to_application_settings.rb @@ -14,12 +14,16 @@ class AddEncryptedFieldsToApplicationSettings < ActiveRecord::Migration[5.2] slack_app_verification_token ].freeze + # rubocop:disable Migration/PreventStrings + # rubocop:disable Migration/AddLimitToTextColumns def up PLAINTEXT_ATTRIBUTES.each do |plaintext_attribute| add_column :application_settings, "encrypted_#{plaintext_attribute}", :text add_column :application_settings, "encrypted_#{plaintext_attribute}_iv", :string, limit: 255 end end + # rubocop:enable Migration/AddLimitToTextColumns + # rubocop:enable Migration/PreventStrings def down PLAINTEXT_ATTRIBUTES.each do |plaintext_attribute| diff --git a/db/migrate/20191121111621_create_packages_dependencies.rb b/db/migrate/20191121111621_create_packages_dependencies.rb index 61e52627b05..29a8434514e 100644 --- a/db/migrate/20191121111621_create_packages_dependencies.rb +++ b/db/migrate/20191121111621_create_packages_dependencies.rb @@ -3,6 +3,7 @@ class CreatePackagesDependencies < ActiveRecord::Migration[5.2] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change create_table :packages_dependencies do |t| t.string :name, null: false, limit: 255 @@ -11,4 +12,5 @@ class CreatePackagesDependencies < ActiveRecord::Migration[5.2] add_index :packages_dependencies, [:name, :version_pattern], unique: true end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20191121193110_add_issue_links_type.rb b/db/migrate/20191121193110_add_issue_links_type.rb index 61ef2e7d7e8..86bfd41b916 100644 --- a/db/migrate/20191121193110_add_issue_links_type.rb +++ b/db/migrate/20191121193110_add_issue_links_type.rb @@ -8,7 +8,7 @@ class AddIssueLinksType < ActiveRecord::Migration[5.1] disable_ddl_transaction! def up - add_column_with_default :issue_links, :link_type, :integer, default: 0, limit: 2 + add_column_with_default :issue_links, :link_type, :integer, default: 0, limit: 2 # rubocop:disable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20191125133353_add_target_path_to_broadcast_message.rb b/db/migrate/20191125133353_add_target_path_to_broadcast_message.rb index 65aa758e502..8597cce5b19 100644 --- a/db/migrate/20191125133353_add_target_path_to_broadcast_message.rb +++ b/db/migrate/20191125133353_add_target_path_to_broadcast_message.rb @@ -3,7 +3,9 @@ class AddTargetPathToBroadcastMessage < ActiveRecord::Migration[5.2] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change add_column :broadcast_messages, :target_path, :string, limit: 255 end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20191125140458_create_import_failures.rb b/db/migrate/20191125140458_create_import_failures.rb index 43e8efe90a4..e5dbcf5d41d 100644 --- a/db/migrate/20191125140458_create_import_failures.rb +++ b/db/migrate/20191125140458_create_import_failures.rb @@ -3,6 +3,7 @@ class CreateImportFailures < ActiveRecord::Migration[5.2] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change create_table :import_failures do |t| t.integer :relation_index @@ -14,4 +15,5 @@ class CreateImportFailures < ActiveRecord::Migration[5.2] t.string :exception_message, limit: 255 end end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20191127030005_create_serverless_domain_cluster.rb b/db/migrate/20191127030005_create_serverless_domain_cluster.rb index 7fb24400b0d..c65301bf133 100644 --- a/db/migrate/20191127030005_create_serverless_domain_cluster.rb +++ b/db/migrate/20191127030005_create_serverless_domain_cluster.rb @@ -3,6 +3,7 @@ class CreateServerlessDomainCluster < ActiveRecord::Migration[5.2] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change create_table :serverless_domain_cluster, id: false, primary_key: :uuid do |t| t.references :pages_domain, null: false, foreign_key: { on_delete: :cascade } @@ -14,4 +15,5 @@ class CreateServerlessDomainCluster < ActiveRecord::Migration[5.2] t.string :uuid, null: false, limit: 14, primary_key: true end end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20191127163053_add_confidential_to_doorkeeper_application.rb b/db/migrate/20191127163053_add_confidential_to_doorkeeper_application.rb index 1fb02085c37..12e22b4744c 100644 --- a/db/migrate/20191127163053_add_confidential_to_doorkeeper_application.rb +++ b/db/migrate/20191127163053_add_confidential_to_doorkeeper_application.rb @@ -8,7 +8,7 @@ class AddConfidentialToDoorkeeperApplication < ActiveRecord::Migration[5.2] disable_ddl_transaction! def up - add_column_with_default( + add_column_with_default( # rubocop:disable Migration/AddColumnWithDefault :oauth_applications, :confidential, :boolean, diff --git a/db/migrate/20191127221608_add_wildcard_and_domain_type_to_pages_domains.rb b/db/migrate/20191127221608_add_wildcard_and_domain_type_to_pages_domains.rb index 6893a02bcad..96a2e8275c6 100644 --- a/db/migrate/20191127221608_add_wildcard_and_domain_type_to_pages_domains.rb +++ b/db/migrate/20191127221608_add_wildcard_and_domain_type_to_pages_domains.rb @@ -9,8 +9,8 @@ class AddWildcardAndDomainTypeToPagesDomains < ActiveRecord::Migration[5.2] disable_ddl_transaction! def up - add_column_with_default :pages_domains, :wildcard, :boolean, default: false - add_column_with_default :pages_domains, :domain_type, :integer, limit: 2, default: PROJECT_TYPE + add_column_with_default :pages_domains, :wildcard, :boolean, default: false # rubocop:disable Migration/AddColumnWithDefault + add_column_with_default :pages_domains, :domain_type, :integer, limit: 2, default: PROJECT_TYPE # rubocop:disable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20191128145231_add_ci_resource_groups.rb b/db/migrate/20191128145231_add_ci_resource_groups.rb index 8bde0254701..77975120f72 100644 --- a/db/migrate/20191128145231_add_ci_resource_groups.rb +++ b/db/migrate/20191128145231_add_ci_resource_groups.rb @@ -7,7 +7,7 @@ class AddCiResourceGroups < ActiveRecord::Migration[5.2] create_table :ci_resource_groups do |t| t.timestamps_with_timezone t.bigint :project_id, null: false - t.string :key, null: false, limit: 255 + t.string :key, null: false, limit: 255 # rubocop:disable Migration/PreventStrings t.index %i[project_id key], unique: true end diff --git a/db/migrate/20191129134844_add_broadcast_type_to_broadcast_message.rb b/db/migrate/20191129134844_add_broadcast_type_to_broadcast_message.rb index 84d17f558d1..884d9ac6d7f 100644 --- a/db/migrate/20191129134844_add_broadcast_type_to_broadcast_message.rb +++ b/db/migrate/20191129134844_add_broadcast_type_to_broadcast_message.rb @@ -10,7 +10,7 @@ class AddBroadcastTypeToBroadcastMessage < ActiveRecord::Migration[5.2] disable_ddl_transaction! def up - add_column_with_default(:broadcast_messages, :broadcast_type, :smallint, default: BROADCAST_MESSAGE_BANNER_TYPE) + add_column_with_default(:broadcast_messages, :broadcast_type, :smallint, default: BROADCAST_MESSAGE_BANNER_TYPE) # rubocop:disable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20191202181924_add_environment_auto_stop_in_to_ci_builds_metadata.rb b/db/migrate/20191202181924_add_environment_auto_stop_in_to_ci_builds_metadata.rb index bce191a7ec0..c09196da91b 100644 --- a/db/migrate/20191202181924_add_environment_auto_stop_in_to_ci_builds_metadata.rb +++ b/db/migrate/20191202181924_add_environment_auto_stop_in_to_ci_builds_metadata.rb @@ -3,9 +3,11 @@ class AddEnvironmentAutoStopInToCiBuildsMetadata < ActiveRecord::Migration[5.2] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def up add_column :ci_builds_metadata, :environment_auto_stop_in, :string, limit: 255 end + # rubocop:enable Migration/PreventStrings def down remove_column :ci_builds_metadata, :environment_auto_stop_in diff --git a/db/migrate/20191204192726_add_design_disk_path_to_geo_hashed_storage_migrated_events.rb b/db/migrate/20191204192726_add_design_disk_path_to_geo_hashed_storage_migrated_events.rb index 39b5d5c7e97..8631502ded8 100644 --- a/db/migrate/20191204192726_add_design_disk_path_to_geo_hashed_storage_migrated_events.rb +++ b/db/migrate/20191204192726_add_design_disk_path_to_geo_hashed_storage_migrated_events.rb @@ -5,8 +5,10 @@ class AddDesignDiskPathToGeoHashedStorageMigratedEvents < ActiveRecord::Migratio DOWNTIME = false + # rubocop:disable Migration/AddLimitToTextColumns def change add_column :geo_hashed_storage_migrated_events, :old_design_disk_path, :text add_column :geo_hashed_storage_migrated_events, :new_design_disk_path, :text end + # rubocop:enable Migration/AddLimitToTextColumns end diff --git a/db/migrate/20191206014412_add_image_to_design_management_designs_versions.rb b/db/migrate/20191206014412_add_image_to_design_management_designs_versions.rb index d8e2269d21a..54ef9b74f29 100644 --- a/db/migrate/20191206014412_add_image_to_design_management_designs_versions.rb +++ b/db/migrate/20191206014412_add_image_to_design_management_designs_versions.rb @@ -3,7 +3,9 @@ class AddImageToDesignManagementDesignsVersions < ActiveRecord::Migration[6.0] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change add_column :design_management_designs_versions, :image_v432x230, :string, limit: 255 end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20191208110214_add_suggestion_commit_message_to_projects.rb b/db/migrate/20191208110214_add_suggestion_commit_message_to_projects.rb index cb897edde8e..3c96a1737c2 100644 --- a/db/migrate/20191208110214_add_suggestion_commit_message_to_projects.rb +++ b/db/migrate/20191208110214_add_suggestion_commit_message_to_projects.rb @@ -3,7 +3,11 @@ class AddSuggestionCommitMessageToProjects < ActiveRecord::Migration[5.2] DOWNTIME = false + # rubocop:disable Migration/AddColumnsToWideTables + # rubocop:disable Migration/PreventStrings def change - add_column :projects, :suggestion_commit_message, :string, limit: 255 # rubocop:disable Migration/AddColumnsToWideTables + add_column :projects, :suggestion_commit_message, :string, limit: 255 end + # rubocop:enable Migration/PreventStrings + # rubocop:enable Migration/AddColumnsToWideTables end diff --git a/db/migrate/20191212140117_change_commit_user_mentions_commit_id_column_type.rb b/db/migrate/20191212140117_change_commit_user_mentions_commit_id_column_type.rb index f30cdab3441..f205de3587e 100644 --- a/db/migrate/20191212140117_change_commit_user_mentions_commit_id_column_type.rb +++ b/db/migrate/20191212140117_change_commit_user_mentions_commit_id_column_type.rb @@ -12,6 +12,7 @@ class ChangeCommitUserMentionsCommitIdColumnType < ActiveRecord::Migration[5.2] NEW_TMP_INDEX = 'temp_commit_id_for_type_change_and_note_id_index' NEW_INDEX = 'commit_id_and_note_id_index' + # rubocop:disable Migration/PreventStrings def up # the initial index name is too long and fails during migration. Renaming the index first. add_concurrent_index :commit_user_mentions, [:commit_id, :note_id], name: OLD_TMP_INDEX @@ -29,6 +30,7 @@ class ChangeCommitUserMentionsCommitIdColumnType < ActiveRecord::Migration[5.2] add_concurrent_index :commit_user_mentions, [:commit_id_for_type_change, :note_id], name: NEW_INDEX remove_concurrent_index_by_name :commit_user_mentions, NEW_TMP_INDEX end + # rubocop:enable Migration/PreventStrings def down cleanup_concurrent_column_type_change :commit_user_mentions, :commit_id diff --git a/db/migrate/20191213104838_add_service_desk_username.rb b/db/migrate/20191213104838_add_service_desk_username.rb index 945bdb67fa1..d50de4c362c 100644 --- a/db/migrate/20191213104838_add_service_desk_username.rb +++ b/db/migrate/20191213104838_add_service_desk_username.rb @@ -3,7 +3,9 @@ class AddServiceDeskUsername < ActiveRecord::Migration[5.2] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change add_column :service_desk_settings, :outgoing_name, :string, limit: 255 end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20191213143656_create_ci_pipelines_config.rb b/db/migrate/20191213143656_create_ci_pipelines_config.rb index 92636f35d01..a1821ee9f66 100644 --- a/db/migrate/20191213143656_create_ci_pipelines_config.rb +++ b/db/migrate/20191213143656_create_ci_pipelines_config.rb @@ -8,7 +8,7 @@ class CreateCiPipelinesConfig < ActiveRecord::Migration[5.2] t.references :pipeline, primary_key: true, foreign_key: { to_table: :ci_pipelines, on_delete: :cascade } - t.text :content, null: false + t.text :content, null: false # rubocop:disable Migration/AddLimitToTextColumns end end end diff --git a/db/migrate/20191217165641_add_saml_provider_prohibited_outer_forks.rb b/db/migrate/20191217165641_add_saml_provider_prohibited_outer_forks.rb index 6cd32cdcfe9..4b528578848 100644 --- a/db/migrate/20191217165641_add_saml_provider_prohibited_outer_forks.rb +++ b/db/migrate/20191217165641_add_saml_provider_prohibited_outer_forks.rb @@ -8,7 +8,7 @@ class AddSamlProviderProhibitedOuterForks < ActiveRecord::Migration[5.2] disable_ddl_transaction! def up - add_column_with_default :saml_providers, :prohibited_outer_forks, :boolean, default: false, allow_null: true + add_column_with_default :saml_providers, :prohibited_outer_forks, :boolean, default: false, allow_null: true # rubocop:disable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20191218084115_add_updating_name_disabled_for_users_to_application_settings.rb b/db/migrate/20191218084115_add_updating_name_disabled_for_users_to_application_settings.rb index eb9d4ace5b4..d0b2e53650b 100644 --- a/db/migrate/20191218084115_add_updating_name_disabled_for_users_to_application_settings.rb +++ b/db/migrate/20191218084115_add_updating_name_disabled_for_users_to_application_settings.rb @@ -8,7 +8,7 @@ class AddUpdatingNameDisabledForUsersToApplicationSettings < ActiveRecord::Migra disable_ddl_transaction! def up - add_column_with_default(:application_settings, :updating_name_disabled_for_users, + add_column_with_default(:application_settings, :updating_name_disabled_for_users, # rubocop:disable Migration/AddColumnWithDefault :boolean, default: false, allow_null: false) diff --git a/db/migrate/20191218124915_add_repository_storage_to_snippets.rb b/db/migrate/20191218124915_add_repository_storage_to_snippets.rb index ff391c04062..e2ba11aef20 100644 --- a/db/migrate/20191218124915_add_repository_storage_to_snippets.rb +++ b/db/migrate/20191218124915_add_repository_storage_to_snippets.rb @@ -7,8 +7,9 @@ class AddRepositoryStorageToSnippets < ActiveRecord::Migration[5.2] disable_ddl_transaction! + # rubocop:disable Migration/PreventStrings def up - add_column_with_default( + add_column_with_default( # rubocop:disable Migration/AddColumnWithDefault :snippets, :repository_storage, :string, @@ -17,6 +18,7 @@ class AddRepositoryStorageToSnippets < ActiveRecord::Migration[5.2] allow_null: false ) end + # rubocop:enable Migration/PreventStrings def down remove_column(:snippets, :repository_storage) diff --git a/db/migrate/20191218125015_add_storage_version_to_snippets.rb b/db/migrate/20191218125015_add_storage_version_to_snippets.rb index 659f36f42b5..b1bd3589692 100644 --- a/db/migrate/20191218125015_add_storage_version_to_snippets.rb +++ b/db/migrate/20191218125015_add_storage_version_to_snippets.rb @@ -8,7 +8,7 @@ class AddStorageVersionToSnippets < ActiveRecord::Migration[5.2] disable_ddl_transaction! def up - add_column_with_default( + add_column_with_default( # rubocop:disable Migration/AddColumnWithDefault :snippets, :storage_version, :integer, diff --git a/db/migrate/20200102140148_add_expanded_environment_name_to_ci_build_metadata.rb b/db/migrate/20200102140148_add_expanded_environment_name_to_ci_build_metadata.rb index e76806c5d3f..21520f86bf8 100644 --- a/db/migrate/20200102140148_add_expanded_environment_name_to_ci_build_metadata.rb +++ b/db/migrate/20200102140148_add_expanded_environment_name_to_ci_build_metadata.rb @@ -3,9 +3,11 @@ class AddExpandedEnvironmentNameToCiBuildMetadata < ActiveRecord::Migration[5.2] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def up add_column :ci_builds_metadata, :expanded_environment_name, :string, limit: 255 end + # rubocop:enable Migration/PreventStrings def down remove_column :ci_builds_metadata, :expanded_environment_name diff --git a/db/migrate/20200121192942_create_geo_events.rb b/db/migrate/20200121192942_create_geo_events.rb index 6dbe131051f..0c885e8524c 100644 --- a/db/migrate/20200121192942_create_geo_events.rb +++ b/db/migrate/20200121192942_create_geo_events.rb @@ -3,6 +3,7 @@ class CreateGeoEvents < ActiveRecord::Migration[5.2] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change create_table :geo_events do |t| t.string :replicable_name, limit: 255, null: false @@ -11,4 +12,5 @@ class CreateGeoEvents < ActiveRecord::Migration[5.2] t.datetime_with_timezone :created_at, null: false end end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20200122161638_add_deploy_token_type_to_deploy_tokens.rb b/db/migrate/20200122161638_add_deploy_token_type_to_deploy_tokens.rb index 2fe79250ea2..99459199709 100644 --- a/db/migrate/20200122161638_add_deploy_token_type_to_deploy_tokens.rb +++ b/db/migrate/20200122161638_add_deploy_token_type_to_deploy_tokens.rb @@ -8,7 +8,7 @@ class AddDeployTokenTypeToDeployTokens < ActiveRecord::Migration[5.2] DOWNTIME = false def up - add_column_with_default :deploy_tokens, :deploy_token_type, :integer, default: 2, limit: 2, allow_null: false + add_column_with_default :deploy_tokens, :deploy_token_type, :integer, default: 2, limit: 2, allow_null: false # rubocop:disable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20200124053531_add_source_to_import_failures.rb b/db/migrate/20200124053531_add_source_to_import_failures.rb index 532d5803c74..2ca0bcba09f 100644 --- a/db/migrate/20200124053531_add_source_to_import_failures.rb +++ b/db/migrate/20200124053531_add_source_to_import_failures.rb @@ -3,7 +3,9 @@ class AddSourceToImportFailures < ActiveRecord::Migration[5.2] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change add_column :import_failures, :source, :string, limit: 128 end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20200128184209_add_usage_to_pages_domains.rb b/db/migrate/20200128184209_add_usage_to_pages_domains.rb index ac644814076..292490078cd 100644 --- a/db/migrate/20200128184209_add_usage_to_pages_domains.rb +++ b/db/migrate/20200128184209_add_usage_to_pages_domains.rb @@ -9,7 +9,7 @@ class AddUsageToPagesDomains < ActiveRecord::Migration[5.2] disable_ddl_transaction! def up - add_column_with_default :pages_domains, :usage, :integer, limit: 2, default: PAGES_USAGE, allow_null: false + add_column_with_default :pages_domains, :usage, :integer, limit: 2, default: PAGES_USAGE, allow_null: false # rubocop:disable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20200129133716_add_resource_milestone_events_table.rb b/db/migrate/20200129133716_add_resource_milestone_events_table.rb index 0ead21820c2..681190a8744 100644 --- a/db/migrate/20200129133716_add_resource_milestone_events_table.rb +++ b/db/migrate/20200129133716_add_resource_milestone_events_table.rb @@ -3,6 +3,7 @@ class AddResourceMilestoneEventsTable < ActiveRecord::Migration[5.2] DOWNTIME = false + # rubocop:disable Migration/AddLimitToTextColumns def change create_table :resource_milestone_events, id: :bigserial do |t| t.references :user, null: false, foreign_key: { on_delete: :nullify }, @@ -22,4 +23,5 @@ class AddResourceMilestoneEventsTable < ActiveRecord::Migration[5.2] t.datetime_with_timezone :created_at, null: false end end + # rubocop:enable Migration/AddLimitToTextColumns end diff --git a/db/migrate/20200130134335_add_cert_and_key_to_serverless_domain_cluster.rb b/db/migrate/20200130134335_add_cert_and_key_to_serverless_domain_cluster.rb index 39249053ee0..81764aefe7c 100644 --- a/db/migrate/20200130134335_add_cert_and_key_to_serverless_domain_cluster.rb +++ b/db/migrate/20200130134335_add_cert_and_key_to_serverless_domain_cluster.rb @@ -5,9 +5,13 @@ class AddCertAndKeyToServerlessDomainCluster < ActiveRecord::Migration[5.2] DOWNTIME = false + # rubocop:disable Migration/PreventStrings + # rubocop:disable Migration/AddLimitToTextColumns def change add_column :serverless_domain_cluster, :encrypted_key, :text add_column :serverless_domain_cluster, :encrypted_key_iv, :string, limit: 255 add_column :serverless_domain_cluster, :certificate, :text end + # rubocop:enable Migration/AddLimitToTextColumns + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20200202100932_add_service_desk_project_key.rb b/db/migrate/20200202100932_add_service_desk_project_key.rb index d42ed4159e4..5095e628b42 100644 --- a/db/migrate/20200202100932_add_service_desk_project_key.rb +++ b/db/migrate/20200202100932_add_service_desk_project_key.rb @@ -3,7 +3,9 @@ class AddServiceDeskProjectKey < ActiveRecord::Migration[5.2] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change add_column :service_desk_settings, :project_key, :string, limit: 255 end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20200204131831_create_daily_report_results.rb b/db/migrate/20200204131831_create_daily_report_results.rb index e18d4efb7fa..6992b6317e1 100644 --- a/db/migrate/20200204131831_create_daily_report_results.rb +++ b/db/migrate/20200204131831_create_daily_report_results.rb @@ -3,6 +3,7 @@ class CreateDailyReportResults < ActiveRecord::Migration[6.0] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change create_table :ci_daily_report_results do |t| t.date :date, null: false @@ -10,8 +11,8 @@ class CreateDailyReportResults < ActiveRecord::Migration[6.0] t.bigint :last_pipeline_id, null: false t.float :value, null: false t.integer :param_type, limit: 8, null: false - t.string :ref_path, null: false # rubocop:disable Migration/AddLimitToStringColumns - t.string :title, null: false # rubocop:disable Migration/AddLimitToStringColumns + t.string :ref_path, null: false + t.string :title, null: false t.index :last_pipeline_id t.index [:project_id, :ref_path, :param_type, :date, :title], name: 'index_daily_report_results_unique_columns', unique: true @@ -19,4 +20,5 @@ class CreateDailyReportResults < ActiveRecord::Migration[6.0] t.foreign_key :ci_pipelines, column: :last_pipeline_id, on_delete: :cascade end end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20200206112850_create_snippet_repository_table.rb b/db/migrate/20200206112850_create_snippet_repository_table.rb index 0c14b37855d..b9120264bb7 100644 --- a/db/migrate/20200206112850_create_snippet_repository_table.rb +++ b/db/migrate/20200206112850_create_snippet_repository_table.rb @@ -3,6 +3,7 @@ class CreateSnippetRepositoryTable < ActiveRecord::Migration[6.0] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change create_table :snippet_repositories, id: false, primary_key: :snippet_id do |t| t.references :shard, null: false, index: true, foreign_key: { on_delete: :restrict } @@ -10,4 +11,5 @@ class CreateSnippetRepositoryTable < ActiveRecord::Migration[6.0] t.string :disk_path, limit: 80, null: false, index: { unique: true } end end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20200207151640_create_deployment_clusters.rb b/db/migrate/20200207151640_create_deployment_clusters.rb index 233e91d31b0..dd05d1730d9 100644 --- a/db/migrate/20200207151640_create_deployment_clusters.rb +++ b/db/migrate/20200207151640_create_deployment_clusters.rb @@ -3,6 +3,7 @@ class CreateDeploymentClusters < ActiveRecord::Migration[6.0] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change create_table :deployment_clusters, id: false, force: :cascade do |t| t.references :deployment, foreign_key: { on_delete: :cascade }, primary_key: true, type: :integer, index: false, default: nil @@ -13,4 +14,5 @@ class CreateDeploymentClusters < ActiveRecord::Migration[6.0] t.index [:cluster_id, :deployment_id], unique: true end end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20200210184410_create_operations_strategies_table.rb b/db/migrate/20200210184410_create_operations_strategies_table.rb index 1046bd11bc7..4d65267c1a7 100644 --- a/db/migrate/20200210184410_create_operations_strategies_table.rb +++ b/db/migrate/20200210184410_create_operations_strategies_table.rb @@ -3,6 +3,7 @@ class CreateOperationsStrategiesTable < ActiveRecord::Migration[6.0] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change create_table :operations_strategies do |t| t.references :feature_flag, index: true, null: false, foreign_key: { to_table: :operations_feature_flags, on_delete: :cascade } @@ -10,4 +11,5 @@ class CreateOperationsStrategiesTable < ActiveRecord::Migration[6.0] t.jsonb :parameters, null: false, default: {} end end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20200210184420_create_operations_scopes_table.rb b/db/migrate/20200210184420_create_operations_scopes_table.rb index 0b33882fe3d..7ce21feb865 100644 --- a/db/migrate/20200210184420_create_operations_scopes_table.rb +++ b/db/migrate/20200210184420_create_operations_scopes_table.rb @@ -3,6 +3,7 @@ class CreateOperationsScopesTable < ActiveRecord::Migration[6.0] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change create_table :operations_scopes do |t| t.references :strategy, null: false, index: false, foreign_key: { to_table: :operations_strategies, on_delete: :cascade } @@ -11,4 +12,5 @@ class CreateOperationsScopesTable < ActiveRecord::Migration[6.0] add_index :operations_scopes, [:strategy_id, :environment_scope], unique: true end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20200213093702_add_email_restrictions_to_application_settings.rb b/db/migrate/20200213093702_add_email_restrictions_to_application_settings.rb index 22d7b9f37e0..2b8afacb6b3 100644 --- a/db/migrate/20200213093702_add_email_restrictions_to_application_settings.rb +++ b/db/migrate/20200213093702_add_email_restrictions_to_application_settings.rb @@ -3,10 +3,12 @@ class AddEmailRestrictionsToApplicationSettings < ActiveRecord::Migration[6.0] DOWNTIME = false + # rubocop:disable Migration/AddLimitToTextColumns def up add_column(:application_settings, :email_restrictions_enabled, :boolean, default: false, null: false) add_column(:application_settings, :email_restrictions, :text, null: true) end + # rubocop:enable Migration/AddLimitToTextColumns def down remove_column(:application_settings, :email_restrictions_enabled) diff --git a/db/migrate/20200213100530_add_verification_columns_to_packages.rb b/db/migrate/20200213100530_add_verification_columns_to_packages.rb index 4c4e9a88c60..b715f35fcab 100644 --- a/db/migrate/20200213100530_add_verification_columns_to_packages.rb +++ b/db/migrate/20200213100530_add_verification_columns_to_packages.rb @@ -3,6 +3,7 @@ class AddVerificationColumnsToPackages < ActiveRecord::Migration[6.0] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change add_column :packages_package_files, :verification_retry_at, :datetime_with_timezone add_column :packages_package_files, :verified_at, :datetime_with_timezone @@ -10,4 +11,5 @@ class AddVerificationColumnsToPackages < ActiveRecord::Migration[6.0] add_column :packages_package_files, :verification_failure, :string, limit: 255 add_column :packages_package_files, :verification_retry_count, :integer end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20200213155311_add_npm_package_requests_forwarding_to_application_settings.rb b/db/migrate/20200213155311_add_npm_package_requests_forwarding_to_application_settings.rb index db67437232c..3815117a7e8 100644 --- a/db/migrate/20200213155311_add_npm_package_requests_forwarding_to_application_settings.rb +++ b/db/migrate/20200213155311_add_npm_package_requests_forwarding_to_application_settings.rb @@ -8,7 +8,7 @@ class AddNpmPackageRequestsForwardingToApplicationSettings < ActiveRecord::Migra disable_ddl_transaction! def up - add_column_with_default(:application_settings, :npm_package_requests_forwarding, + add_column_with_default(:application_settings, :npm_package_requests_forwarding, # rubocop:disable Migration/AddColumnWithDefault :boolean, default: false, allow_null: false) diff --git a/db/migrate/20200213224220_add_sprints.rb b/db/migrate/20200213224220_add_sprints.rb new file mode 100644 index 00000000000..8d82d1e261a --- /dev/null +++ b/db/migrate/20200213224220_add_sprints.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +class AddSprints < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + create_table :sprints, id: :bigserial do |t| + t.timestamps_with_timezone null: false + t.date :start_date + t.date :due_date + + t.references :project, foreign_key: false, index: false + t.references :group, foreign_key: false, index: true + + t.integer :iid, null: false + t.integer :cached_markdown_version + t.integer :state, limit: 2 + # rubocop:disable Migration/AddLimitToTextColumns + t.text :title, null: false + t.text :title_html + t.text :description + t.text :description_html + # rubocop:enable Migration/AddLimitToTextColumns + + t.index :description, name: "index_sprints_on_description_trigram", opclass: :gin_trgm_ops, using: :gin + t.index :due_date + t.index %w(project_id iid), unique: true + t.index :title + t.index :title, name: "index_sprints_on_title_trigram", opclass: :gin_trgm_ops, using: :gin + + t.index %w(project_id title), unique: true, where: 'project_id IS NOT NULL' + t.index %w(group_id title), unique: true, where: 'group_id IS NOT NULL' + end + end +end diff --git a/db/migrate/20200214025454_add_canonical_emails.rb b/db/migrate/20200214025454_add_canonical_emails.rb index 80cf535abfa..0732d39169d 100644 --- a/db/migrate/20200214025454_add_canonical_emails.rb +++ b/db/migrate/20200214025454_add_canonical_emails.rb @@ -10,7 +10,7 @@ class AddCanonicalEmails < ActiveRecord::Migration[6.0] create_table :user_canonical_emails do |t| t.timestamps_with_timezone t.references :user, index: false, null: false, foreign_key: { on_delete: :cascade } - t.string :canonical_email, null: false, index: true # rubocop:disable Migration/AddLimitToStringColumns + t.string :canonical_email, null: false, index: true # rubocop:disable Migration/PreventStrings end end diff --git a/db/migrate/20200215222507_drop_forked_project_links_fk.rb b/db/migrate/20200215222507_drop_forked_project_links_fk.rb index 0be7a57ed0e..7fe38a6ccdb 100644 --- a/db/migrate/20200215222507_drop_forked_project_links_fk.rb +++ b/db/migrate/20200215222507_drop_forked_project_links_fk.rb @@ -8,21 +8,16 @@ class DropForkedProjectLinksFk < ActiveRecord::Migration[6.0] disable_ddl_transaction! def up - # rubocop: disable Migration/WithLockRetriesWithoutDdlTransaction with_lock_retries do remove_foreign_key_if_exists :forked_project_links, column: :forked_to_project_id end - # rubocop: enable Migration/WithLockRetriesWithoutDdlTransaction end def down unless foreign_key_exists?(:forked_project_links, :projects, column: :forked_to_project_id) - # rubocop: disable Migration/WithLockRetriesWithoutDdlTransaction with_lock_retries do - # rubocop: disable Migration/AddConcurrentForeignKey add_foreign_key :forked_project_links, :projects, column: :forked_to_project_id, on_delete: :cascade, validate: false end - # rubocop: enable Migration/WithLockRetriesWithoutDdlTransaction end fk_name = concurrent_foreign_key_name(:forked_project_links, :forked_to_project_id, prefix: 'fk_rails_') diff --git a/db/migrate/20200218113721_add_indexes_to_package_file.rb b/db/migrate/20200218113721_add_indexes_to_package_file.rb new file mode 100644 index 00000000000..7c66da6819e --- /dev/null +++ b/db/migrate/20200218113721_add_indexes_to_package_file.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddIndexesToPackageFile < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_index :packages_package_files, :verification_failure, where: "(verification_failure IS NOT NULL)", name: "packages_packages_verification_failure_partial" + add_concurrent_index :packages_package_files, :verification_checksum, where: "(verification_checksum IS NOT NULL)", name: "packages_packages_verification_checksum_partial" + end + + def down + remove_concurrent_index :packages_package_files, :verification_failure + remove_concurrent_index :packages_package_files, :verification_checksum + end +end diff --git a/db/migrate/20200219105209_add_filepath_to_release_links.rb b/db/migrate/20200219105209_add_filepath_to_release_links.rb index bcc204c22e8..ba69332fb70 100644 --- a/db/migrate/20200219105209_add_filepath_to_release_links.rb +++ b/db/migrate/20200219105209_add_filepath_to_release_links.rb @@ -3,6 +3,6 @@ class AddFilepathToReleaseLinks < ActiveRecord::Migration[6.0] DOWNTIME = false def change - add_column :release_links, :filepath, :string, limit: 128 + add_column :release_links, :filepath, :string, limit: 128 # rubocop:disable Migration/PreventStrings end end diff --git a/db/migrate/20200219135440_add_limit_metric_type_to_list.rb b/db/migrate/20200219135440_add_limit_metric_type_to_list.rb index 35e36b4805b..a2b2fb25ac9 100644 --- a/db/migrate/20200219135440_add_limit_metric_type_to_list.rb +++ b/db/migrate/20200219135440_add_limit_metric_type_to_list.rb @@ -4,6 +4,6 @@ class AddLimitMetricTypeToList < ActiveRecord::Migration[6.0] DOWNTIME = false def change - add_column :lists, :limit_metric, :string, limit: 20 + add_column :lists, :limit_metric, :string, limit: 20 # rubocop:disable Migration/PreventStrings end end diff --git a/db/migrate/20200224020219_add_status_page_settings.rb b/db/migrate/20200224020219_add_status_page_settings.rb index b960b60881e..b45dfc8ec46 100644 --- a/db/migrate/20200224020219_add_status_page_settings.rb +++ b/db/migrate/20200224020219_add_status_page_settings.rb @@ -3,6 +3,7 @@ class AddStatusPageSettings < ActiveRecord::Migration[6.0] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change create_table :status_page_settings, id: false do |t| t.references :project, index: true, primary_key: true, foreign_key: { on_delete: :cascade }, unique: true, null: false @@ -15,4 +16,5 @@ class AddStatusPageSettings < ActiveRecord::Migration[6.0] t.string :encrypted_aws_secret_key_iv, limit: 255, null: false end end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20200224163804_add_version_to_feature_flags_table.rb b/db/migrate/20200224163804_add_version_to_feature_flags_table.rb index bf3179f070c..d300f7c83e1 100644 --- a/db/migrate/20200224163804_add_version_to_feature_flags_table.rb +++ b/db/migrate/20200224163804_add_version_to_feature_flags_table.rb @@ -12,7 +12,9 @@ class AddVersionToFeatureFlagsTable < ActiveRecord::Migration[6.0] def up # The operations_feature_flags table is small enough that we can disable this cop. # See https://gitlab.com/gitlab-org/gitlab/-/merge_requests/25552#note_291202882 + # rubocop:disable Migration/AddColumnWithDefault add_column_with_default(:operations_feature_flags, :version, :smallint, default: FEATURE_FLAG_LEGACY_VERSION, allow_null: false) + # rubocop:enable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20200226100614_create_requirements.rb b/db/migrate/20200226100614_create_requirements.rb index 4ebbf38b8d1..f374e1e9581 100644 --- a/db/migrate/20200226100614_create_requirements.rb +++ b/db/migrate/20200226100614_create_requirements.rb @@ -5,6 +5,7 @@ class CreateRequirements < ActiveRecord::Migration[6.0] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change create_table :requirements do |t| t.timestamps_with_timezone null: false @@ -14,7 +15,7 @@ class CreateRequirements < ActiveRecord::Migration[6.0] t.integer :cached_markdown_version t.integer :state, limit: 2, default: 1, null: false t.string :title, limit: 255, null: false - t.text :title_html + t.text :title_html # rubocop:disable Migration/AddLimitToTextColumns t.index :project_id t.index :author_id @@ -25,4 +26,5 @@ class CreateRequirements < ActiveRecord::Migration[6.0] t.index %w(project_id iid), name: 'index_requirements_on_project_id_and_iid', where: 'project_id IS NOT NULL', unique: true, using: :btree end end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20200227164113_create_scim_identities.rb b/db/migrate/20200227164113_create_scim_identities.rb index 1942270761b..34e119ccfe3 100644 --- a/db/migrate/20200227164113_create_scim_identities.rb +++ b/db/migrate/20200227164113_create_scim_identities.rb @@ -3,6 +3,7 @@ class CreateScimIdentities < ActiveRecord::Migration[6.0] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change create_table :scim_identities do |t| t.references :group, foreign_key: { to_table: :namespaces, on_delete: :cascade }, null: false @@ -15,4 +16,5 @@ class CreateScimIdentities < ActiveRecord::Migration[6.0] t.index [:user_id, :group_id], unique: true end end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20200227165129_create_user_details.rb b/db/migrate/20200227165129_create_user_details.rb index fe9f23fcb21..89258eadb9f 100644 --- a/db/migrate/20200227165129_create_user_details.rb +++ b/db/migrate/20200227165129_create_user_details.rb @@ -5,6 +5,7 @@ class CreateUserDetails < ActiveRecord::Migration[6.0] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def up with_lock_retries do create_table :user_details, id: false do |t| @@ -15,6 +16,7 @@ class CreateUserDetails < ActiveRecord::Migration[6.0] add_index :user_details, :user_id, unique: true end + # rubocop:enable Migration/PreventStrings def down with_lock_retries do diff --git a/db/migrate/20200302152516_add_wiki_slug.rb b/db/migrate/20200302152516_add_wiki_slug.rb index dabac39aeb8..a7891427c10 100644 --- a/db/migrate/20200302152516_add_wiki_slug.rb +++ b/db/migrate/20200302152516_add_wiki_slug.rb @@ -3,6 +3,7 @@ class AddWikiSlug < ActiveRecord::Migration[6.0] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change create_table :wiki_page_meta, id: :serial do |t| t.references :project, index: true, foreign_key: { on_delete: :cascade }, null: false @@ -19,4 +20,5 @@ class AddWikiSlug < ActiveRecord::Migration[6.0] t.index [:wiki_page_meta_id], name: 'one_canonical_wiki_page_slug_per_metadata', unique: true, where: "(canonical = true)" end end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20200304023245_add_sprint_to_issues.rb b/db/migrate/20200304023245_add_sprint_to_issues.rb new file mode 100644 index 00000000000..c8bc5258ffd --- /dev/null +++ b/db/migrate/20200304023245_add_sprint_to_issues.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class AddSprintToIssues < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + # index will be added in another migration with `add_concurrent_index` + add_column :issues, :sprint_id, :bigint + end + end + + def down + with_lock_retries do + remove_column :issues, :sprint_id + end + end +end diff --git a/db/migrate/20200304023851_add_sprint_to_merge_requests.rb b/db/migrate/20200304023851_add_sprint_to_merge_requests.rb new file mode 100644 index 00000000000..e294abe66cd --- /dev/null +++ b/db/migrate/20200304023851_add_sprint_to_merge_requests.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class AddSprintToMergeRequests < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + # index will be added in another migration with `add_concurrent_index` + add_column :merge_requests, :sprint_id, :bigint + end + end + + def down + with_lock_retries do + remove_column :merge_requests, :sprint_id + end + end +end diff --git a/db/migrate/20200304024025_add_sprint_id_index_to_issues.rb b/db/migrate/20200304024025_add_sprint_id_index_to_issues.rb new file mode 100644 index 00000000000..aaece3445db --- /dev/null +++ b/db/migrate/20200304024025_add_sprint_id_index_to_issues.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class AddSprintIdIndexToIssues < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_index :issues, :sprint_id + add_concurrent_foreign_key :issues, :sprints, column: :sprint_id + end + + def down + with_lock_retries do + remove_foreign_key :issues, column: :sprint_id + end + remove_concurrent_index :issues, :sprint_id + end +end diff --git a/db/migrate/20200304024042_add_sprint_id_index_to_merge_requests.rb b/db/migrate/20200304024042_add_sprint_id_index_to_merge_requests.rb new file mode 100644 index 00000000000..219d10ff47c --- /dev/null +++ b/db/migrate/20200304024042_add_sprint_id_index_to_merge_requests.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class AddSprintIdIndexToMergeRequests < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_index :merge_requests, :sprint_id + add_concurrent_foreign_key :merge_requests, :sprints, column: :sprint_id + end + + def down + with_lock_retries do + remove_foreign_key :merge_requests, column: :sprint_id + end + remove_concurrent_index :merge_requests, :sprint_id + end +end diff --git a/db/migrate/20200305200641_create_terraform_states.rb b/db/migrate/20200305200641_create_terraform_states.rb index 3e137369e33..8429d5cfeb3 100644 --- a/db/migrate/20200305200641_create_terraform_states.rb +++ b/db/migrate/20200305200641_create_terraform_states.rb @@ -3,6 +3,7 @@ class CreateTerraformStates < ActiveRecord::Migration[6.0] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change create_table :terraform_states do |t| t.references :project, index: true, foreign_key: { on_delete: :cascade }, null: false @@ -11,4 +12,5 @@ class CreateTerraformStates < ActiveRecord::Migration[6.0] t.string :file, limit: 255 end end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20200309162244_add_open_project_tracker_data.rb b/db/migrate/20200309162244_add_open_project_tracker_data.rb index 672dde4d518..5906eb7ebff 100644 --- a/db/migrate/20200309162244_add_open_project_tracker_data.rb +++ b/db/migrate/20200309162244_add_open_project_tracker_data.rb @@ -6,6 +6,7 @@ class AddOpenProjectTrackerData < ActiveRecord::Migration[6.0] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change create_table :open_project_tracker_data do |t| t.references :service, foreign_key: { on_delete: :cascade }, type: :integer, index: true, null: false @@ -20,4 +21,5 @@ class AddOpenProjectTrackerData < ActiveRecord::Migration[6.0] t.string :project_identifier_code, limit: 100 end end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20200310145304_add_runtime_created_to_ci_job_variables.rb b/db/migrate/20200310145304_add_runtime_created_to_ci_job_variables.rb index d5ec8854bfa..e76136a5c1f 100644 --- a/db/migrate/20200310145304_add_runtime_created_to_ci_job_variables.rb +++ b/db/migrate/20200310145304_add_runtime_created_to_ci_job_variables.rb @@ -10,7 +10,7 @@ class AddRuntimeCreatedToCiJobVariables < ActiveRecord::Migration[6.0] DEFAULT_SOURCE = 0 # Equvalent to Ci::JobVariable.internal_source def up - add_column_with_default(:ci_job_variables, :source, :integer, limit: 2, default: DEFAULT_SOURCE, allow_null: false) + add_column_with_default(:ci_job_variables, :source, :integer, limit: 2, default: DEFAULT_SOURCE, allow_null: false) # rubocop:disable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20200311141053_add_ci_pipeline_schedules_to_plan_limits.rb b/db/migrate/20200311141053_add_ci_pipeline_schedules_to_plan_limits.rb index 2fc7785fe9c..e7fe3e63349 100644 --- a/db/migrate/20200311141053_add_ci_pipeline_schedules_to_plan_limits.rb +++ b/db/migrate/20200311141053_add_ci_pipeline_schedules_to_plan_limits.rb @@ -8,7 +8,7 @@ class AddCiPipelineSchedulesToPlanLimits < ActiveRecord::Migration[6.0] DOWNTIME = false def up - add_column_with_default(:plan_limits, :ci_pipeline_schedules, :integer, default: 0, allow_null: false) + add_column_with_default(:plan_limits, :ci_pipeline_schedules, :integer, default: 0, allow_null: false) # rubocop:disable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20200311154110_create_vulnerability_exports.rb b/db/migrate/20200311154110_create_vulnerability_exports.rb index f3162f8808c..5a3355ab5be 100644 --- a/db/migrate/20200311154110_create_vulnerability_exports.rb +++ b/db/migrate/20200311154110_create_vulnerability_exports.rb @@ -5,6 +5,7 @@ class CreateVulnerabilityExports < ActiveRecord::Migration[6.0] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change create_table :vulnerability_exports do |t| t.timestamps_with_timezone null: false @@ -21,4 +22,5 @@ class CreateVulnerabilityExports < ActiveRecord::Migration[6.0] t.index %i[author_id] end end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20200311165635_create_project_export_jobs.rb b/db/migrate/20200311165635_create_project_export_jobs.rb index 026ad2cd771..21ff5f488f7 100644 --- a/db/migrate/20200311165635_create_project_export_jobs.rb +++ b/db/migrate/20200311165635_create_project_export_jobs.rb @@ -3,6 +3,7 @@ class CreateProjectExportJobs < ActiveRecord::Migration[6.0] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change create_table :project_export_jobs do |t| t.references :project, index: false, null: false, foreign_key: { on_delete: :cascade } @@ -16,4 +17,5 @@ class CreateProjectExportJobs < ActiveRecord::Migration[6.0] t.index [:project_id, :status] end end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20200311214912_add_modsecurity_mode_to_ingress_application.rb b/db/migrate/20200311214912_add_modsecurity_mode_to_ingress_application.rb index 6ca17dc9b55..7f3366a4900 100644 --- a/db/migrate/20200311214912_add_modsecurity_mode_to_ingress_application.rb +++ b/db/migrate/20200311214912_add_modsecurity_mode_to_ingress_application.rb @@ -10,7 +10,7 @@ class AddModsecurityModeToIngressApplication < ActiveRecord::Migration[6.0] disable_ddl_transaction! def up - add_column_with_default(:clusters_applications_ingress, :modsecurity_mode, :smallint, default: 0, allow_null: false) + add_column_with_default(:clusters_applications_ingress, :modsecurity_mode, :smallint, default: 0, allow_null: false) # rubocop:disable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20200318162148_add_external_key_to_issues_table.rb b/db/migrate/20200318162148_add_external_key_to_issues_table.rb index eeac6ae3155..b98937861be 100644 --- a/db/migrate/20200318162148_add_external_key_to_issues_table.rb +++ b/db/migrate/20200318162148_add_external_key_to_issues_table.rb @@ -7,7 +7,7 @@ class AddExternalKeyToIssuesTable < ActiveRecord::Migration[6.0] def up with_lock_retries do - add_column :issues, :external_key, :string, limit: 255 + add_column :issues, :external_key, :string, limit: 255 # rubocop:disable Migration/PreventStrings end end diff --git a/db/migrate/20200318164448_add_external_key_to_epics_table.rb b/db/migrate/20200318164448_add_external_key_to_epics_table.rb index c21fb1698bc..dee2ca98f36 100644 --- a/db/migrate/20200318164448_add_external_key_to_epics_table.rb +++ b/db/migrate/20200318164448_add_external_key_to_epics_table.rb @@ -7,7 +7,7 @@ class AddExternalKeyToEpicsTable < ActiveRecord::Migration[6.0] def up with_lock_retries do - add_column :epics, :external_key, :string, limit: 255 + add_column :epics, :external_key, :string, limit: 255 # rubocop:disable Migration/PreventStrings end end diff --git a/db/migrate/20200318183553_create_pypi_package_metadata.rb b/db/migrate/20200318183553_create_pypi_package_metadata.rb index 3f0204d51ac..6ebe70da643 100644 --- a/db/migrate/20200318183553_create_pypi_package_metadata.rb +++ b/db/migrate/20200318183553_create_pypi_package_metadata.rb @@ -8,7 +8,7 @@ class CreatePypiPackageMetadata < ActiveRecord::Migration[6.0] def change create_table :packages_pypi_metadata, id: false do |t| t.references :package, primary_key: true, index: false, default: nil, foreign_key: { to_table: :packages_packages, on_delete: :cascade }, type: :bigint - t.string "required_python", null: false, limit: 50 + t.string "required_python", null: false, limit: 50 # rubocop:disable Migration/PreventStrings end end end diff --git a/db/migrate/20200319124127_create_metrics_dashboard_annotations.rb b/db/migrate/20200319124127_create_metrics_dashboard_annotations.rb index 4c57e38518a..9e10299b4f8 100644 --- a/db/migrate/20200319124127_create_metrics_dashboard_annotations.rb +++ b/db/migrate/20200319124127_create_metrics_dashboard_annotations.rb @@ -7,6 +7,7 @@ class CreateMetricsDashboardAnnotations < ActiveRecord::Migration[6.0] # Set this constant to true if this migration requires downtime. DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change create_table :metrics_dashboard_annotations do |t| t.datetime_with_timezone :starting_at, null: false @@ -15,10 +16,11 @@ class CreateMetricsDashboardAnnotations < ActiveRecord::Migration[6.0] t.references :cluster, index: false, foreign_key: { on_delete: :cascade }, null: true t.string :dashboard_path, null: false, limit: 255 t.string :panel_xid, limit: 255 - t.text :description, null: false, limit: 255 + t.text :description, null: false, limit: 255 # rubocop:disable Migration/AddLimitToTextColumns t.index %i(environment_id dashboard_path starting_at ending_at), where: 'environment_id IS NOT NULL', name: "index_metrics_dashboard_annotations_on_environment_id_and_3_col" t.index %i(cluster_id dashboard_path starting_at ending_at), where: 'cluster_id IS NOT NULL', name: "index_metrics_dashboard_annotations_on_cluster_id_and_3_columns" end end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20200320112455_add_cost_factor_fileds_to_ci_runners.rb b/db/migrate/20200320112455_add_cost_factor_fileds_to_ci_runners.rb index 472baa32340..ca92b395b6f 100644 --- a/db/migrate/20200320112455_add_cost_factor_fileds_to_ci_runners.rb +++ b/db/migrate/20200320112455_add_cost_factor_fileds_to_ci_runners.rb @@ -8,8 +8,8 @@ class AddCostFactorFiledsToCiRunners < ActiveRecord::Migration[6.0] disable_ddl_transaction! def up - add_column_with_default(:ci_runners, :public_projects_minutes_cost_factor, :float, allow_null: false, default: 0.0) - add_column_with_default(:ci_runners, :private_projects_minutes_cost_factor, :float, allow_null: false, default: 1.0) + add_column_with_default(:ci_runners, :public_projects_minutes_cost_factor, :float, allow_null: false, default: 0.0) # rubocop:disable Migration/AddColumnWithDefault + add_column_with_default(:ci_runners, :private_projects_minutes_cost_factor, :float, allow_null: false, default: 1.0) # rubocop:disable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20200320123839_add_letsencrypt_errors_to_pages_domains.rb b/db/migrate/20200320123839_add_letsencrypt_errors_to_pages_domains.rb index ad4debf9a1e..6e7c37918e1 100644 --- a/db/migrate/20200320123839_add_letsencrypt_errors_to_pages_domains.rb +++ b/db/migrate/20200320123839_add_letsencrypt_errors_to_pages_domains.rb @@ -11,7 +11,7 @@ class AddLetsencryptErrorsToPagesDomains < ActiveRecord::Migration[6.0] disable_ddl_transaction! def up - add_column_with_default :pages_domains, :auto_ssl_failed, :boolean, default: false + add_column_with_default :pages_domains, :auto_ssl_failed, :boolean, default: false # rubocop:disable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20200320212400_add_project_show_default_award_emojis.rb b/db/migrate/20200320212400_add_project_show_default_award_emojis.rb new file mode 100644 index 00000000000..c8238f75455 --- /dev/null +++ b/db/migrate/20200320212400_add_project_show_default_award_emojis.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class AddProjectShowDefaultAwardEmojis < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def change + add_column :project_settings, :show_default_award_emojis, :boolean, default: true, null: false + end +end diff --git a/db/migrate/20200323071918_add_bio_to_user_details.rb b/db/migrate/20200323071918_add_bio_to_user_details.rb index 90e4b964695..9ef9d553215 100644 --- a/db/migrate/20200323071918_add_bio_to_user_details.rb +++ b/db/migrate/20200323071918_add_bio_to_user_details.rb @@ -7,9 +7,13 @@ class AddBioToUserDetails < ActiveRecord::Migration[6.0] disable_ddl_transaction! + # rubocop:disable Migration/PreventStrings def up - add_column_with_default(:user_details, :bio, :string, default: '', allow_null: false, limit: 255, update_column_in_batches_args: { batch_column_name: :user_id }) + # rubocop:disable Migration/AddColumnWithDefault + add_column_with_default(:user_details, :bio, :string, default: '', allow_null: false, limit: 255) + # rubocop:enable Migration/AddColumnWithDefault end + # rubocop:enable Migration/PreventStrings def down remove_column(:user_details, :bio) diff --git a/db/migrate/20200324115359_add_namespace_storage_size_limit_to_application_settings.rb b/db/migrate/20200324115359_add_namespace_storage_size_limit_to_application_settings.rb index e5fe98a4d19..793dc4678c6 100644 --- a/db/migrate/20200324115359_add_namespace_storage_size_limit_to_application_settings.rb +++ b/db/migrate/20200324115359_add_namespace_storage_size_limit_to_application_settings.rb @@ -7,7 +7,7 @@ class AddNamespaceStorageSizeLimitToApplicationSettings < ActiveRecord::Migratio disable_ddl_transaction! def up - add_column_with_default :application_settings, :namespace_storage_size_limit, :bigint, default: 0 + add_column_with_default :application_settings, :namespace_storage_size_limit, :bigint, default: 0 # rubocop:disable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20200325152327_add_seat_link_enabled_to_application_settings.rb b/db/migrate/20200325152327_add_seat_link_enabled_to_application_settings.rb index 52f579c175c..fbea3ad1227 100644 --- a/db/migrate/20200325152327_add_seat_link_enabled_to_application_settings.rb +++ b/db/migrate/20200325152327_add_seat_link_enabled_to_application_settings.rb @@ -8,7 +8,7 @@ class AddSeatLinkEnabledToApplicationSettings < ActiveRecord::Migration[6.0] disable_ddl_transaction! def up - add_column_with_default(:application_settings, :seat_link_enabled, + add_column_with_default(:application_settings, :seat_link_enabled, # rubocop:disable Migration/AddColumnWithDefault :boolean, default: true, allow_null: false) diff --git a/db/migrate/20200326114443_create_jira_imports_table.rb b/db/migrate/20200326114443_create_jira_imports_table.rb index e114bd513f4..d53ccb166b0 100644 --- a/db/migrate/20200326114443_create_jira_imports_table.rb +++ b/db/migrate/20200326114443_create_jira_imports_table.rb @@ -7,6 +7,7 @@ class CreateJiraImportsTable < ActiveRecord::Migration[6.0] disable_ddl_transaction! + # rubocop:disable Migration/PreventStrings def change create_table :jira_imports do |t| t.integer :project_id, null: false, limit: 8 @@ -26,4 +27,5 @@ class CreateJiraImportsTable < ActiveRecord::Migration[6.0] add_index :jira_imports, [:project_id, :jira_project_key], name: 'index_jira_imports_on_project_id_and_jira_project_key' end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20200326122700_create_diff_note_positions.rb b/db/migrate/20200326122700_create_diff_note_positions.rb index 87159e666b5..d37f7fef078 100644 --- a/db/migrate/20200326122700_create_diff_note_positions.rb +++ b/db/migrate/20200326122700_create_diff_note_positions.rb @@ -5,6 +5,8 @@ class CreateDiffNotePositions < ActiveRecord::Migration[6.0] DOWNTIME = false + # rubocop:disable Migration/AddLimitToTextColumns + # rubocop:disable Migration/PreventStrings def up with_lock_retries do create_table :diff_note_positions do |t| @@ -24,6 +26,8 @@ class CreateDiffNotePositions < ActiveRecord::Migration[6.0] end end end + # rubocop:enable Migration/PreventStrings + # rubocop:enable Migration/AddLimitToTextColumns def down drop_table :diff_note_positions diff --git a/db/migrate/20200330121000_add_confidential_attribute_to_epics.rb b/db/migrate/20200330121000_add_confidential_attribute_to_epics.rb index 01728436b93..4db227728c8 100644 --- a/db/migrate/20200330121000_add_confidential_attribute_to_epics.rb +++ b/db/migrate/20200330121000_add_confidential_attribute_to_epics.rb @@ -8,7 +8,7 @@ class AddConfidentialAttributeToEpics < ActiveRecord::Migration[6.0] disable_ddl_transaction! def up - add_column_with_default(:epics, :confidential, :boolean, default: false) + add_column_with_default(:epics, :confidential, :boolean, default: false) # rubocop:disable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20200331195952_add_container_expiration_policies_enable_historic_entries_to_application_settings.rb b/db/migrate/20200331195952_add_container_expiration_policies_enable_historic_entries_to_application_settings.rb index 95ce75efccc..b4cbb04b93a 100644 --- a/db/migrate/20200331195952_add_container_expiration_policies_enable_historic_entries_to_application_settings.rb +++ b/db/migrate/20200331195952_add_container_expiration_policies_enable_historic_entries_to_application_settings.rb @@ -8,7 +8,7 @@ class AddContainerExpirationPoliciesEnableHistoricEntriesToApplicationSettings < disable_ddl_transaction! def up - add_column_with_default(:application_settings, + add_column_with_default(:application_settings, # rubocop:disable Migration/AddColumnWithDefault :container_expiration_policies_enable_historic_entries, :boolean, default: false, diff --git a/db/migrate/20200401211005_create_operations_user_lists.rb b/db/migrate/20200401211005_create_operations_user_lists.rb index c5b928b8350..b0b02ca8886 100644 --- a/db/migrate/20200401211005_create_operations_user_lists.rb +++ b/db/migrate/20200401211005_create_operations_user_lists.rb @@ -8,8 +8,8 @@ class CreateOperationsUserLists < ActiveRecord::Migration[6.0] t.references :project, index: false, foreign_key: { on_delete: :cascade }, null: false t.timestamps_with_timezone t.integer :iid, null: false - t.string :name, null: false, limit: 255 - t.text :user_xids, null: false, default: '' + t.string :name, null: false, limit: 255 # rubocop:disable Migration/PreventStrings + t.text :user_xids, null: false, default: '' # rubocop:disable Migration/AddLimitToTextColumns t.index [:project_id, :iid], unique: true t.index [:project_id, :name], unique: true diff --git a/db/migrate/20200402001106_add_cluster_type_index_to_clusters.rb b/db/migrate/20200402001106_add_cluster_type_index_to_clusters.rb new file mode 100644 index 00000000000..b328b8681c1 --- /dev/null +++ b/db/migrate/20200402001106_add_cluster_type_index_to_clusters.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddClusterTypeIndexToClusters < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + # Set this constant to true if this migration requires downtime. + DOWNTIME = false + INDEX_NAME = 'index_clusters_on_enabled_cluster_type_id_and_created_at' + + disable_ddl_transaction! + + def up + add_concurrent_index :clusters, [:enabled, :cluster_type, :id, :created_at], name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :clusters, INDEX_NAME + end +end diff --git a/db/migrate/20200402115013_add_index_on_modsecurity_to_ingress.rb b/db/migrate/20200402115013_add_index_on_modsecurity_to_ingress.rb new file mode 100644 index 00000000000..8bd2d957092 --- /dev/null +++ b/db/migrate/20200402115013_add_index_on_modsecurity_to_ingress.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddIndexOnModsecurityToIngress < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INDEX_NAME = 'index_clusters_applications_ingress_on_modsecurity' + + disable_ddl_transaction! + + def up + add_concurrent_index :clusters_applications_ingress, [:modsecurity_enabled, :modsecurity_mode, :cluster_id], name: INDEX_NAME + end + + def down + remove_concurrent_index :clusters_applications_ingress, [:modsecurity_enabled, :modsecurity_mode, :cluster_id], name: INDEX_NAME + end +end diff --git a/db/migrate/20200402115623_add_index_on_successful_deployment_and_environment_id_to_deployments.rb b/db/migrate/20200402115623_add_index_on_successful_deployment_and_environment_id_to_deployments.rb new file mode 100644 index 00000000000..c86f7ad63f0 --- /dev/null +++ b/db/migrate/20200402115623_add_index_on_successful_deployment_and_environment_id_to_deployments.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddIndexOnSuccessfulDeploymentAndEnvironmentIdToDeployments < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INDEX_NAME = 'index_successful_deployments_on_cluster_id_and_environment_id' + + disable_ddl_transaction! + + def up + add_concurrent_index :deployments, [:cluster_id, :environment_id], where: 'status = 2', name: INDEX_NAME + end + + def down + remove_concurrent_index :deployments, [:cluster_id, :environment_id], where: 'status = 2', name: INDEX_NAME + end +end diff --git a/db/migrate/20200402124802_add_correlation_id_to_project_import_state.rb b/db/migrate/20200402124802_add_correlation_id_to_project_import_state.rb index 974009b101a..97eb01529cc 100644 --- a/db/migrate/20200402124802_add_correlation_id_to_project_import_state.rb +++ b/db/migrate/20200402124802_add_correlation_id_to_project_import_state.rb @@ -5,11 +5,13 @@ class AddCorrelationIdToProjectImportState < ActiveRecord::Migration[6.0] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def up with_lock_retries do add_column :project_mirror_data, :correlation_id_value, :string, limit: 128 end end + # rubocop:enable Migration/PreventStrings def down with_lock_retries do diff --git a/db/migrate/20200402185044_create_clusters_applications_fluentd.rb b/db/migrate/20200402185044_create_clusters_applications_fluentd.rb index 08f3faf80e1..2116b2ffe01 100644 --- a/db/migrate/20200402185044_create_clusters_applications_fluentd.rb +++ b/db/migrate/20200402185044_create_clusters_applications_fluentd.rb @@ -3,6 +3,7 @@ class CreateClustersApplicationsFluentd < ActiveRecord::Migration[6.0] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change create_table :clusters_applications_fluentd do |t| t.integer :protocol, null: false, limit: 2 @@ -12,7 +13,8 @@ class CreateClustersApplicationsFluentd < ActiveRecord::Migration[6.0] t.timestamps_with_timezone null: false t.string :version, null: false, limit: 255 t.string :host, null: false, limit: 255 - t.text :status_reason + t.text :status_reason # rubocop:disable Migration/AddLimitToTextColumns end end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20200406095930_add_needs_ssl_renewal_user_provided_pages_domains_index.rb b/db/migrate/20200406095930_add_needs_ssl_renewal_user_provided_pages_domains_index.rb new file mode 100644 index 00000000000..73db5e71b94 --- /dev/null +++ b/db/migrate/20200406095930_add_needs_ssl_renewal_user_provided_pages_domains_index.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class AddNeedsSslRenewalUserProvidedPagesDomainsIndex < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + INDEX_NAME = 'index_pages_domains_need_auto_ssl_renewal_user_provided' + INDEX_SCOPE = "auto_ssl_enabled = true AND auto_ssl_failed = false AND certificate_source = 0" + + disable_ddl_transaction! + + def up + add_concurrent_index(:pages_domains, :id, where: INDEX_SCOPE, name: INDEX_NAME) + end + + def down + remove_concurrent_index(:pages_domains, :id, where: INDEX_SCOPE, name: INDEX_NAME) + end +end diff --git a/db/migrate/20200406100909_add_needs_ssl_renewal_valid_not_after_pages_domains_index.rb b/db/migrate/20200406100909_add_needs_ssl_renewal_valid_not_after_pages_domains_index.rb new file mode 100644 index 00000000000..3c5db9ec082 --- /dev/null +++ b/db/migrate/20200406100909_add_needs_ssl_renewal_valid_not_after_pages_domains_index.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class AddNeedsSslRenewalValidNotAfterPagesDomainsIndex < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + INDEX_NAME = 'index_pages_domains_need_auto_ssl_renewal_valid_not_after' + INDEX_SCOPE = "auto_ssl_enabled = true AND auto_ssl_failed = false" + + disable_ddl_transaction! + + def up + add_concurrent_index(:pages_domains, :certificate_valid_not_after, where: INDEX_SCOPE, name: INDEX_NAME) + end + + def down + remove_concurrent_index(:pages_domains, :certificate_valid_not_after, where: INDEX_SCOPE, name: INDEX_NAME) + end +end diff --git a/db/migrate/20200406132529_add_resource_state_events_table.rb b/db/migrate/20200406132529_add_resource_state_events_table.rb new file mode 100644 index 00000000000..ce241dff4dd --- /dev/null +++ b/db/migrate/20200406132529_add_resource_state_events_table.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class AddResourceStateEventsTable < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + create_table :resource_state_events, id: :bigserial do |t| + t.bigint :user_id, null: false + t.bigint :issue_id, null: true + t.bigint :merge_request_id, null: true + + t.datetime_with_timezone :created_at, null: false + t.integer :state, limit: 2, null: false + + t.index [:issue_id, :created_at], name: 'index_resource_state_events_on_issue_id_and_created_at' + t.index [:user_id], name: 'index_resource_state_events_on_user_id' + t.index [:merge_request_id], name: 'index_resource_state_events_on_merge_request_id' + end + end +end diff --git a/db/migrate/20200406141452_add_index_to_issue_id_and_created_at_on_resource_weight_events.rb b/db/migrate/20200406141452_add_index_to_issue_id_and_created_at_on_resource_weight_events.rb new file mode 100644 index 00000000000..94a1b589ff9 --- /dev/null +++ b/db/migrate/20200406141452_add_index_to_issue_id_and_created_at_on_resource_weight_events.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddIndexToIssueIdAndCreatedAtOnResourceWeightEvents < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + INDEX_NAME = 'index_resource_weight_events_on_issue_id_and_created_at' + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_index :resource_weight_events, [:issue_id, :created_at], name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :resource_weight_events, INDEX_NAME + end +end diff --git a/db/migrate/20200406192059_add_write_registry_to_deploy_tokens.rb b/db/migrate/20200406192059_add_write_registry_to_deploy_tokens.rb index 22fdb030edc..9d1628bc42a 100644 --- a/db/migrate/20200406192059_add_write_registry_to_deploy_tokens.rb +++ b/db/migrate/20200406192059_add_write_registry_to_deploy_tokens.rb @@ -8,7 +8,7 @@ class AddWriteRegistryToDeployTokens < ActiveRecord::Migration[6.0] disable_ddl_transaction! def up - add_column_with_default(:deploy_tokens, :write_registry, :boolean, default: false, allow_null: false) + add_column_with_default(:deploy_tokens, :write_registry, :boolean, default: false, allow_null: false) # rubocop:disable Migration/AddColumnWithDefault end def down diff --git a/db/migrate/20200407171133_add_protected_tag_create_access_levels_user_id_foreign_key.rb b/db/migrate/20200407171133_add_protected_tag_create_access_levels_user_id_foreign_key.rb index 69222710026..79532b8179c 100644 --- a/db/migrate/20200407171133_add_protected_tag_create_access_levels_user_id_foreign_key.rb +++ b/db/migrate/20200407171133_add_protected_tag_create_access_levels_user_id_foreign_key.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -# rubocop: disable Migration/AddConcurrentForeignKey -# rubocop: disable Migration/WithLockRetriesWithoutDdlTransaction class AddProtectedTagCreateAccessLevelsUserIdForeignKey < ActiveRecord::Migration[6.0] include Gitlab::Database::MigrationHelpers diff --git a/db/migrate/20200407182205_create_partitioned_foreign_keys.rb b/db/migrate/20200407182205_create_partitioned_foreign_keys.rb new file mode 100644 index 00000000000..aca8116d2dd --- /dev/null +++ b/db/migrate/20200407182205_create_partitioned_foreign_keys.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +class CreatePartitionedForeignKeys < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + create_table :partitioned_foreign_keys do |t| + t.boolean :cascade_delete, null: false, default: true + t.text :from_table, null: false + t.text :from_column, null: false + t.text :to_table, null: false + t.text :to_column, null: false + end + + add_text_limit :partitioned_foreign_keys, :from_table, 63 + add_text_limit :partitioned_foreign_keys, :from_column, 63 + add_text_limit :partitioned_foreign_keys, :to_table, 63 + add_text_limit :partitioned_foreign_keys, :to_column, 63 + + add_index :partitioned_foreign_keys, [:to_table, :from_table, :from_column], unique: true, + name: "index_partitioned_foreign_keys_unique_index" + end + + def down + drop_table :partitioned_foreign_keys + end +end diff --git a/db/migrate/20200407222647_create_project_repository_storage_moves.rb b/db/migrate/20200407222647_create_project_repository_storage_moves.rb new file mode 100644 index 00000000000..402a1cdd4a6 --- /dev/null +++ b/db/migrate/20200407222647_create_project_repository_storage_moves.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +class CreateProjectRepositoryStorageMoves < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + create_table :project_repository_storage_moves do |t| + t.timestamps_with_timezone + t.integer :project_id, limit: 8, 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 + end + + add_index :project_repository_storage_moves, :project_id + + add_text_limit(:project_repository_storage_moves, :source_storage_name, 255, constraint_name: 'project_repository_storage_moves_source_storage_name') + add_text_limit(:project_repository_storage_moves, :destination_storage_name, 255, constraint_name: 'project_repository_storage_moves_destination_storage_name') + end + + def down + remove_check_constraint(:project_repository_storage_moves, 'project_repository_storage_moves_source_storage_name') + remove_check_constraint(:project_repository_storage_moves, 'project_repository_storage_moves_destination_storage_name') + + drop_table :project_repository_storage_moves + end +end diff --git a/db/migrate/20200408125046_create_ci_freeze_periods.rb b/db/migrate/20200408125046_create_ci_freeze_periods.rb new file mode 100644 index 00000000000..42a385150b8 --- /dev/null +++ b/db/migrate/20200408125046_create_ci_freeze_periods.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +class CreateCiFreezePeriods < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + unless table_exists?(:ci_freeze_periods) + create_table :ci_freeze_periods do |t| + t.references :project, foreign_key: true, null: false + t.text :freeze_start, null: false + t.text :freeze_end, null: false + t.text :cron_timezone, null: false + + t.timestamps_with_timezone null: false + end + end + + add_text_limit :ci_freeze_periods, :freeze_start, 998 + add_text_limit :ci_freeze_periods, :freeze_end, 998 + add_text_limit :ci_freeze_periods, :cron_timezone, 255 + end + + def down + drop_table :ci_freeze_periods + end +end diff --git a/db/migrate/20200408154331_add_protected_branch_merge_access_levels_user_id_foreign_key.rb b/db/migrate/20200408154331_add_protected_branch_merge_access_levels_user_id_foreign_key.rb index 1b31da93fe7..0c5118c162b 100644 --- a/db/migrate/20200408154331_add_protected_branch_merge_access_levels_user_id_foreign_key.rb +++ b/db/migrate/20200408154331_add_protected_branch_merge_access_levels_user_id_foreign_key.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -# rubocop: disable Migration/AddConcurrentForeignKey -# rubocop: disable Migration/WithLockRetriesWithoutDdlTransaction class AddProtectedBranchMergeAccessLevelsUserIdForeignKey < ActiveRecord::Migration[6.0] include Gitlab::Database::MigrationHelpers diff --git a/db/migrate/20200408154411_add_path_locks_user_id_foreign_key.rb b/db/migrate/20200408154411_add_path_locks_user_id_foreign_key.rb index 5cab846d281..aae79c175bc 100644 --- a/db/migrate/20200408154411_add_path_locks_user_id_foreign_key.rb +++ b/db/migrate/20200408154411_add_path_locks_user_id_foreign_key.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -# rubocop: disable Migration/AddConcurrentForeignKey -# rubocop: disable Migration/WithLockRetriesWithoutDdlTransaction class AddPathLocksUserIdForeignKey < ActiveRecord::Migration[6.0] include Gitlab::Database::MigrationHelpers diff --git a/db/migrate/20200408154455_add_protected_branch_push_access_levels_user_id_foreign_key.rb b/db/migrate/20200408154455_add_protected_branch_push_access_levels_user_id_foreign_key.rb index c0c844b8853..1cfe240df05 100644 --- a/db/migrate/20200408154455_add_protected_branch_push_access_levels_user_id_foreign_key.rb +++ b/db/migrate/20200408154455_add_protected_branch_push_access_levels_user_id_foreign_key.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -# rubocop: disable Migration/AddConcurrentForeignKey -# rubocop: disable Migration/WithLockRetriesWithoutDdlTransaction class AddProtectedBranchPushAccessLevelsUserIdForeignKey < ActiveRecord::Migration[6.0] include Gitlab::Database::MigrationHelpers diff --git a/db/migrate/20200408154604_add_u2f_registrations_user_id_foreign_key.rb b/db/migrate/20200408154604_add_u2f_registrations_user_id_foreign_key.rb index 0dc8a967955..cdb81d73c99 100644 --- a/db/migrate/20200408154604_add_u2f_registrations_user_id_foreign_key.rb +++ b/db/migrate/20200408154604_add_u2f_registrations_user_id_foreign_key.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -# rubocop: disable Migration/AddConcurrentForeignKey -# rubocop: disable Migration/WithLockRetriesWithoutDdlTransaction class AddU2fRegistrationsUserIdForeignKey < ActiveRecord::Migration[6.0] include Gitlab::Database::MigrationHelpers diff --git a/db/migrate/20200409105455_change_verification_checksum_field_type_in_package_file.rb b/db/migrate/20200409105455_change_verification_checksum_field_type_in_package_file.rb new file mode 100644 index 00000000000..187ab0aa20b --- /dev/null +++ b/db/migrate/20200409105455_change_verification_checksum_field_type_in_package_file.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class ChangeVerificationChecksumFieldTypeInPackageFile < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def up + # The use of this column is behind a feature flag that never got enabled, + # so it's safe to remove it in a normal migration + remove_column :packages_package_files, :verification_checksum, :string # rubocop:disable Migration/RemoveColumn + add_column :packages_package_files, :verification_checksum, :binary + end + + def down + remove_column :packages_package_files, :verification_checksum, :binary + add_column :packages_package_files, :verification_checksum, :string + end +end diff --git a/db/migrate/20200409105456_add_checksum_index_to_package_file.rb b/db/migrate/20200409105456_add_checksum_index_to_package_file.rb new file mode 100644 index 00000000000..07762109895 --- /dev/null +++ b/db/migrate/20200409105456_add_checksum_index_to_package_file.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddChecksumIndexToPackageFile < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_index :packages_package_files, :verification_checksum, where: "(verification_checksum IS NOT NULL)", name: "packages_packages_verification_checksum_partial" + end + + def down + remove_concurrent_index :packages_package_files, :verification_checksum + end +end diff --git a/db/migrate/20200410104828_add_comment_detail_to_services.rb b/db/migrate/20200410104828_add_comment_detail_to_services.rb new file mode 100644 index 00000000000..61d993cce32 --- /dev/null +++ b/db/migrate/20200410104828_add_comment_detail_to_services.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddCommentDetailToServices < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def up + add_column :services, :comment_detail, :smallint + end + + def down + remove_column :services, :comment_detail + end +end diff --git a/db/migrate/20200411125656_add_package_scopes_to_deploy_tokens.rb b/db/migrate/20200411125656_add_package_scopes_to_deploy_tokens.rb new file mode 100644 index 00000000000..e7e2f91d4d1 --- /dev/null +++ b/db/migrate/20200411125656_add_package_scopes_to_deploy_tokens.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddPackageScopesToDeployTokens < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_column_with_default(:deploy_tokens, :read_package_registry, :boolean, default: false, allow_null: false) # rubocop:disable Migration/AddColumnWithDefault + add_column_with_default(:deploy_tokens, :write_package_registry, :boolean, default: false, allow_null: false) # rubocop:disable Migration/AddColumnWithDefault + end + + def down + remove_column(:deploy_tokens, :read_package_registry) + remove_column(:deploy_tokens, :write_package_registry) + end +end diff --git a/db/migrate/20200413072059_add_group_owners_can_manage_default_branch_protection_to_application_settings.rb b/db/migrate/20200413072059_add_group_owners_can_manage_default_branch_protection_to_application_settings.rb index eea564d00f4..2918aaea93e 100644 --- a/db/migrate/20200413072059_add_group_owners_can_manage_default_branch_protection_to_application_settings.rb +++ b/db/migrate/20200413072059_add_group_owners_can_manage_default_branch_protection_to_application_settings.rb @@ -7,7 +7,7 @@ class AddGroupOwnersCanManageDefaultBranchProtectionToApplicationSettings < Acti disable_ddl_transaction! def up - add_column_with_default(:application_settings, + add_column_with_default(:application_settings, # rubocop:disable Migration/AddColumnWithDefault :group_owners_can_manage_default_branch_protection, :boolean, default: true) diff --git a/db/migrate/20200413230056_add_waf_and_cilium_logs_to_applications_fluentd.rb b/db/migrate/20200413230056_add_waf_and_cilium_logs_to_applications_fluentd.rb new file mode 100644 index 00000000000..99f6aa0e4a8 --- /dev/null +++ b/db/migrate/20200413230056_add_waf_and_cilium_logs_to_applications_fluentd.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +class AddWafAndCiliumLogsToApplicationsFluentd < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_column_with_default(:clusters_applications_fluentd, # rubocop:disable Migration/AddColumnWithDefault + :waf_log_enabled, + :boolean, + default: true, + allow_null: false) + add_column_with_default(:clusters_applications_fluentd, # rubocop:disable Migration/AddColumnWithDefault + :cilium_log_enabled, + :boolean, + default: true, + allow_null: false) + end + + def down + remove_column(:clusters_applications_fluentd, + :waf_log_enabled) + remove_column(:clusters_applications_fluentd, + :cilium_log_enabled) + end +end diff --git a/db/migrate/20200414112444_add_group_id_to_vulnerability_exports.rb b/db/migrate/20200414112444_add_group_id_to_vulnerability_exports.rb new file mode 100644 index 00000000000..fad63d53a81 --- /dev/null +++ b/db/migrate/20200414112444_add_group_id_to_vulnerability_exports.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +class AddGroupIdToVulnerabilityExports < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + add_column :vulnerability_exports, :group_id, :integer + change_column_null :vulnerability_exports, :project_id, true + end +end diff --git a/db/migrate/20200414114611_add_group_id_index_and_fk_to_vulnerability_exports.rb b/db/migrate/20200414114611_add_group_id_index_and_fk_to_vulnerability_exports.rb new file mode 100644 index 00000000000..a3e60b87857 --- /dev/null +++ b/db/migrate/20200414114611_add_group_id_index_and_fk_to_vulnerability_exports.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class AddGroupIdIndexAndFkToVulnerabilityExports < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + GROUP_ID_INDEX_NAME = 'index_vulnerability_exports_on_group_id_not_null' + + disable_ddl_transaction! + + def up + add_concurrent_index(:vulnerability_exports, :group_id, where: 'group_id IS NOT NULL', name: GROUP_ID_INDEX_NAME) + add_concurrent_foreign_key(:vulnerability_exports, :namespaces, column: :group_id) + end + + def down + remove_foreign_key(:vulnerability_exports, column: :group_id) + remove_concurrent_index_by_name(:vulnerability_exports, GROUP_ID_INDEX_NAME) + end +end diff --git a/db/migrate/20200414115801_change_project_index_on_vulnerability_exports.rb b/db/migrate/20200414115801_change_project_index_on_vulnerability_exports.rb new file mode 100644 index 00000000000..e669faa7fca --- /dev/null +++ b/db/migrate/20200414115801_change_project_index_on_vulnerability_exports.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class ChangeProjectIndexOnVulnerabilityExports < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + OLD_INDEX_NAME = 'index_vulnerability_exports_on_project_id_and_id' + NEW_INDEX_NAME = 'index_vulnerability_exports_on_project_id_not_null' + + disable_ddl_transaction! + + def up + add_concurrent_index(:vulnerability_exports, :project_id, where: 'project_id IS NOT NULL', name: NEW_INDEX_NAME) + remove_concurrent_index_by_name(:vulnerability_exports, OLD_INDEX_NAME) + end + + def down + add_concurrent_index(:vulnerability_exports, [:project_id, :id], unique: true, name: OLD_INDEX_NAME) + remove_concurrent_index_by_name(:vulnerability_exports, NEW_INDEX_NAME) + end +end diff --git a/db/migrate/20200415153154_add_unique_index_on_plan_name.rb b/db/migrate/20200415153154_add_unique_index_on_plan_name.rb new file mode 100644 index 00000000000..d959d1315b4 --- /dev/null +++ b/db/migrate/20200415153154_add_unique_index_on_plan_name.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddUniqueIndexOnPlanName < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + remove_concurrent_index :plans, :name + add_concurrent_index :plans, :name, unique: true + end + + def down + remove_concurrent_index :plans, :name, unique: true + add_concurrent_index :plans, :name + end +end diff --git a/db/migrate/20200415203024_add_offset_pagination_plan_limit.rb b/db/migrate/20200415203024_add_offset_pagination_plan_limit.rb new file mode 100644 index 00000000000..b4d4be894f6 --- /dev/null +++ b/db/migrate/20200415203024_add_offset_pagination_plan_limit.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddOffsetPaginationPlanLimit < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + add_column :plan_limits, :offset_pagination_limit, :integer, default: 50000, null: false + end +end diff --git a/db/migrate/20200416005331_create_status_page_published_incidents.rb b/db/migrate/20200416005331_create_status_page_published_incidents.rb new file mode 100644 index 00000000000..75889cd5bb6 --- /dev/null +++ b/db/migrate/20200416005331_create_status_page_published_incidents.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class CreateStatusPagePublishedIncidents < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + create_table :status_page_published_incidents do |t| + t.timestamps_with_timezone null: false + t.references :issue, null: false, index: { unique: true }, foreign_key: { on_delete: :cascade } + end + end + end + + def down + drop_table :status_page_published_incidents + end +end diff --git a/db/migrate/20200416120128_add_columns_to_terraform_state.rb b/db/migrate/20200416120128_add_columns_to_terraform_state.rb index e657b1fde3f..65d25d842e5 100644 --- a/db/migrate/20200416120128_add_columns_to_terraform_state.rb +++ b/db/migrate/20200416120128_add_columns_to_terraform_state.rb @@ -3,6 +3,7 @@ class AddColumnsToTerraformState < ActiveRecord::Migration[6.0] DOWNTIME = false + # rubocop:disable Migration/PreventStrings def change add_column :terraform_states, :lock_xid, :string, limit: 255 add_column :terraform_states, :locked_at, :datetime_with_timezone @@ -14,4 +15,5 @@ class AddColumnsToTerraformState < ActiveRecord::Migration[6.0] add_index :terraform_states, [:project_id, :name], unique: true # rubocop:disable Migration/AddIndex (table not used yet) remove_index :terraform_states, :project_id # rubocop:disable Migration/RemoveIndex (table not used yet) end + # rubocop:enable Migration/PreventStrings end diff --git a/db/migrate/20200417044453_create_alert_management_alerts.rb b/db/migrate/20200417044453_create_alert_management_alerts.rb new file mode 100644 index 00000000000..6221eeeb24b --- /dev/null +++ b/db/migrate/20200417044453_create_alert_management_alerts.rb @@ -0,0 +1,44 @@ +# frozen_string_literal: true + +class CreateAlertManagementAlerts < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + unless table_exists?(:alert_management_alerts) + create_table :alert_management_alerts do |t| + t.timestamps_with_timezone + t.datetime_with_timezone :started_at, null: false + t.datetime_with_timezone :ended_at + t.integer :events, default: 1, null: false + t.integer :iid, null: false + t.integer :severity, default: 0, null: false, limit: 2 + t.integer :status, default: 0, null: false, limit: 2 + t.binary :fingerprint + t.bigint :issue_id, index: true + t.bigint :project_id, null: false + t.text :title, null: false + t.text :description + t.text :service + t.text :monitoring_tool + t.text :hosts, array: true, null: false, default: [] # rubocop:disable Migration/AddLimitToTextColumns + t.jsonb :payload, null: false, default: {} + + t.index %w(project_id iid), name: 'index_alert_management_alerts_on_project_id_and_iid', unique: true, using: :btree + t.index %w(project_id fingerprint), name: 'index_alert_management_alerts_on_project_id_and_fingerprint', unique: true, using: :btree + end + end + + add_text_limit :alert_management_alerts, :title, 200 + add_text_limit :alert_management_alerts, :description, 1000 + add_text_limit :alert_management_alerts, :service, 100 + add_text_limit :alert_management_alerts, :monitoring_tool, 100 + end + + def down + drop_table :alert_management_alerts + end +end diff --git a/db/migrate/20200417075843_remove_and_add_foreign_key_to_project_settings.rb b/db/migrate/20200417075843_remove_and_add_foreign_key_to_project_settings.rb new file mode 100644 index 00000000000..695bd3381c8 --- /dev/null +++ b/db/migrate/20200417075843_remove_and_add_foreign_key_to_project_settings.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class RemoveAndAddForeignKeyToProjectSettings < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + CONSTRAINT_NAME = 'fk_project_settings_push_rule_id' + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :project_settings, :push_rules, column: :push_rule_id, name: CONSTRAINT_NAME, on_delete: :nullify + remove_foreign_key_if_exists :project_settings, column: :push_rule_id, on_delete: :cascade + end + + def down + add_concurrent_foreign_key :project_settings, :push_rules, column: :push_rule_id, on_delete: :cascade + remove_foreign_key_if_exists :project_settings, column: :push_rule_id, name: CONSTRAINT_NAME, on_delete: :nullify + end +end diff --git a/db/migrate/20200417145946_add_locked_to_ci_job_artifact.rb b/db/migrate/20200417145946_add_locked_to_ci_job_artifact.rb new file mode 100644 index 00000000000..3bcc733f3b0 --- /dev/null +++ b/db/migrate/20200417145946_add_locked_to_ci_job_artifact.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddLockedToCiJobArtifact < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + add_column :ci_job_artifacts, :locked, :boolean + end + end + + def down + with_lock_retries do + remove_column :ci_job_artifacts, :locked + end + end +end diff --git a/db/migrate/20200420092011_add_profile_image_guidelines_to_appearances.rb b/db/migrate/20200420092011_add_profile_image_guidelines_to_appearances.rb new file mode 100644 index 00000000000..bab3e21e285 --- /dev/null +++ b/db/migrate/20200420092011_add_profile_image_guidelines_to_appearances.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class AddProfileImageGuidelinesToAppearances < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_column :appearances, :profile_image_guidelines, :text, null: true + add_column :appearances, :profile_image_guidelines_html, :text, null: true # rubocop:disable Migration/AddLimitToTextColumns + + add_text_limit :appearances, :profile_image_guidelines, 4096, constraint_name: 'appearances_profile_image_guidelines' + end + + def down + remove_column :appearances, :profile_image_guidelines + remove_column :appearances, :profile_image_guidelines_html + end +end diff --git a/db/migrate/20200420104303_add_group_import_states_table.rb b/db/migrate/20200420104303_add_group_import_states_table.rb new file mode 100644 index 00000000000..a44a2ea75f3 --- /dev/null +++ b/db/migrate/20200420104303_add_group_import_states_table.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +class AddGroupImportStatesTable < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + # rubocop:disable Migration/AddLimitToTextColumns + def up + with_lock_retries do + create_table :group_import_states, id: false do |t| + t.references :group, primary_key: true, foreign_key: { to_table: :namespaces, on_delete: :cascade } + t.timestamps_with_timezone null: false + t.integer :status, limit: 2, null: false, default: 0 + t.text :jid, null: false, unique: true + t.text :last_error + end + end + end + # rubocop:enable Migration/AddLimitToTextColumns + + def down + drop_table :group_import_states + end +end diff --git a/db/migrate/20200420104323_add_text_limit_to_group_import_states.rb b/db/migrate/20200420104323_add_text_limit_to_group_import_states.rb new file mode 100644 index 00000000000..c21b18d7b0e --- /dev/null +++ b/db/migrate/20200420104323_add_text_limit_to_group_import_states.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddTextLimitToGroupImportStates < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_text_limit :group_import_states, :jid, 100 + add_text_limit :group_import_states, :last_error, 255 + end + + def down + remove_text_limit :group_import_states, :jid + remove_text_limit :group_import_states, :last_error + end +end diff --git a/db/migrate/20200420115948_create_metrics_users_starred_dashboard.rb b/db/migrate/20200420115948_create_metrics_users_starred_dashboard.rb new file mode 100644 index 00000000000..27130136e9d --- /dev/null +++ b/db/migrate/20200420115948_create_metrics_users_starred_dashboard.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +class CreateMetricsUsersStarredDashboard < ActiveRecord::Migration[6.0] + DOWNTIME = false + + # limit added in following migration db/migrate/20200424101920_add_text_limit_to_metrics_users_starred_dashboards_dashboard_path.rb + # to allow this migration to be run inside the transaction + # rubocop: disable Migration/AddLimitToTextColumns + def up + create_table :metrics_users_starred_dashboards do |t| + t.timestamps_with_timezone + t.bigint :project_id, null: false + t.bigint :user_id, null: false + t.text :dashboard_path, null: false + + t.index :project_id + t.index %i(user_id project_id dashboard_path), name: "idx_metrics_users_starred_dashboard_on_user_project_dashboard", unique: true + end + end + # rubocop: enable Migration/AddLimitToTextColumns + + def down + drop_table :metrics_users_starred_dashboards + end +end diff --git a/db/migrate/20200420141733_add_index_on_enabled_clusters.rb b/db/migrate/20200420141733_add_index_on_enabled_clusters.rb new file mode 100644 index 00000000000..43f4b072c82 --- /dev/null +++ b/db/migrate/20200420141733_add_index_on_enabled_clusters.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddIndexOnEnabledClusters < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INDEX_NAME = 'index_enabled_clusters_on_id' + + disable_ddl_transaction! + + def up + add_concurrent_index :clusters, [:id], where: 'enabled = true', name: INDEX_NAME + end + + def down + remove_concurrent_index :clusters, [:id], where: 'enabled = true', name: INDEX_NAME + end +end diff --git a/db/migrate/20200420172113_add_text_limit_to_sprints_title.rb b/db/migrate/20200420172113_add_text_limit_to_sprints_title.rb new file mode 100644 index 00000000000..17707cc9dd1 --- /dev/null +++ b/db/migrate/20200420172113_add_text_limit_to_sprints_title.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddTextLimitToSprintsTitle < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + CONSTRAINT_NAME = 'sprints_title' + + def up + add_text_limit :sprints, :title, 255, constraint_name: CONSTRAINT_NAME + end + + def down + remove_check_constraint :sprints, CONSTRAINT_NAME + end +end diff --git a/db/migrate/20200420172752_add_sprints_foreign_key_to_projects.rb b/db/migrate/20200420172752_add_sprints_foreign_key_to_projects.rb new file mode 100644 index 00000000000..46b5c9c2ac2 --- /dev/null +++ b/db/migrate/20200420172752_add_sprints_foreign_key_to_projects.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddSprintsForeignKeyToProjects < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :sprints, :projects, column: :project_id, on_delete: :cascade + end + + def down + with_lock_retries do + remove_foreign_key :sprints, column: :project_id + end + end +end diff --git a/db/migrate/20200420172927_add_sprints_foreign_key_to_groups.rb b/db/migrate/20200420172927_add_sprints_foreign_key_to_groups.rb new file mode 100644 index 00000000000..cd90fe50cde --- /dev/null +++ b/db/migrate/20200420172927_add_sprints_foreign_key_to_groups.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddSprintsForeignKeyToGroups < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :sprints, :namespaces, column: :group_id, on_delete: :cascade + end + + def down + with_lock_retries do + remove_foreign_key :sprints, column: :group_id + end + end +end diff --git a/db/migrate/20200420201933_add_check_constraint_to_sprint_must_belong_to_project_or_group.rb b/db/migrate/20200420201933_add_check_constraint_to_sprint_must_belong_to_project_or_group.rb new file mode 100644 index 00000000000..9962eab95e3 --- /dev/null +++ b/db/migrate/20200420201933_add_check_constraint_to_sprint_must_belong_to_project_or_group.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddCheckConstraintToSprintMustBelongToProjectOrGroup < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + CONSTRAINT_NAME = 'sprints_must_belong_to_project_or_group' + + def up + add_check_constraint :sprints, '(project_id != NULL AND group_id IS NULL) OR (group_id != NULL AND project_id IS NULL)', CONSTRAINT_NAME + end + + def down + remove_check_constraint :sprints, CONSTRAINT_NAME + end +end diff --git a/db/migrate/20200421092907_add_index_container_repository_on_name_trigram_to_container_repository.rb b/db/migrate/20200421092907_add_index_container_repository_on_name_trigram_to_container_repository.rb new file mode 100644 index 00000000000..debca8c6008 --- /dev/null +++ b/db/migrate/20200421092907_add_index_container_repository_on_name_trigram_to_container_repository.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddIndexContainerRepositoryOnNameTrigramToContainerRepository < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INDEX_NAME = 'index_container_repository_on_name_trigram' + + disable_ddl_transaction! + + def up + add_concurrent_index :container_repositories, :name, name: INDEX_NAME, using: :gin, opclass: { name: :gin_trgm_ops } + end + + def down + remove_concurrent_index_by_name(:container_repositories, INDEX_NAME) + end +end diff --git a/db/migrate/20200421111005_create_daily_build_group_report_results.rb b/db/migrate/20200421111005_create_daily_build_group_report_results.rb new file mode 100644 index 00000000000..12d1c7531d5 --- /dev/null +++ b/db/migrate/20200421111005_create_daily_build_group_report_results.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class CreateDailyBuildGroupReportResults < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + create_table :ci_daily_build_group_report_results do |t| + t.date :date, null: false + t.bigint :project_id, null: false + t.bigint :last_pipeline_id, null: false + t.text :ref_path, null: false # rubocop:disable Migration/AddLimitToTextColumns + t.text :group_name, null: false # rubocop:disable Migration/AddLimitToTextColumns + t.jsonb :data, null: false + + t.index :last_pipeline_id + t.index [:project_id, :ref_path, :date, :group_name], name: 'index_daily_build_group_report_results_unique_columns', unique: true + t.foreign_key :projects, on_delete: :cascade + t.foreign_key :ci_pipelines, column: :last_pipeline_id, on_delete: :cascade + end + end +end diff --git a/db/migrate/20200421233150_add_foreign_keys_for_alert_management_alerts.rb b/db/migrate/20200421233150_add_foreign_keys_for_alert_management_alerts.rb new file mode 100644 index 00000000000..b16bdf9830c --- /dev/null +++ b/db/migrate/20200421233150_add_foreign_keys_for_alert_management_alerts.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddForeignKeysForAlertManagementAlerts < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :alert_management_alerts, :projects, column: :project_id, on_delete: :cascade + add_concurrent_foreign_key :alert_management_alerts, :issues, column: :issue_id, on_delete: :nullify + end + + def down + remove_foreign_key_if_exists :alert_management_alerts, column: :project_id + remove_foreign_key_if_exists :alert_management_alerts, column: :issue_id + end +end diff --git a/db/migrate/20200422091541_create_ci_instance_variables.rb b/db/migrate/20200422091541_create_ci_instance_variables.rb new file mode 100644 index 00000000000..ab2a4722f89 --- /dev/null +++ b/db/migrate/20200422091541_create_ci_instance_variables.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +class CreateCiInstanceVariables < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + DOWNTIME = false + + disable_ddl_transaction! + + def up + unless table_exists?(:ci_instance_variables) + create_table :ci_instance_variables do |t| + t.integer :variable_type, null: false, limit: 2, default: 1 + t.boolean :masked, default: false, allow_null: false + t.boolean :protected, default: false, allow_null: false + t.text :key, null: false + t.text :encrypted_value + t.text :encrypted_value_iv + + t.index [:key], name: 'index_ci_instance_variables_on_key', unique: true, using: :btree + end + end + + add_text_limit(:ci_instance_variables, :key, 255) + add_text_limit(:ci_instance_variables, :encrypted_value, 1024) + add_text_limit(:ci_instance_variables, :encrypted_value_iv, 255) + end + + def down + drop_table :ci_instance_variables + end +end diff --git a/db/migrate/20200422213749_create_operations_strategies_user_lists.rb b/db/migrate/20200422213749_create_operations_strategies_user_lists.rb new file mode 100644 index 00000000000..113f2f2f54a --- /dev/null +++ b/db/migrate/20200422213749_create_operations_strategies_user_lists.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +class CreateOperationsStrategiesUserLists < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + create_table :operations_strategies_user_lists do |t| + t.references :strategy, index: false, foreign_key: { on_delete: :cascade, to_table: :operations_strategies }, null: false + t.references :user_list, index: true, foreign_key: { on_delete: :cascade, to_table: :operations_user_lists }, null: false + + t.index [:strategy_id, :user_list_id], unique: true, name: :index_ops_strategies_user_lists_on_strategy_id_and_user_list_id + end + end +end diff --git a/db/migrate/20200423075720_add_user_id_foreign_key_to_resource_state_events.rb b/db/migrate/20200423075720_add_user_id_foreign_key_to_resource_state_events.rb new file mode 100644 index 00000000000..702347e5d43 --- /dev/null +++ b/db/migrate/20200423075720_add_user_id_foreign_key_to_resource_state_events.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddUserIdForeignKeyToResourceStateEvents < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + add_foreign_key :resource_state_events, :users, column: :user_id, on_delete: :nullify # rubocop:disable Migration/AddConcurrentForeignKey + end + end + + def down + with_lock_retries do + remove_foreign_key :resource_state_events, column: :user_id + end + end +end diff --git a/db/migrate/20200423080334_add_issue_id_foreign_key_to_resource_state_events.rb b/db/migrate/20200423080334_add_issue_id_foreign_key_to_resource_state_events.rb new file mode 100644 index 00000000000..660c51eb3a6 --- /dev/null +++ b/db/migrate/20200423080334_add_issue_id_foreign_key_to_resource_state_events.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddIssueIdForeignKeyToResourceStateEvents < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + add_foreign_key :resource_state_events, :issues, column: :issue_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey + end + end + + def down + with_lock_retries do + remove_foreign_key :resource_state_events, column: :issue_id + end + end +end diff --git a/db/migrate/20200423080607_add_merge_request_id_foreign_key_to_resource_state_events.rb b/db/migrate/20200423080607_add_merge_request_id_foreign_key_to_resource_state_events.rb new file mode 100644 index 00000000000..4f0a689a992 --- /dev/null +++ b/db/migrate/20200423080607_add_merge_request_id_foreign_key_to_resource_state_events.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddMergeRequestIdForeignKeyToResourceStateEvents < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + add_foreign_key :resource_state_events, :merge_requests, column: :merge_request_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey + end + end + + def down + with_lock_retries do + remove_foreign_key :resource_state_events, column: :merge_request_id + end + end +end diff --git a/db/migrate/20200423081409_add_constraint_to_resource_state_events_must_belong_to_issue_or_merge_request.rb b/db/migrate/20200423081409_add_constraint_to_resource_state_events_must_belong_to_issue_or_merge_request.rb new file mode 100644 index 00000000000..57df1045e2c --- /dev/null +++ b/db/migrate/20200423081409_add_constraint_to_resource_state_events_must_belong_to_issue_or_merge_request.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddConstraintToResourceStateEventsMustBelongToIssueOrMergeRequest < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + CONSTRAINT_NAME = 'resource_state_events_must_belong_to_issue_or_merge_request' + + def up + add_check_constraint :resource_state_events, '(issue_id != NULL AND merge_request_id IS NULL) OR (merge_request_id != NULL AND issue_id IS NULL)', CONSTRAINT_NAME + end + + def down + remove_check_constraint :resource_state_events, CONSTRAINT_NAME + end +end diff --git a/db/migrate/20200423081441_add_foreign_key_from_users_to_metrics_users_starred_dashboars.rb b/db/migrate/20200423081441_add_foreign_key_from_users_to_metrics_users_starred_dashboars.rb new file mode 100644 index 00000000000..c3a7635193c --- /dev/null +++ b/db/migrate/20200423081441_add_foreign_key_from_users_to_metrics_users_starred_dashboars.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddForeignKeyFromUsersToMetricsUsersStarredDashboars < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :metrics_users_starred_dashboards, :users, column: :user_id, on_delete: :cascade + end + + def down + with_lock_retries do + remove_foreign_key_if_exists :metrics_users_starred_dashboards, column: :user_id + end + end +end diff --git a/db/migrate/20200423081519_add_foreign_key_from_projects_to_metrics_users_starred_dashboars.rb b/db/migrate/20200423081519_add_foreign_key_from_projects_to_metrics_users_starred_dashboars.rb new file mode 100644 index 00000000000..88565c24eca --- /dev/null +++ b/db/migrate/20200423081519_add_foreign_key_from_projects_to_metrics_users_starred_dashboars.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddForeignKeyFromProjectsToMetricsUsersStarredDashboars < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :metrics_users_starred_dashboards, :projects, column: :project_id, on_delete: :cascade + end + + def down + with_lock_retries do + remove_foreign_key_if_exists :metrics_users_starred_dashboards, column: :project_id + end + end +end diff --git a/db/migrate/20200423101529_add_scheduled_at_to_jira_imports.rb b/db/migrate/20200423101529_add_scheduled_at_to_jira_imports.rb new file mode 100644 index 00000000000..f0d9393b6f9 --- /dev/null +++ b/db/migrate/20200423101529_add_scheduled_at_to_jira_imports.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddScheduledAtToJiraImports < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + add_column :jira_imports, :scheduled_at, :datetime_with_timezone + end +end diff --git a/db/migrate/20200424050250_remove_orphaned_invited_members.rb b/db/migrate/20200424050250_remove_orphaned_invited_members.rb new file mode 100644 index 00000000000..0fb2f7d9c39 --- /dev/null +++ b/db/migrate/20200424050250_remove_orphaned_invited_members.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class RemoveOrphanedInvitedMembers < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def up + # As of 2020-04-23, there are 19 entries on GitLab.com that match this criteria. + execute "DELETE FROM members WHERE user_id IS NULL AND invite_token IS NULL AND invite_accepted_at IS NOT NULL" + end + + def down + end +end diff --git a/db/migrate/20200424101920_add_text_limit_to_metrics_users_starred_dashboards_dashboard_path.rb b/db/migrate/20200424101920_add_text_limit_to_metrics_users_starred_dashboards_dashboard_path.rb new file mode 100644 index 00000000000..a5620fd8e29 --- /dev/null +++ b/db/migrate/20200424101920_add_text_limit_to_metrics_users_starred_dashboards_dashboard_path.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class AddTextLimitToMetricsUsersStarredDashboardsDashboardPath < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + disable_ddl_transaction! + + def up + add_text_limit :metrics_users_starred_dashboards, :dashboard_path, 255 + end + + def down + remove_text_limit :metrics_users_starred_dashboards, :dashboard_path + end +end diff --git a/db/migrate/20200424135319_create_nuget_dependency_link_metadata.rb b/db/migrate/20200424135319_create_nuget_dependency_link_metadata.rb new file mode 100644 index 00000000000..8aa3d98aa80 --- /dev/null +++ b/db/migrate/20200424135319_create_nuget_dependency_link_metadata.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +class CreateNugetDependencyLinkMetadata < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + CONSTRAINT_NAME = 'packages_nuget_dependency_link_metadata_target_framework_constraint' + + def up + unless table_exists?(:packages_nuget_dependency_link_metadata) + create_table :packages_nuget_dependency_link_metadata, id: false do |t| + t.references :dependency_link, primary_key: true, default: nil, foreign_key: { to_table: :packages_dependency_links, on_delete: :cascade }, index: { name: 'index_packages_nuget_dl_metadata_on_dependency_link_id' }, type: :bigint + t.text :target_framework, null: false + end + end + + add_text_limit :packages_nuget_dependency_link_metadata, :target_framework, 255, constraint_name: CONSTRAINT_NAME + end + + def down + drop_table :packages_nuget_dependency_link_metadata + end +end diff --git a/db/migrate/20200429001827_sprint_rename_state_to_state_enum.rb b/db/migrate/20200429001827_sprint_rename_state_to_state_enum.rb new file mode 100644 index 00000000000..721b9b7c64f --- /dev/null +++ b/db/migrate/20200429001827_sprint_rename_state_to_state_enum.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class SprintRenameStateToStateEnum < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + rename_column_concurrently :sprints, :state, :state_enum + end + + def down + undo_rename_column_concurrently :sprints, :state, :state_enum + end +end diff --git a/db/migrate/20200429015603_add_fk_to_project_repository_storage_moves.rb b/db/migrate/20200429015603_add_fk_to_project_repository_storage_moves.rb new file mode 100644 index 00000000000..a68ce66e4a6 --- /dev/null +++ b/db/migrate/20200429015603_add_fk_to_project_repository_storage_moves.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddFkToProjectRepositoryStorageMoves < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + add_foreign_key :project_repository_storage_moves, :projects, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey + end + end + + def down + with_lock_retries do + remove_foreign_key :project_repository_storage_moves, :projects + end + end +end diff --git a/db/migrate/20200429181335_add_default_value_for_file_store_to_lfs_objects.rb b/db/migrate/20200429181335_add_default_value_for_file_store_to_lfs_objects.rb new file mode 100644 index 00000000000..f316a092bfc --- /dev/null +++ b/db/migrate/20200429181335_add_default_value_for_file_store_to_lfs_objects.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddDefaultValueForFileStoreToLfsObjects < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + change_column_default :lfs_objects, :file_store, 1 + end + end + + def down + with_lock_retries do + change_column_default :lfs_objects, :file_store, nil + end + end +end diff --git a/db/migrate/20200429181955_add_default_value_for_file_store_to_ci_job_artifacts.rb b/db/migrate/20200429181955_add_default_value_for_file_store_to_ci_job_artifacts.rb new file mode 100644 index 00000000000..ac3d5e41e3e --- /dev/null +++ b/db/migrate/20200429181955_add_default_value_for_file_store_to_ci_job_artifacts.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddDefaultValueForFileStoreToCiJobArtifacts < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + change_column_default :ci_job_artifacts, :file_store, 1 + end + end + + def down + with_lock_retries do + change_column_default :ci_job_artifacts, :file_store, nil + end + end +end diff --git a/db/migrate/20200429182245_add_default_value_for_store_to_uploads.rb b/db/migrate/20200429182245_add_default_value_for_store_to_uploads.rb new file mode 100644 index 00000000000..f28fcce8f2f --- /dev/null +++ b/db/migrate/20200429182245_add_default_value_for_store_to_uploads.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddDefaultValueForStoreToUploads < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + change_column_default :uploads, :store, 1 + end + end + + def down + with_lock_retries do + change_column_default :uploads, :store, nil + end + end +end diff --git a/db/migrate/20200430103158_create_group_wiki_repositories.rb b/db/migrate/20200430103158_create_group_wiki_repositories.rb new file mode 100644 index 00000000000..b84a8a55def --- /dev/null +++ b/db/migrate/20200430103158_create_group_wiki_repositories.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class CreateGroupWikiRepositories < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + create_table :group_wiki_repositories, id: false do |t| + t.bigint :shard_id, null: false, index: true + t.bigint :group_id, null: false, index: false, primary_key: true, default: nil + + # The limit is added in db/migrate/20200511120430_add_group_wiki_repositories_disk_path_limit.rb + t.text :disk_path, null: false, index: { unique: true } # rubocop:disable Migration/AddLimitToTextColumns + end + end +end diff --git a/db/migrate/20200430130048_create_packages_nuget_metadata.rb b/db/migrate/20200430130048_create_packages_nuget_metadata.rb new file mode 100644 index 00000000000..0f0d490c93d --- /dev/null +++ b/db/migrate/20200430130048_create_packages_nuget_metadata.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +class CreatePackagesNugetMetadata < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + LICENSE_URL_CONSTRAINT_NAME = 'packages_nuget_metadata_license_url_constraint' + PROJECT_URL_CONSTRAINT_NAME = 'packages_nuget_metadata_project_url_constraint' + ICON_URL_CONSTRAINT_NAME = 'packages_nuget_metadata_icon_url_constraint' + + def up + unless table_exists?(:packages_nuget_metadata) + with_lock_retries do + create_table :packages_nuget_metadata, id: false do |t| + t.references :package, primary_key: true, default: nil, index: false, foreign_key: { to_table: :packages_packages, on_delete: :cascade }, type: :bigint + t.text :license_url + t.text :project_url + t.text :icon_url + end + end + end + + add_text_limit :packages_nuget_metadata, :license_url, 255, constraint_name: LICENSE_URL_CONSTRAINT_NAME + add_text_limit :packages_nuget_metadata, :project_url, 255, constraint_name: PROJECT_URL_CONSTRAINT_NAME + add_text_limit :packages_nuget_metadata, :icon_url, 255, constraint_name: ICON_URL_CONSTRAINT_NAME + end + + def down + drop_table :packages_nuget_metadata + end +end diff --git a/db/migrate/20200505164958_add_registry_settings_to_application_settings.rb b/db/migrate/20200505164958_add_registry_settings_to_application_settings.rb new file mode 100644 index 00000000000..4c307dbe845 --- /dev/null +++ b/db/migrate/20200505164958_add_registry_settings_to_application_settings.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +class AddRegistrySettingsToApplicationSettings < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + # rubocop:disable Migration/AddLimitToTextColumns + def up + add_column_with_default(:application_settings, # rubocop:disable Migration/AddColumnWithDefault + :container_registry_vendor, + :text, + default: '', + allow_null: false) + + add_column_with_default(:application_settings, # rubocop:disable Migration/AddColumnWithDefault + :container_registry_version, + :text, + default: '', + allow_null: false) + end + # rubocop:enable Migration/AddLimitToTextColumns + + def down + remove_column :application_settings, :container_registry_vendor + remove_column :application_settings, :container_registry_version + end +end diff --git a/db/migrate/20200505171834_add_text_limit_to_container_registry_vendor.rb b/db/migrate/20200505171834_add_text_limit_to_container_registry_vendor.rb new file mode 100644 index 00000000000..242dcc9a837 --- /dev/null +++ b/db/migrate/20200505171834_add_text_limit_to_container_registry_vendor.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddTextLimitToContainerRegistryVendor < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_text_limit :application_settings, :container_registry_vendor, 255 + end + + def down + remove_text_limit :application_settings, :container_registry_vendor + end +end diff --git a/db/migrate/20200505172405_add_text_limit_to_container_registry_version.rb b/db/migrate/20200505172405_add_text_limit_to_container_registry_version.rb new file mode 100644 index 00000000000..36589c9cc75 --- /dev/null +++ b/db/migrate/20200505172405_add_text_limit_to_container_registry_version.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddTextLimitToContainerRegistryVersion < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_text_limit :application_settings, :container_registry_version, 255 + end + + def down + remove_text_limit :application_settings, :container_registry_version + end +end diff --git a/db/migrate/20200507221434_add_container_registry_features_to_application_settings.rb b/db/migrate/20200507221434_add_container_registry_features_to_application_settings.rb new file mode 100644 index 00000000000..b333db56eee --- /dev/null +++ b/db/migrate/20200507221434_add_container_registry_features_to_application_settings.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddContainerRegistryFeaturesToApplicationSettings < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def up + add_column :application_settings, :container_registry_features, :text, array: true, default: [], null: false # rubocop:disable Migration/AddLimitToTextColumns + end + + def down + remove_column :application_settings, :container_registry_features + end +end diff --git a/db/migrate/20200511092246_add_epic_id_to_resource_state_events.rb b/db/migrate/20200511092246_add_epic_id_to_resource_state_events.rb new file mode 100644 index 00000000000..85d965972aa --- /dev/null +++ b/db/migrate/20200511092246_add_epic_id_to_resource_state_events.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddEpicIdToResourceStateEvents < ActiveRecord::Migration[6.0] + DOWNTIME = false + + INDEX_NAME = 'index_resource_state_events_on_epic_id' + + def up + add_column :resource_state_events, :epic_id, :integer + add_index :resource_state_events, :epic_id, name: INDEX_NAME # rubocop:disable Migration/AddIndex + end + + def down + remove_index :resource_state_events, name: INDEX_NAME # rubocop:disable Migration/RemoveIndex + remove_column :resource_state_events, :epic_id, :integer + end +end diff --git a/db/migrate/20200511092505_add_foreign_key_to_epic_id_on_resource_state_events.rb b/db/migrate/20200511092505_add_foreign_key_to_epic_id_on_resource_state_events.rb new file mode 100644 index 00000000000..8072fe81c4a --- /dev/null +++ b/db/migrate/20200511092505_add_foreign_key_to_epic_id_on_resource_state_events.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddForeignKeyToEpicIdOnResourceStateEvents < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + add_foreign_key :resource_state_events, :epics, column: :epic_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey + end + end + + def down + with_lock_retries do + remove_foreign_key :resource_state_events, column: :epic_id + end + end +end diff --git a/db/migrate/20200511115430_add_inherit_from_to_services.rb b/db/migrate/20200511115430_add_inherit_from_to_services.rb new file mode 100644 index 00000000000..c409b543dbf --- /dev/null +++ b/db/migrate/20200511115430_add_inherit_from_to_services.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddInheritFromToServices < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + add_column :services, :inherit_from_id, :bigint + end +end diff --git a/db/migrate/20200511115431_add_index_inherit_from_id_to_services.rb b/db/migrate/20200511115431_add_index_inherit_from_id_to_services.rb new file mode 100644 index 00000000000..a0a5f361edf --- /dev/null +++ b/db/migrate/20200511115431_add_index_inherit_from_id_to_services.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class AddIndexInheritFromIdToServices < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_index :services, :inherit_from_id + + add_concurrent_foreign_key :services, :services, column: :inherit_from_id, on_delete: :nullify + end + + def down + remove_foreign_key_if_exists :services, column: :inherit_from_id + + remove_concurrent_index :services, :inherit_from_id + end +end diff --git a/db/migrate/20200511121549_add_group_wiki_repositories_shard_id_foreign_key.rb b/db/migrate/20200511121549_add_group_wiki_repositories_shard_id_foreign_key.rb new file mode 100644 index 00000000000..c2606dfb0d5 --- /dev/null +++ b/db/migrate/20200511121549_add_group_wiki_repositories_shard_id_foreign_key.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddGroupWikiRepositoriesShardIdForeignKey < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + add_foreign_key :group_wiki_repositories, :shards, on_delete: :restrict # rubocop:disable Migration/AddConcurrentForeignKey + end + end + + def down + with_lock_retries do + remove_foreign_key :group_wiki_repositories, :shards + end + end +end diff --git a/db/migrate/20200511121610_add_group_wiki_repositories_group_id_foreign_key.rb b/db/migrate/20200511121610_add_group_wiki_repositories_group_id_foreign_key.rb new file mode 100644 index 00000000000..3a4c75be3b9 --- /dev/null +++ b/db/migrate/20200511121610_add_group_wiki_repositories_group_id_foreign_key.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddGroupWikiRepositoriesGroupIdForeignKey < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + add_foreign_key :group_wiki_repositories, :namespaces, column: :group_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey + end + end + + def down + with_lock_retries do + remove_foreign_key :group_wiki_repositories, :namespaces, column: :group_id + end + end +end diff --git a/db/migrate/20200511121620_add_group_wiki_repositories_disk_path_limit.rb b/db/migrate/20200511121620_add_group_wiki_repositories_disk_path_limit.rb new file mode 100644 index 00000000000..db4b9d8a6e4 --- /dev/null +++ b/db/migrate/20200511121620_add_group_wiki_repositories_disk_path_limit.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddGroupWikiRepositoriesDiskPathLimit < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + # Set this constant to true if this migration requires downtime. + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_text_limit :group_wiki_repositories, :disk_path, 80 + end + + def down + remove_text_limit :group_wiki_repositories, :disk_path + end +end diff --git a/db/migrate/20200511130129_remove_deprecated_jenkins_service_records.rb b/db/migrate/20200511130129_remove_deprecated_jenkins_service_records.rb new file mode 100644 index 00000000000..258142f950e --- /dev/null +++ b/db/migrate/20200511130129_remove_deprecated_jenkins_service_records.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class RemoveDeprecatedJenkinsServiceRecords < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def up + execute <<~SQL.strip + DELETE FROM services WHERE type = 'JenkinsDeprecatedService'; + SQL + end + + def down + # no-op + + # The records were removed by `up` + end +end diff --git a/db/migrate/20200512085150_change_default_value_of_protected_ci_variables_of_application_settings_to_true.rb b/db/migrate/20200512085150_change_default_value_of_protected_ci_variables_of_application_settings_to_true.rb new file mode 100644 index 00000000000..ca623ccf8b4 --- /dev/null +++ b/db/migrate/20200512085150_change_default_value_of_protected_ci_variables_of_application_settings_to_true.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class ChangeDefaultValueOfProtectedCiVariablesOfApplicationSettingsToTrue < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + change_column_default :application_settings, :protected_ci_variables, from: false, to: true + end +end diff --git a/db/migrate/20200512164334_sprint_make_state_enum_not_null_and_default.rb b/db/migrate/20200512164334_sprint_make_state_enum_not_null_and_default.rb new file mode 100644 index 00000000000..f0db228e249 --- /dev/null +++ b/db/migrate/20200512164334_sprint_make_state_enum_not_null_and_default.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class SprintMakeStateEnumNotNullAndDefault < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def up + change_column_default :sprints, :state_enum, from: 0, to: 1 + change_column_null :sprints, :state_enum, false, 1 + end + + def down + change_column_null :sprints, :state_enum, true + change_column_default :sprints, :state_enum, from: 1, to: nil + end +end diff --git a/db/migrate/20200513160930_fix_not_null_check_constraint_inconsistency.rb b/db/migrate/20200513160930_fix_not_null_check_constraint_inconsistency.rb new file mode 100644 index 00000000000..a8bb91cf6cf --- /dev/null +++ b/db/migrate/20200513160930_fix_not_null_check_constraint_inconsistency.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class FixNotNullCheckConstraintInconsistency < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + table = :application_settings + + %i(container_registry_vendor container_registry_version).each do |column| + change_column_null table, column, false + remove_not_null_constraint(table, column) if check_not_null_constraint_exists?(table, column) + end + end + + def down + # No-op: for regular systems without the inconsistency, #up is a no-op, too + end +end diff --git a/db/migrate/20200513224143_add_section_to_approval_merge_request_rule.rb b/db/migrate/20200513224143_add_section_to_approval_merge_request_rule.rb new file mode 100644 index 00000000000..98424e9b735 --- /dev/null +++ b/db/migrate/20200513224143_add_section_to_approval_merge_request_rule.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class AddSectionToApprovalMergeRequestRule < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + unless column_exists?(:approval_merge_request_rules, :section) + add_column :approval_merge_request_rules, :section, :text + end + + add_text_limit :approval_merge_request_rules, :section, 255 + end + + def down + remove_column :approval_merge_request_rules, :section + end +end diff --git a/db/migrate/20200513234502_fill_file_store_lfs_objects.rb b/db/migrate/20200513234502_fill_file_store_lfs_objects.rb new file mode 100644 index 00000000000..74066afbd83 --- /dev/null +++ b/db/migrate/20200513234502_fill_file_store_lfs_objects.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class FillFileStoreLfsObjects < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + update_column_in_batches(:lfs_objects, :file_store, 1) do |table, query| + query.where(table[:file_store].eq(nil)) + end + end + + def down + # no-op + end +end diff --git a/db/migrate/20200513235347_fill_store_uploads.rb b/db/migrate/20200513235347_fill_store_uploads.rb new file mode 100644 index 00000000000..42db5e4cc08 --- /dev/null +++ b/db/migrate/20200513235347_fill_store_uploads.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class FillStoreUploads < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + update_column_in_batches(:uploads, :store, 1) do |table, query| + query.where(table[:store].eq(nil)) + end + end + + def down + # no-op + end +end diff --git a/db/migrate/20200513235532_fill_file_store_ci_job_artifacts.rb b/db/migrate/20200513235532_fill_file_store_ci_job_artifacts.rb new file mode 100644 index 00000000000..d4c25167535 --- /dev/null +++ b/db/migrate/20200513235532_fill_file_store_ci_job_artifacts.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class FillFileStoreCiJobArtifacts < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + # rubocop:disable Migration/UpdateLargeTable + update_column_in_batches(:ci_job_artifacts, :file_store, 1) do |table, query| + query.where(table[:file_store].eq(nil)) + end + # rubocop:enable Migration/UpdateLargeTable + end + + def down + # no-op + end +end diff --git a/db/migrate/20200515155620_add_index_non_requested_project_members_on_source_id_source_type.rb b/db/migrate/20200515155620_add_index_non_requested_project_members_on_source_id_source_type.rb new file mode 100644 index 00000000000..333f4e93e95 --- /dev/null +++ b/db/migrate/20200515155620_add_index_non_requested_project_members_on_source_id_source_type.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddIndexNonRequestedProjectMembersOnSourceIdSourceType < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_index(:members, [:source_id, :source_type], where: "requested_at IS NULL and type = 'ProjectMember'", name: 'index_non_requested_project_members_on_source_id_and_type') + end + + def down + remove_concurrent_index_by_name(:members, 'index_non_requested_project_members_on_source_id_and_type') + end +end diff --git a/db/post_migrate/20181008200441_remove_circuit_breaker.rb b/db/post_migrate/20181008200441_remove_circuit_breaker.rb index 378692e8886..09491038e50 100644 --- a/db/post_migrate/20181008200441_remove_circuit_breaker.rb +++ b/db/post_migrate/20181008200441_remove_circuit_breaker.rb @@ -24,7 +24,9 @@ class RemoveCircuitBreaker < ActiveRecord::Migration[4.2] def down CIRCUIT_BREAKER_COLUMS_WITH_DEFAULT.each do |column, default| + # rubocop:disable Migration/AddColumnWithDefault add_column_with_default(:application_settings, column, :integer, default: default) unless column_exists?(:application_settings, column) + # rubocop:enable Migration/AddColumnWithDefault end end end diff --git a/db/post_migrate/20181013005024_remove_koding_from_application_settings.rb b/db/post_migrate/20181013005024_remove_koding_from_application_settings.rb index b6e5473e896..550ad94f4ab 100644 --- a/db/post_migrate/20181013005024_remove_koding_from_application_settings.rb +++ b/db/post_migrate/20181013005024_remove_koding_from_application_settings.rb @@ -12,6 +12,6 @@ class RemoveKodingFromApplicationSettings < ActiveRecord::Migration[4.2] def down add_column :application_settings, :koding_enabled, :boolean # rubocop:disable Migration/SaferBooleanColumn - add_column :application_settings, :koding_url, :string # rubocop:disable Migration/AddLimitToStringColumns + add_column :application_settings, :koding_url, :string end end diff --git a/db/post_migrate/20190404231137_remove_alternate_url_from_geo_nodes.rb b/db/post_migrate/20190404231137_remove_alternate_url_from_geo_nodes.rb index 8e7ef0ec54f..785ceb2fb28 100644 --- a/db/post_migrate/20190404231137_remove_alternate_url_from_geo_nodes.rb +++ b/db/post_migrate/20190404231137_remove_alternate_url_from_geo_nodes.rb @@ -16,6 +16,6 @@ class RemoveAlternateUrlFromGeoNodes < ActiveRecord::Migration[5.0] end def down - add_column :geo_nodes, :alternate_url, :string # rubocop:disable Migration/AddLimitToStringColumns + add_column :geo_nodes, :alternate_url, :string end end diff --git a/db/post_migrate/20190625184066_remove_sentry_from_application_settings.rb b/db/post_migrate/20190625184066_remove_sentry_from_application_settings.rb index 9d71bfafffb..7a0923aabd8 100644 --- a/db/post_migrate/20190625184066_remove_sentry_from_application_settings.rb +++ b/db/post_migrate/20190625184066_remove_sentry_from_application_settings.rb @@ -28,11 +28,13 @@ class RemoveSentryFromApplicationSettings < ActiveRecord::Migration[5.0] def down SENTRY_ENABLED_COLUMNS.each do |column| + # rubocop:disable Migration/AddColumnWithDefault add_column_with_default(:application_settings, column, :boolean, default: false, allow_null: false) unless column_exists?(:application_settings, column) + # rubocop:enable Migration/AddColumnWithDefault end SENTRY_DSN_COLUMNS.each do |column| - add_column(:application_settings, column, :string) unless column_exists?(:application_settings, column) # rubocop:disable Migration/AddLimitToStringColumns + add_column(:application_settings, column, :string) unless column_exists?(:application_settings, column) end end end diff --git a/db/post_migrate/20191030193050_remove_pendo_from_application_settings.rb b/db/post_migrate/20191030193050_remove_pendo_from_application_settings.rb index 33bbe6f8ea7..c1a1cc01aa4 100644 --- a/db/post_migrate/20191030193050_remove_pendo_from_application_settings.rb +++ b/db/post_migrate/20191030193050_remove_pendo_from_application_settings.rb @@ -13,7 +13,7 @@ class RemovePendoFromApplicationSettings < ActiveRecord::Migration[5.2] end def down - add_column_with_default :application_settings, :pendo_enabled, :boolean, default: false, allow_null: false + add_column_with_default :application_settings, :pendo_enabled, :boolean, default: false, allow_null: false # rubocop:disable Migration/AddColumnWithDefault add_column :application_settings, :pendo_url, :string, limit: 255 end end diff --git a/db/post_migrate/20191128162854_drop_project_ci_cd_settings_merge_trains_enabled.rb b/db/post_migrate/20191128162854_drop_project_ci_cd_settings_merge_trains_enabled.rb index c2e6792e611..7f91d5112b3 100644 --- a/db/post_migrate/20191128162854_drop_project_ci_cd_settings_merge_trains_enabled.rb +++ b/db/post_migrate/20191128162854_drop_project_ci_cd_settings_merge_trains_enabled.rb @@ -12,6 +12,8 @@ class DropProjectCiCdSettingsMergeTrainsEnabled < ActiveRecord::Migration[5.2] end def down + # rubocop:disable Migration/AddColumnWithDefault add_column_with_default :project_ci_cd_settings, :merge_trains_enabled, :boolean, default: false, allow_null: true # rubocop:disable Migration/UpdateLargeTable + # rubocop:enable Migration/AddColumnWithDefault end end diff --git a/db/post_migrate/20191202031812_drop_operations_feature_flags_clients_token.rb b/db/post_migrate/20191202031812_drop_operations_feature_flags_clients_token.rb index bda461af7bc..93cef322f02 100644 --- a/db/post_migrate/20191202031812_drop_operations_feature_flags_clients_token.rb +++ b/db/post_migrate/20191202031812_drop_operations_feature_flags_clients_token.rb @@ -14,7 +14,7 @@ class DropOperationsFeatureFlagsClientsToken < ActiveRecord::Migration[5.2] def down unless column_exists?(:operations_feature_flags_clients, :token) - add_column :operations_feature_flags_clients, :token, :string # rubocop:disable Migration/AddLimitToStringColumns + add_column :operations_feature_flags_clients, :token, :string end add_concurrent_index :operations_feature_flags_clients, [:project_id, :token], unique: true, diff --git a/db/post_migrate/20200120083607_remove_storage_version_column_from_snippets.rb b/db/post_migrate/20200120083607_remove_storage_version_column_from_snippets.rb index e94dc75e65c..62bb3f46cae 100644 --- a/db/post_migrate/20200120083607_remove_storage_version_column_from_snippets.rb +++ b/db/post_migrate/20200120083607_remove_storage_version_column_from_snippets.rb @@ -19,7 +19,7 @@ class RemoveStorageVersionColumnFromSnippets < ActiveRecord::Migration[5.2] def down return if column_exists?(:snippets, :storage_version) - add_column_with_default( + add_column_with_default( # rubocop:disable Migration/AddColumnWithDefault :snippets, :storage_version, :integer, diff --git a/db/post_migrate/20200128210353_cleanup_optimistic_locking_nulls.rb b/db/post_migrate/20200128210353_cleanup_optimistic_locking_nulls.rb index 8bc037c7333..5c172159561 100644 --- a/db/post_migrate/20200128210353_cleanup_optimistic_locking_nulls.rb +++ b/db/post_migrate/20200128210353_cleanup_optimistic_locking_nulls.rb @@ -31,7 +31,7 @@ class CleanupOptimisticLockingNulls < ActiveRecord::Migration[5.2] 'CleanupOptimisticLockingNulls', 2.minutes, batch_size: BATCH_SIZE, - other_arguments: [table] + other_job_arguments: [table] ) end end diff --git a/db/post_migrate/20200212052620_readd_template_column_to_services.rb b/db/post_migrate/20200212052620_readd_template_column_to_services.rb index 2b0d26b2ad4..c636cb0a07b 100644 --- a/db/post_migrate/20200212052620_readd_template_column_to_services.rb +++ b/db/post_migrate/20200212052620_readd_template_column_to_services.rb @@ -15,7 +15,7 @@ class ReaddTemplateColumnToServices < ActiveRecord::Migration[6.0] # to production, so we should be okay to re-add it without worrying # about doing a data migration. If we needed to restore the value # of `template`, we would look for entries with `project_id IS NULL`. - add_column_with_default :services, :template, :boolean, default: false, allow_null: true + add_column_with_default :services, :template, :boolean, default: false, allow_null: true # rubocop:disable Migration/AddColumnWithDefault end # rubocop:enable Migration/UpdateLargeTable diff --git a/db/post_migrate/20200217210353_cleanup_optimistic_locking_nulls_pt2.rb b/db/post_migrate/20200217210353_cleanup_optimistic_locking_nulls_pt2.rb new file mode 100644 index 00000000000..1ec3e817e8e --- /dev/null +++ b/db/post_migrate/20200217210353_cleanup_optimistic_locking_nulls_pt2.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class CleanupOptimisticLockingNullsPt2 < ActiveRecord::Migration[5.2] + def change + # no-op: the MR that contained this migration was reverted + end +end diff --git a/db/post_migrate/20200219193058_remove_state_from_issues.rb b/db/post_migrate/20200219193058_remove_state_from_issues.rb index ac27a9a9b69..007ba600ce7 100644 --- a/db/post_migrate/20200219193058_remove_state_from_issues.rb +++ b/db/post_migrate/20200219193058_remove_state_from_issues.rb @@ -18,7 +18,7 @@ class RemoveStateFromIssues < ActiveRecord::Migration[6.0] return if issue_state_column_exists? with_lock_retries do - add_column :issues, :state, :string # rubocop:disable Migration/AddLimitToStringColumns + add_column :issues, :state, :string end end diff --git a/db/post_migrate/20200219193117_remove_state_from_merge_requests.rb b/db/post_migrate/20200219193117_remove_state_from_merge_requests.rb index c99a732f37b..384a694b549 100644 --- a/db/post_migrate/20200219193117_remove_state_from_merge_requests.rb +++ b/db/post_migrate/20200219193117_remove_state_from_merge_requests.rb @@ -18,7 +18,7 @@ class RemoveStateFromMergeRequests < ActiveRecord::Migration[6.0] return if merge_requests_state_column_exists? with_lock_retries do - add_column :merge_requests, :state, :string # rubocop:disable Migration/AddLimitToStringColumns + add_column :merge_requests, :state, :string end end diff --git a/db/post_migrate/20200221142216_remove_repository_storage_from_snippets.rb b/db/post_migrate/20200221142216_remove_repository_storage_from_snippets.rb index fb8721a45b8..f9ef985218b 100644 --- a/db/post_migrate/20200221142216_remove_repository_storage_from_snippets.rb +++ b/db/post_migrate/20200221142216_remove_repository_storage_from_snippets.rb @@ -16,7 +16,7 @@ class RemoveRepositoryStorageFromSnippets < ActiveRecord::Migration[6.0] def down return if column_exists?(:snippets, :repository_storage) - add_column_with_default( + add_column_with_default( # rubocop:disable Migration/AddColumnWithDefault :snippets, :repository_storage, :string, diff --git a/db/post_migrate/20200310215714_migrate_saml_identities_to_scim_identities.rb b/db/post_migrate/20200310215714_migrate_saml_identities_to_scim_identities.rb new file mode 100644 index 00000000000..e2ec7b62d31 --- /dev/null +++ b/db/post_migrate/20200310215714_migrate_saml_identities_to_scim_identities.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +class MigrateSamlIdentitiesToScimIdentities < ActiveRecord::Migration[6.0] + DOWNTIME = false + + class Identity < ActiveRecord::Base + self.table_name = 'identities' + + include ::EachBatch + end + + def up + Identity + .joins('INNER JOIN saml_providers ON saml_providers.id = identities.saml_provider_id') + .where('saml_providers.group_id IN (SELECT group_id FROM scim_oauth_access_tokens)') + .select('identities.extern_uid, identities.user_id, saml_providers.group_id, TRUE AS active, + identities.created_at, CURRENT_TIMESTAMP AS updated_at') + .each_batch do |batch| + data_to_insert = batch.map do |record| + record.attributes.extract!("extern_uid", "user_id", "group_id", "active", "created_at", "updated_at") + end + + Gitlab::Database.bulk_insert(:scim_identities, data_to_insert, on_conflict: :do_nothing) + end + end + + def down + end +end diff --git a/db/post_migrate/20200312134637_backfill_environment_id_on_deployment_merge_requests.rb b/db/post_migrate/20200312134637_backfill_environment_id_on_deployment_merge_requests.rb new file mode 100644 index 00000000000..77cb1ae8508 --- /dev/null +++ b/db/post_migrate/20200312134637_backfill_environment_id_on_deployment_merge_requests.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +class BackfillEnvironmentIdOnDeploymentMergeRequests < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + # no-op + + # this migration is deleted because there is no foreign key for + # deployments.environment_id and this caused a failure upgrading + # deployments_merge_requests.environment_id + # + # Details on the following issues: + # * https://gitlab.com/gitlab-org/gitlab/-/issues/217191 + # * https://gitlab.com/gitlab-org/gitlab/-/issues/26229 + end + + def down + # no-op + + # this migration is designed to delete duplicated data + end +end diff --git a/db/post_migrate/20200401091051_remove_reference_columns_from_resource_milestone_events.rb b/db/post_migrate/20200401091051_remove_reference_columns_from_resource_milestone_events.rb new file mode 100644 index 00000000000..639ab93cf18 --- /dev/null +++ b/db/post_migrate/20200401091051_remove_reference_columns_from_resource_milestone_events.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class RemoveReferenceColumnsFromResourceMilestoneEvents < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + remove_column :resource_milestone_events, :reference, :text + remove_column :resource_milestone_events, :reference_html, :text + remove_column :resource_milestone_events, :cached_markdown_version, :integer + end +end diff --git a/db/post_migrate/20200403132349_remove_old_index_pages_domains_need_auto_ssl_renewal.rb b/db/post_migrate/20200403132349_remove_old_index_pages_domains_need_auto_ssl_renewal.rb new file mode 100644 index 00000000000..b36dce188df --- /dev/null +++ b/db/post_migrate/20200403132349_remove_old_index_pages_domains_need_auto_ssl_renewal.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class RemoveOldIndexPagesDomainsNeedAutoSslRenewal < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + INDEX_NAME = 'index_pages_domains_need_auto_ssl_renewal' + + disable_ddl_transaction! + + def up + remove_concurrent_index(:pages_domains, [:certificate_source, :certificate_valid_not_after], + where: "auto_ssl_enabled = true", name: INDEX_NAME) + end + + def down + add_concurrent_index(:pages_domains, [:certificate_source, :certificate_valid_not_after], + where: "auto_ssl_enabled = true", name: INDEX_NAME) + end +end diff --git a/db/post_migrate/20200420094444_backfill_snippet_repositories.rb b/db/post_migrate/20200420094444_backfill_snippet_repositories.rb new file mode 100644 index 00000000000..452a1a5330f --- /dev/null +++ b/db/post_migrate/20200420094444_backfill_snippet_repositories.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +class BackfillSnippetRepositories < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INTERVAL = 3.minutes + BATCH_SIZE = 100 + MIGRATION = 'BackfillSnippetRepositories' + + disable_ddl_transaction! + + class Snippet < ActiveRecord::Base + include EachBatch + + self.table_name = 'snippets' + self.inheritance_column = :_type_disabled + end + + def up + queue_background_migration_jobs_by_range_at_intervals(Snippet, + MIGRATION, + INTERVAL, + batch_size: BATCH_SIZE) + end + + def down + # no-op + end +end diff --git a/db/post_migrate/20200420162730_remove_additional_application_settings_rows.rb b/db/post_migrate/20200420162730_remove_additional_application_settings_rows.rb new file mode 100644 index 00000000000..e4a0ec1eb4a --- /dev/null +++ b/db/post_migrate/20200420162730_remove_additional_application_settings_rows.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class RemoveAdditionalApplicationSettingsRows < ActiveRecord::Migration[6.0] + class ApplicationSetting < ActiveRecord::Base + self.table_name = 'application_settings' + end + + def up + return if ApplicationSetting.count == 1 + + execute "DELETE from application_settings WHERE id NOT IN (SELECT MAX(id) FROM application_settings);" + end + + def down + # no changes + end +end diff --git a/db/post_migrate/20200424043515_drop_namespaces_plan_id.rb b/db/post_migrate/20200424043515_drop_namespaces_plan_id.rb new file mode 100644 index 00000000000..16a56b16e5a --- /dev/null +++ b/db/post_migrate/20200424043515_drop_namespaces_plan_id.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +class DropNamespacesPlanId < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + with_lock_retries do + remove_column :namespaces, :plan_id + end + end + + def down + unless column_exists?(:namespaces, :plan_id) + with_lock_retries do + add_column :namespaces, :plan_id, :integer + end + end + + add_concurrent_index :namespaces, :plan_id + add_concurrent_foreign_key :namespaces, :plans, column: :plan_id, on_delete: :nullify + end +end diff --git a/db/post_migrate/20200427064130_cleanup_optimistic_locking_nulls_pt2_fixed.rb b/db/post_migrate/20200427064130_cleanup_optimistic_locking_nulls_pt2_fixed.rb new file mode 100644 index 00000000000..63f85fc7156 --- /dev/null +++ b/db/post_migrate/20200427064130_cleanup_optimistic_locking_nulls_pt2_fixed.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +class CleanupOptimisticLockingNullsPt2Fixed < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + TABLES = %w(ci_stages ci_builds ci_pipelines).freeze + BATCH_SIZE = 10_000 + + def declare_class(table) + Class.new(ActiveRecord::Base) do + include EachBatch + + self.table_name = table + self.inheritance_column = :_type_disabled # Disable STI + end + end + + def up + last_table_final_delay = 0 + + TABLES.each do |table| + # cleanup wrong index created in the previous migration, it might be there on staging + remove_concurrent_index table.to_sym, :lock_version, where: "lock_version IS NULL" + + add_concurrent_index table.to_sym, :id, where: "lock_version IS NULL", name: "tmp_index_#{table}_lock_version" + + last_table_final_delay = queue_background_migration_jobs_by_range_at_intervals( + declare_class(table).where(lock_version: nil), + 'CleanupOptimisticLockingNulls', + 2.minutes, + batch_size: BATCH_SIZE, + other_job_arguments: [table], + initial_delay: last_table_final_delay + ) + end + end + + def down + TABLES.each do |table| + remove_concurrent_index table.to_sym, :id, where: "lock_version IS NULL", name: "tmp_index_#{table}_lock_version" + end + end +end diff --git a/db/post_migrate/20200428134356_remove_elastic_experimental_indexer_from_application_settings.rb b/db/post_migrate/20200428134356_remove_elastic_experimental_indexer_from_application_settings.rb new file mode 100644 index 00000000000..a9baf6fd8e3 --- /dev/null +++ b/db/post_migrate/20200428134356_remove_elastic_experimental_indexer_from_application_settings.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true +class RemoveElasticExperimentalIndexerFromApplicationSettings < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + remove_column :application_settings, :elasticsearch_experimental_indexer, :boolean + end +end diff --git a/db/post_migrate/20200429002150_cleanup_sprints_state_rename.rb b/db/post_migrate/20200429002150_cleanup_sprints_state_rename.rb new file mode 100644 index 00000000000..7f67a55a19d --- /dev/null +++ b/db/post_migrate/20200429002150_cleanup_sprints_state_rename.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class CleanupSprintsStateRename < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + cleanup_concurrent_column_rename :sprints, :state, :state_enum + end + + def down + undo_cleanup_concurrent_column_rename :sprints, :state, :state_enum + end +end diff --git a/db/post_migrate/20200506085748_update_undefined_confidence_from_occurrences.rb b/db/post_migrate/20200506085748_update_undefined_confidence_from_occurrences.rb new file mode 100644 index 00000000000..06c82ad404b --- /dev/null +++ b/db/post_migrate/20200506085748_update_undefined_confidence_from_occurrences.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +class UpdateUndefinedConfidenceFromOccurrences < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + INDEX_NAME = 'index_vulnerability_occurrences_on_id_and_confidence_eq_zero' + DOWNTIME = false + + disable_ddl_transaction! + BATCH_SIZE = 1_000 + INTERVAL = 2.minutes + + # 286_159 records to be updated on GitLab.com + def up + # create temporary index for undefined vulnerabilities + add_concurrent_index(:vulnerability_occurrences, :id, where: 'confidence = 0', name: INDEX_NAME) + + return unless Gitlab.ee? + + migration = Gitlab::BackgroundMigration::RemoveUndefinedOccurrenceConfidenceLevel + migration_name = migration.to_s.demodulize + relation = migration::Occurrence.undefined_confidence + queue_background_migration_jobs_by_range_at_intervals(relation, + migration_name, + INTERVAL, + batch_size: BATCH_SIZE) + end + + def down + # no-op + # temporary index is to be dropped in a different migration in an upcoming release + remove_concurrent_index(:vulnerability_occurrences, :id, where: 'confidence = 0', name: INDEX_NAME) + # This migration can not be reversed because we can not know which records had undefined confidence + end +end diff --git a/db/post_migrate/20200506125731_cleanup_user_highest_roles_population.rb b/db/post_migrate/20200506125731_cleanup_user_highest_roles_population.rb new file mode 100644 index 00000000000..5e613228c56 --- /dev/null +++ b/db/post_migrate/20200506125731_cleanup_user_highest_roles_population.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +class CleanupUserHighestRolesPopulation < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INDEX_NAME = 'index_for_migrating_user_highest_roles_table' + + disable_ddl_transaction! + + def up + Gitlab::BackgroundMigration.steal('PopulateUserHighestRolesTable') + + remove_concurrent_index(:users, :id, name: INDEX_NAME) + end + + def down + add_concurrent_index(:users, + :id, + where: "state = 'active' AND user_type IS NULL AND bot_type IS NULL AND ghost IS NOT TRUE", + name: INDEX_NAME) + end +end diff --git a/db/post_migrate/20200506154421_migrate_scim_identities_to_saml_for_new_users.rb b/db/post_migrate/20200506154421_migrate_scim_identities_to_saml_for_new_users.rb new file mode 100644 index 00000000000..718e788aad7 --- /dev/null +++ b/db/post_migrate/20200506154421_migrate_scim_identities_to_saml_for_new_users.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +class MigrateScimIdentitiesToSamlForNewUsers < ActiveRecord::Migration[6.0] + DOWNTIME = false + + class ScimIdentity < ActiveRecord::Base + self.table_name = 'scim_identities' + + belongs_to :user + + include ::EachBatch + end + + class Identity < ActiveRecord::Base + self.table_name = 'identities' + + belongs_to :saml_provider + end + + def up + users_with_saml_provider = Identity.select('user_id').joins(:saml_provider) + + ScimIdentity.each_batch do |relation| + identity_records = relation + .select("scim_identities.extern_uid, 'group_saml', scim_identities.user_id, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, saml_providers.id") + .joins(:user) + .joins('inner join saml_providers on saml_providers.group_id=scim_identities.group_id') + .where("date_trunc('second',scim_identities.created_at) at time zone 'UTC' = date_trunc('second',users.created_at)") + .where.not(user_id: users_with_saml_provider) + + execute "insert into identities (extern_uid, provider, user_id, created_at, updated_at, saml_provider_id) #{identity_records.to_sql} on conflict do nothing" + end + end + + def down + end +end diff --git a/db/post_migrate/20200508091106_remove_bot_type.rb b/db/post_migrate/20200508091106_remove_bot_type.rb new file mode 100644 index 00000000000..2afcf5308e7 --- /dev/null +++ b/db/post_migrate/20200508091106_remove_bot_type.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +class RemoveBotType < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + remove_concurrent_index_by_name :users, 'index_users_on_bot_type' + + with_lock_retries do + remove_column :users, :bot_type + end + end + + def down + unless column_exists?(:users, :bot_type) + with_lock_retries do + add_column :users, :bot_type, :integer, limit: 2 # rubocop:disable Migration/AddColumnsToWideTables + end + end + + execute 'UPDATE users set bot_type = user_type WHERE user_type IN(1,2,3,6)' + + add_concurrent_index :users, :bot_type + end +end diff --git a/db/post_migrate/20200511080113_add_projects_foreign_key_to_namespaces.rb b/db/post_migrate/20200511080113_add_projects_foreign_key_to_namespaces.rb new file mode 100644 index 00000000000..a7f67a3b5cd --- /dev/null +++ b/db/post_migrate/20200511080113_add_projects_foreign_key_to_namespaces.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +class AddProjectsForeignKeyToNamespaces < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + FK_NAME = 'fk_projects_namespace_id' + + def up + with_lock_retries do + add_foreign_key( + :projects, + :namespaces, + column: :namespace_id, + on_delete: :restrict, + validate: false, + name: FK_NAME + ) + end + end + + def down + with_lock_retries do + remove_foreign_key_if_exists :projects, column: :namespace_id, name: FK_NAME + end + end +end diff --git a/db/post_migrate/20200511083541_cleanup_projects_with_missing_namespace.rb b/db/post_migrate/20200511083541_cleanup_projects_with_missing_namespace.rb new file mode 100644 index 00000000000..442acfc6d16 --- /dev/null +++ b/db/post_migrate/20200511083541_cleanup_projects_with_missing_namespace.rb @@ -0,0 +1,263 @@ +# frozen_string_literal: true + +# rubocop:disable Migration/PreventStrings + +# This migration cleans up Projects that were orphaned when their namespace was deleted +# Instead of deleting them, we: +# - Find (or create) the Ghost User +# - Create (if not already exists) a `lost-and-found` group owned by the Ghost User +# - Find orphaned projects --> namespace_id can not be found in namespaces +# - Move the orphaned projects to the `lost-and-found` group +# (while making them private and setting `archived=true`) +# +# On GitLab.com (2020-05-11) this migration will update 66 orphaned projects +class CleanupProjectsWithMissingNamespace < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + VISIBILITY_PRIVATE = 0 + ACCESS_LEVEL_OWNER = 50 + + # The batch size of projects to check in each iteration + # We expect the selectivity for orphaned projects to be very low: + # (66 orphaned projects out of a total 13.6M) + # so 10K should be a safe choice + BATCH_SIZE = 10000 + + disable_ddl_transaction! + + class UserDetail < ActiveRecord::Base + self.table_name = 'user_details' + + belongs_to :user, class_name: 'CleanupProjectsWithMissingNamespace::User' + end + + class User < ActiveRecord::Base + self.table_name = 'users' + + LOST_AND_FOUND_GROUP = 'lost-and-found' + USER_TYPE_GHOST = 5 + DEFAULT_PROJECTS_LIMIT = 100000 + + default_value_for :admin, false + default_value_for :can_create_group, true # we need this to create the group + default_value_for :can_create_team, false + default_value_for :project_view, :files + default_value_for :notified_of_own_activity, false + default_value_for :preferred_language, I18n.default_locale + + has_one :user_detail, class_name: 'CleanupProjectsWithMissingNamespace::UserDetail' + has_one :namespace, -> { where(type: nil) }, + foreign_key: :owner_id, inverse_of: :owner, autosave: true, + class_name: 'CleanupProjectsWithMissingNamespace::Namespace' + + before_save :ensure_namespace_correct + before_save :ensure_bio_is_assigned_to_user_details, if: :bio_changed? + + enum project_view: { readme: 0, activity: 1, files: 2 } + + def ensure_namespace_correct + if namespace + namespace.path = username if username_changed? + namespace.name = name if name_changed? + else + build_namespace(path: username, name: name) + end + end + + def ensure_bio_is_assigned_to_user_details + return if Feature.disabled?(:migrate_bio_to_user_details, default_enabled: true) + + user_detail.bio = bio.to_s[0...255] + end + + def user_detail + super.presence || build_user_detail + end + + # Return (or create if necessary) the `lost-and-found` group + def lost_and_found_group + existing_lost_and_found_group || Group.create_unique_group(self, LOST_AND_FOUND_GROUP) + end + + def existing_lost_and_found_group + # There should only be one Group for User Ghost starting with LOST_AND_FOUND_GROUP + Group + .joins('INNER JOIN members ON namespaces.id = members.source_id') + .where('namespaces.type = ?', 'Group') + .where('members.type = ?', 'GroupMember') + .where('members.source_type = ?', 'Namespace') + .where('members.user_id = ?', self.id) + .where('members.requested_at IS NULL') + .where('members.access_level = ?', ACCESS_LEVEL_OWNER) + .find_by(Group.arel_table[:name].matches("#{LOST_AND_FOUND_GROUP}%")) + end + + class << self + # Return (or create if necessary) the ghost user + def ghost + email = 'ghost%s@example.com' + + unique_internal(where(user_type: USER_TYPE_GHOST), 'ghost', email) do |u| + u.bio = _('This is a "Ghost User", created to hold all issues authored by users that have since been deleted. This user cannot be removed.') + u.name = 'Ghost User' + end + end + + def unique_internal(scope, username, email_pattern, &block) + scope.first || create_unique_internal(scope, username, email_pattern, &block) + end + + def create_unique_internal(scope, username, email_pattern, &creation_block) + # Since we only want a single one of these in an instance, we use an + # exclusive lease to ensure that this block is never run concurrently. + lease_key = "user:unique_internal:#{username}" + lease = Gitlab::ExclusiveLease.new(lease_key, timeout: 1.minute.to_i) + + until uuid = lease.try_obtain + # Keep trying until we obtain the lease. To prevent hammering Redis too + # much we'll wait for a bit between retries. + sleep(1) + end + + # Recheck if the user is already present. One might have been + # added between the time we last checked (first line of this method) + # and the time we acquired the lock. + existing_user = uncached { scope.first } + return existing_user if existing_user.present? + + uniquify = Uniquify.new + + username = uniquify.string(username) { |s| User.find_by_username(s) } + + email = uniquify.string(-> (n) { Kernel.sprintf(email_pattern, n) }) do |s| + User.find_by_email(s) + end + + User.create!( + username: username, + email: email, + user_type: USER_TYPE_GHOST, + projects_limit: DEFAULT_PROJECTS_LIMIT, + state: :active, + &creation_block + ) + ensure + Gitlab::ExclusiveLease.cancel(lease_key, uuid) + end + end + end + + class Namespace < ActiveRecord::Base + self.table_name = 'namespaces' + + belongs_to :owner, class_name: 'CleanupProjectsWithMissingNamespace::User' + end + + class Group < Namespace + # Disable STI to allow us to manually set "type = 'Group'" + # Otherwise rails forces "type = CleanupProjectsWithMissingNamespace::Group" + self.inheritance_column = :_type_disabled + + def self.create_unique_group(user, group_name) + # 'lost-and-found' may be already defined, find a unique one + group_name = Uniquify.new.string(group_name) do |str| + Group.where(parent_id: nil, name: str).exists? + end + + group = Group.create!( + name: group_name, + path: group_name, + type: 'Group', + description: 'Group to store orphaned projects', + visibility_level: VISIBILITY_PRIVATE + ) + + # No need to create a route for the lost-and-found group + + GroupMember.add_user(group, user, ACCESS_LEVEL_OWNER) + + group + end + end + + class Member < ActiveRecord::Base + self.table_name = 'members' + end + + class GroupMember < Member + NOTIFICATION_SETTING_GLOBAL = 3 + + # Disable STI to allow us to manually set "type = 'GroupMember'" + # Otherwise rails forces "type = CleanupProjectsWithMissingNamespace::GroupMember" + self.inheritance_column = :_type_disabled + + def self.add_user(source, user, access_level) + GroupMember.create!( + type: 'GroupMember', + source_id: source.id, + user_id: user.id, + source_type: 'Namespace', + access_level: access_level, + notification_level: NOTIFICATION_SETTING_GLOBAL + ) + end + end + + class Project < ActiveRecord::Base + self.table_name = 'projects' + + include ::EachBatch + + def self.without_namespace + where( + 'NOT EXISTS ( + SELECT 1 + FROM namespaces + WHERE projects.namespace_id = namespaces.id + )' + ) + end + end + + def up + # Reset the column information of all the models that update the database + # to ensure the Active Record's knowledge of the table structure is current + User.reset_column_information + Namespace.reset_column_information + Member.reset_column_information + Project.reset_column_information + + # Find or Create the ghost user + ghost_user = User.ghost + + # Find or Create the `lost-and-found` + lost_and_found = ghost_user.lost_and_found_group + + # With BATCH_SIZE=10K and projects.count=13.6M + # ~1360 iterations will be run: + # - each requires on average ~160ms for relation.without_namespace + # - worst case scenario is that 66 of those batches will trigger an update (~200ms each) + # In general, we expect less than 5% (=66/13.6M x 10K) to trigger an update + # Expected total run time: ~235 seconds (== 220 seconds + 14 seconds) + Project.each_batch(of: BATCH_SIZE) do |relation| + relation.without_namespace.update_all <<~SQL + namespace_id = #{lost_and_found.id}, + archived = TRUE, + visibility_level = #{VISIBILITY_PRIVATE}, + + -- Names are expected to be unique inside their namespace + -- (uniqueness validation on namespace_id, name) + -- Attach the id to the name and path to make sure that they are unique + name = name || '_' || id, + path = path || '_' || id + SQL + end + end + + def down + # no-op: the original state for those projects was inconsistent + # Also, the original namespace_id for each project is lost during the update + end +end +# rubocop:enable Migration/PreventStrings diff --git a/db/post_migrate/20200511092714_update_undefined_confidence_from_vulnerabilities.rb b/db/post_migrate/20200511092714_update_undefined_confidence_from_vulnerabilities.rb new file mode 100644 index 00000000000..d6611ddbd66 --- /dev/null +++ b/db/post_migrate/20200511092714_update_undefined_confidence_from_vulnerabilities.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +class UpdateUndefinedConfidenceFromVulnerabilities < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + INDEX_NAME = 'index_vulnerability_on_id_and_confidence_eq_zero' + DOWNTIME = false + + disable_ddl_transaction! + BATCH_SIZE = 1_000 + INTERVAL = 2.minutes + + # 87_602 records to be updated on GitLab.com + def up + # create temporary index for undefined vulnerabilities + add_concurrent_index(:vulnerabilities, :id, where: 'confidence = 0', name: INDEX_NAME) + + return unless Gitlab.ee? + + migration = Gitlab::BackgroundMigration::RemoveUndefinedVulnerabilityConfidenceLevel + migration_name = migration.to_s.demodulize + relation = migration::Vulnerability.undefined_confidence + queue_background_migration_jobs_by_range_at_intervals(relation, + migration_name, + INTERVAL, + batch_size: BATCH_SIZE) + end + + def down + # no-op + # temporary index is to be dropped in a different migration in an upcoming release + remove_concurrent_index(:vulnerabilities, :id, where: 'confidence = 0', name: INDEX_NAME) + # This migration can not be reversed because we can not know which records had undefined confidence + end +end diff --git a/db/post_migrate/20200511130130_ensure_deprecated_jenkins_service_records_removal.rb b/db/post_migrate/20200511130130_ensure_deprecated_jenkins_service_records_removal.rb new file mode 100644 index 00000000000..4c1f29f8e47 --- /dev/null +++ b/db/post_migrate/20200511130130_ensure_deprecated_jenkins_service_records_removal.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class EnsureDeprecatedJenkinsServiceRecordsRemoval < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def up + execute <<~SQL.strip + DELETE FROM services WHERE type = 'JenkinsDeprecatedService'; + SQL + end + + def down + # no-op + + # The records were removed by `up` + end +end diff --git a/db/post_migrate/20200511145545_change_variable_interpolation_format_in_common_metrics.rb b/db/post_migrate/20200511145545_change_variable_interpolation_format_in_common_metrics.rb new file mode 100644 index 00000000000..ac3c545350d --- /dev/null +++ b/db/post_migrate/20200511145545_change_variable_interpolation_format_in_common_metrics.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class ChangeVariableInterpolationFormatInCommonMetrics < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def up + ::Gitlab::DatabaseImporters::CommonMetrics::Importer.new.execute + end + + def down + # no-op + # The import cannot be reversed since we do not know the state that the + # common metrics in the PrometheusMetric table were in before the import. + end +end diff --git a/db/post_migrate/20200511220023_validate_projects_foreign_key_to_namespaces.rb b/db/post_migrate/20200511220023_validate_projects_foreign_key_to_namespaces.rb new file mode 100644 index 00000000000..37a761507fc --- /dev/null +++ b/db/post_migrate/20200511220023_validate_projects_foreign_key_to_namespaces.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class ValidateProjectsForeignKeyToNamespaces < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + FK_NAME = 'fk_projects_namespace_id' + + def up + # Validate the FK added with 20200511080113_add_projects_foreign_key_to_namespaces.rb + validate_foreign_key :projects, :namespace_id, name: FK_NAME + end + + def down + # no-op: No need to invalidate the foreign key + # The inconsistent data are permanently fixed with the data migration + # `20200511083541_cleanup_projects_with_missing_namespace.rb` + # even if it is rolled back. + # If there is an issue with the FK, we'll roll back the migration that adds the FK + end +end diff --git a/db/post_migrate/20200513171959_enable_hashed_storage.rb b/db/post_migrate/20200513171959_enable_hashed_storage.rb new file mode 100644 index 00000000000..53e52b1caff --- /dev/null +++ b/db/post_migrate/20200513171959_enable_hashed_storage.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class EnableHashedStorage < ActiveRecord::Migration[6.0] + DOWNTIME = false + + class ApplicationSetting < ActiveRecord::Base + self.table_name = 'application_settings' + end + + def up + ApplicationSetting.update_all(hashed_storage_enabled: true) + end + + def down + # in 13.0 we are forcing hashed storage to always be enabled for new projects + end +end diff --git a/db/post_migrate/20200514000009_add_not_null_constraint_on_file_store_to_lfs_objects.rb b/db/post_migrate/20200514000009_add_not_null_constraint_on_file_store_to_lfs_objects.rb new file mode 100644 index 00000000000..6b3b9a3155d --- /dev/null +++ b/db/post_migrate/20200514000009_add_not_null_constraint_on_file_store_to_lfs_objects.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddNotNullConstraintOnFileStoreToLfsObjects < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_not_null_constraint(:lfs_objects, :file_store, validate: false) + end + + def down + remove_not_null_constraint(:lfs_objects, :file_store) + end +end diff --git a/db/post_migrate/20200514000132_add_not_null_constraint_on_store_to_uploads.rb b/db/post_migrate/20200514000132_add_not_null_constraint_on_store_to_uploads.rb new file mode 100644 index 00000000000..c5f1cfa79b8 --- /dev/null +++ b/db/post_migrate/20200514000132_add_not_null_constraint_on_store_to_uploads.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddNotNullConstraintOnStoreToUploads < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_not_null_constraint(:uploads, :store, validate: false) + end + + def down + remove_not_null_constraint(:uploads, :store) + end +end diff --git a/db/post_migrate/20200514000340_add_not_null_constraint_on_file_store_to_ci_jobs_artifacts.rb b/db/post_migrate/20200514000340_add_not_null_constraint_on_file_store_to_ci_jobs_artifacts.rb new file mode 100644 index 00000000000..5759803e3b7 --- /dev/null +++ b/db/post_migrate/20200514000340_add_not_null_constraint_on_file_store_to_ci_jobs_artifacts.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddNotNullConstraintOnFileStoreToCiJobsArtifacts < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_not_null_constraint(:ci_job_artifacts, :file_store, validate: false) + end + + def down + remove_not_null_constraint(:ci_job_artifacts, :file_store) + end +end diff --git a/db/structure.sql b/db/structure.sql index 1f0f401165e..38a8f98a1f3 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -24,6 +24,40 @@ CREATE SEQUENCE public.abuse_reports_id_seq ALTER SEQUENCE public.abuse_reports_id_seq OWNED BY public.abuse_reports.id; +CREATE TABLE public.alert_management_alerts ( + id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + started_at timestamp with time zone NOT NULL, + ended_at timestamp with time zone, + events integer DEFAULT 1 NOT NULL, + iid integer NOT NULL, + severity smallint DEFAULT 0 NOT NULL, + status smallint DEFAULT 0 NOT NULL, + fingerprint bytea, + issue_id bigint, + project_id bigint NOT NULL, + title text NOT NULL, + description text, + service text, + monitoring_tool text, + hosts text[] DEFAULT '{}'::text[] NOT NULL, + payload jsonb DEFAULT '{}'::jsonb NOT NULL, + CONSTRAINT check_2df3e2fdc1 CHECK ((char_length(monitoring_tool) <= 100)), + CONSTRAINT check_5e9e57cadb CHECK ((char_length(description) <= 1000)), + CONSTRAINT check_bac14dddde CHECK ((char_length(service) <= 100)), + CONSTRAINT check_d1d1c2d14c CHECK ((char_length(title) <= 200)) +); + +CREATE SEQUENCE public.alert_management_alerts_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE public.alert_management_alerts_id_seq OWNED BY public.alert_management_alerts.id; + CREATE TABLE public.alerts_service_data ( id bigint NOT NULL, service_id integer NOT NULL, @@ -137,7 +171,10 @@ CREATE TABLE public.appearances ( message_background_color text, message_font_color text, favicon character varying, - email_header_and_footer_enabled boolean DEFAULT false NOT NULL + email_header_and_footer_enabled boolean DEFAULT false NOT NULL, + profile_image_guidelines text, + profile_image_guidelines_html text, + CONSTRAINT appearances_profile_image_guidelines CHECK ((char_length(profile_image_guidelines) <= 4096)) ); CREATE SEQUENCE public.appearances_id_seq @@ -251,7 +288,6 @@ CREATE TABLE public.application_settings ( geo_status_timeout integer DEFAULT 10, uuid character varying, polling_interval_multiplier numeric DEFAULT 1.0 NOT NULL, - elasticsearch_experimental_indexer boolean, cached_markdown_version integer, check_namespace_plan boolean DEFAULT false NOT NULL, mirror_max_delay integer DEFAULT 300 NOT NULL, @@ -312,7 +348,7 @@ CREATE TABLE public.application_settings ( diff_max_patch_bytes integer DEFAULT 102400 NOT NULL, archive_builds_in_seconds integer, commit_email_hostname character varying, - protected_ci_variables boolean DEFAULT false NOT NULL, + protected_ci_variables boolean DEFAULT true NOT NULL, runners_registration_token_encrypted character varying, local_markdown_version integer DEFAULT 0 NOT NULL, first_day_of_week integer DEFAULT 0 NOT NULL, @@ -401,7 +437,12 @@ CREATE TABLE public.application_settings ( container_expiration_policies_enable_historic_entries boolean DEFAULT false NOT NULL, issues_create_limit integer DEFAULT 300 NOT NULL, push_rule_id bigint, - group_owners_can_manage_default_branch_protection boolean DEFAULT true NOT NULL + group_owners_can_manage_default_branch_protection boolean DEFAULT true NOT NULL, + container_registry_vendor text DEFAULT ''::text NOT NULL, + container_registry_version text DEFAULT ''::text NOT NULL, + container_registry_features text[] DEFAULT '{}'::text[] NOT NULL, + CONSTRAINT check_d03919528d CHECK ((char_length(container_registry_vendor) <= 255)), + CONSTRAINT check_e5aba18f02 CHECK ((char_length(container_registry_version) <= 255)) ); CREATE SEQUENCE public.application_settings_id_seq @@ -437,7 +478,9 @@ CREATE TABLE public.approval_merge_request_rules ( code_owner boolean DEFAULT false NOT NULL, name character varying NOT NULL, rule_type smallint DEFAULT 1 NOT NULL, - report_type smallint + report_type smallint, + section text, + CONSTRAINT check_6fca5928b2 CHECK ((char_length(section) <= 255)) ); CREATE TABLE public.approval_merge_request_rules_approved_approvers ( @@ -988,6 +1031,25 @@ CREATE SEQUENCE public.ci_builds_runner_session_id_seq ALTER SEQUENCE public.ci_builds_runner_session_id_seq OWNED BY public.ci_builds_runner_session.id; +CREATE TABLE public.ci_daily_build_group_report_results ( + id bigint NOT NULL, + date date NOT NULL, + project_id bigint NOT NULL, + last_pipeline_id bigint NOT NULL, + ref_path text NOT NULL, + group_name text NOT NULL, + data jsonb NOT NULL +); + +CREATE SEQUENCE public.ci_daily_build_group_report_results_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE public.ci_daily_build_group_report_results_id_seq OWNED BY public.ci_daily_build_group_report_results.id; + CREATE TABLE public.ci_daily_report_results ( id bigint NOT NULL, date date NOT NULL, @@ -1008,6 +1070,25 @@ CREATE SEQUENCE public.ci_daily_report_results_id_seq ALTER SEQUENCE public.ci_daily_report_results_id_seq OWNED BY public.ci_daily_report_results.id; +CREATE TABLE public.ci_freeze_periods ( + id bigint NOT NULL, + project_id bigint NOT NULL, + freeze_start character varying(998) NOT NULL, + freeze_end character varying(998) NOT NULL, + cron_timezone character varying(255) NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL +); + +CREATE SEQUENCE public.ci_freeze_periods_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE public.ci_freeze_periods_id_seq OWNED BY public.ci_freeze_periods.id; + CREATE TABLE public.ci_group_variables ( id integer NOT NULL, key character varying NOT NULL, @@ -1032,6 +1113,28 @@ CREATE SEQUENCE public.ci_group_variables_id_seq ALTER SEQUENCE public.ci_group_variables_id_seq OWNED BY public.ci_group_variables.id; +CREATE TABLE public.ci_instance_variables ( + id bigint NOT NULL, + variable_type smallint DEFAULT 1 NOT NULL, + masked boolean DEFAULT false, + protected boolean DEFAULT false, + key text NOT NULL, + encrypted_value text, + encrypted_value_iv text, + CONSTRAINT check_07a45a5bcb CHECK ((char_length(encrypted_value_iv) <= 255)), + CONSTRAINT check_5aede12208 CHECK ((char_length(key) <= 255)), + CONSTRAINT check_5ebd0515a0 CHECK ((char_length(encrypted_value) <= 1024)) +); + +CREATE SEQUENCE public.ci_instance_variables_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE public.ci_instance_variables_id_seq OWNED BY public.ci_instance_variables.id; + CREATE TABLE public.ci_job_artifacts ( id integer NOT NULL, project_id integer NOT NULL, @@ -1042,10 +1145,11 @@ CREATE TABLE public.ci_job_artifacts ( updated_at timestamp with time zone NOT NULL, expire_at timestamp with time zone, file character varying, - file_store integer, + file_store integer DEFAULT 1, file_sha256 bytea, file_format smallint, - file_location smallint + file_location smallint, + locked boolean ); CREATE SEQUENCE public.ci_job_artifacts_id_seq @@ -1663,7 +1767,9 @@ CREATE TABLE public.clusters_applications_fluentd ( updated_at timestamp with time zone NOT NULL, version character varying(255) NOT NULL, host character varying(255) NOT NULL, - status_reason text + status_reason text, + waf_log_enabled boolean DEFAULT true NOT NULL, + cilium_log_enabled boolean DEFAULT true NOT NULL ); CREATE SEQUENCE public.clusters_applications_fluentd_id_seq @@ -2003,7 +2109,9 @@ CREATE TABLE public.deploy_tokens ( username character varying, token_encrypted character varying(255), deploy_token_type smallint DEFAULT 2 NOT NULL, - write_registry boolean DEFAULT false NOT NULL + write_registry boolean DEFAULT false NOT NULL, + read_package_registry boolean DEFAULT false NOT NULL, + write_package_registry boolean DEFAULT false NOT NULL ); CREATE SEQUENCE public.deploy_tokens_id_seq @@ -3040,6 +3148,33 @@ CREATE SEQUENCE public.group_group_links_id_seq ALTER SEQUENCE public.group_group_links_id_seq OWNED BY public.group_group_links.id; +CREATE TABLE public.group_import_states ( + group_id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + status smallint DEFAULT 0 NOT NULL, + jid text NOT NULL, + last_error text, + CONSTRAINT check_87b58f6b30 CHECK ((char_length(last_error) <= 255)), + CONSTRAINT check_96558fff96 CHECK ((char_length(jid) <= 100)) +); + +CREATE SEQUENCE public.group_import_states_group_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE public.group_import_states_group_id_seq OWNED BY public.group_import_states.group_id; + +CREATE TABLE public.group_wiki_repositories ( + shard_id bigint NOT NULL, + group_id bigint NOT NULL, + disk_path text NOT NULL, + CONSTRAINT check_07f1c81806 CHECK ((char_length(disk_path) <= 80)) +); + CREATE TABLE public.historical_data ( id integer NOT NULL, date date NOT NULL, @@ -3299,7 +3434,8 @@ CREATE TABLE public.issues ( duplicated_to_id integer, promoted_to_epic_id integer, health_status smallint, - external_key character varying(255) + external_key character varying(255), + sprint_id bigint ); CREATE SEQUENCE public.issues_id_seq @@ -3374,7 +3510,8 @@ CREATE TABLE public.jira_imports ( status smallint DEFAULT 0 NOT NULL, jid character varying(255), jira_project_key character varying(255) NOT NULL, - jira_project_name character varying(255) NOT NULL + jira_project_name character varying(255) NOT NULL, + scheduled_at timestamp with time zone ); CREATE SEQUENCE public.jira_imports_id_seq @@ -3539,7 +3676,7 @@ CREATE TABLE public.lfs_objects ( created_at timestamp without time zone, updated_at timestamp without time zone, file character varying, - file_store integer + file_store integer DEFAULT 1 ); CREATE SEQUENCE public.lfs_objects_id_seq @@ -3874,7 +4011,8 @@ CREATE TABLE public.merge_requests ( allow_maintainer_to_push boolean, state_id smallint DEFAULT 1 NOT NULL, rebase_jid character varying, - squash_commit_sha bytea + squash_commit_sha bytea, + sprint_id bigint ); CREATE TABLE public.merge_requests_closing_issues ( @@ -3946,6 +4084,25 @@ CREATE SEQUENCE public.metrics_dashboard_annotations_id_seq ALTER SEQUENCE public.metrics_dashboard_annotations_id_seq OWNED BY public.metrics_dashboard_annotations.id; +CREATE TABLE public.metrics_users_starred_dashboards ( + id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + project_id bigint NOT NULL, + user_id bigint NOT NULL, + dashboard_path text NOT NULL, + CONSTRAINT check_79a84a0f57 CHECK ((char_length(dashboard_path) <= 255)) +); + +CREATE SEQUENCE public.metrics_users_starred_dashboards_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE public.metrics_users_starred_dashboards_id_seq OWNED BY public.metrics_users_starred_dashboards.id; + CREATE TABLE public.milestone_releases ( milestone_id bigint NOT NULL, release_id bigint NOT NULL @@ -4035,7 +4192,6 @@ CREATE TABLE public.namespaces ( require_two_factor_authentication boolean DEFAULT false NOT NULL, two_factor_grace_period integer DEFAULT 48 NOT NULL, cached_markdown_version integer, - plan_id integer, project_creation_level integer, runners_token character varying, trial_ends_on timestamp with time zone, @@ -4355,6 +4511,21 @@ CREATE SEQUENCE public.operations_strategies_id_seq ALTER SEQUENCE public.operations_strategies_id_seq OWNED BY public.operations_strategies.id; +CREATE TABLE public.operations_strategies_user_lists ( + id bigint NOT NULL, + strategy_id bigint NOT NULL, + user_list_id bigint NOT NULL +); + +CREATE SEQUENCE public.operations_strategies_user_lists_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE public.operations_strategies_user_lists_id_seq OWNED BY public.operations_strategies_user_lists.id; + CREATE TABLE public.operations_user_lists ( id bigint NOT NULL, project_id bigint NOT NULL, @@ -4478,6 +4649,22 @@ CREATE SEQUENCE public.packages_maven_metadata_id_seq ALTER SEQUENCE public.packages_maven_metadata_id_seq OWNED BY public.packages_maven_metadata.id; +CREATE TABLE public.packages_nuget_dependency_link_metadata ( + dependency_link_id bigint NOT NULL, + target_framework text NOT NULL, + CONSTRAINT packages_nuget_dependency_link_metadata_target_framework_constr CHECK ((char_length(target_framework) <= 255)) +); + +CREATE TABLE public.packages_nuget_metadata ( + package_id bigint NOT NULL, + license_url text, + project_url text, + icon_url text, + CONSTRAINT packages_nuget_metadata_icon_url_constraint CHECK ((char_length(icon_url) <= 255)), + CONSTRAINT packages_nuget_metadata_license_url_constraint CHECK ((char_length(license_url) <= 255)), + CONSTRAINT packages_nuget_metadata_project_url_constraint CHECK ((char_length(project_url) <= 255)) +); + CREATE TABLE public.packages_package_files ( id bigint NOT NULL, package_id bigint NOT NULL, @@ -4492,9 +4679,9 @@ CREATE TABLE public.packages_package_files ( file_sha256 bytea, verification_retry_at timestamp with time zone, verified_at timestamp with time zone, - verification_checksum character varying(255), verification_failure character varying(255), - verification_retry_count integer + verification_retry_count integer, + verification_checksum bytea ); CREATE SEQUENCE public.packages_package_files_id_seq @@ -4600,6 +4787,28 @@ CREATE SEQUENCE public.pages_domains_id_seq ALTER SEQUENCE public.pages_domains_id_seq OWNED BY public.pages_domains.id; +CREATE TABLE public.partitioned_foreign_keys ( + id bigint NOT NULL, + cascade_delete boolean DEFAULT true NOT NULL, + from_table text NOT NULL, + from_column text NOT NULL, + to_table text NOT NULL, + to_column text NOT NULL, + CONSTRAINT check_2c2e02a62b CHECK ((char_length(from_column) <= 63)), + CONSTRAINT check_40738efb57 CHECK ((char_length(to_table) <= 63)), + CONSTRAINT check_741676d405 CHECK ((char_length(from_table) <= 63)), + CONSTRAINT check_7e98be694f CHECK ((char_length(to_column) <= 63)) +); + +CREATE SEQUENCE public.partitioned_foreign_keys_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE public.partitioned_foreign_keys_id_seq OWNED BY public.partitioned_foreign_keys.id; + CREATE TABLE public.path_locks ( id integer NOT NULL, path character varying NOT NULL, @@ -4651,7 +4860,8 @@ CREATE TABLE public.plan_limits ( project_hooks integer DEFAULT 100 NOT NULL, group_hooks integer DEFAULT 50 NOT NULL, ci_project_subscriptions integer DEFAULT 2 NOT NULL, - ci_pipeline_schedules integer DEFAULT 10 NOT NULL + ci_pipeline_schedules integer DEFAULT 10 NOT NULL, + offset_pagination_limit integer DEFAULT 50000 NOT NULL ); CREATE SEQUENCE public.plan_limits_id_seq @@ -5028,11 +5238,34 @@ CREATE SEQUENCE public.project_repository_states_id_seq ALTER SEQUENCE public.project_repository_states_id_seq OWNED BY public.project_repository_states.id; +CREATE TABLE public.project_repository_storage_moves ( + id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + project_id bigint NOT NULL, + state smallint DEFAULT 1 NOT NULL, + source_storage_name text NOT NULL, + destination_storage_name text NOT NULL, + CONSTRAINT project_repository_storage_moves_destination_storage_name CHECK ((char_length(destination_storage_name) <= 255)), + CONSTRAINT project_repository_storage_moves_source_storage_name CHECK ((char_length(source_storage_name) <= 255)) +); + +CREATE SEQUENCE public.project_repository_storage_moves_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE public.project_repository_storage_moves_id_seq OWNED BY public.project_repository_storage_moves.id; + CREATE TABLE public.project_settings ( project_id integer NOT NULL, created_at timestamp with time zone NOT NULL, updated_at timestamp with time zone NOT NULL, - push_rule_id bigint + push_rule_id bigint, + show_default_award_emojis boolean DEFAULT true, + CONSTRAINT check_bde223416c CHECK ((show_default_award_emojis IS NOT NULL)) ); CREATE TABLE public.project_statistics ( @@ -5571,9 +5804,6 @@ CREATE TABLE public.resource_milestone_events ( milestone_id bigint, action smallint NOT NULL, state smallint NOT NULL, - cached_markdown_version integer, - reference text, - reference_html text, created_at timestamp with time zone NOT NULL ); @@ -5586,6 +5816,26 @@ CREATE SEQUENCE public.resource_milestone_events_id_seq ALTER SEQUENCE public.resource_milestone_events_id_seq OWNED BY public.resource_milestone_events.id; +CREATE TABLE public.resource_state_events ( + id bigint NOT NULL, + user_id bigint NOT NULL, + issue_id bigint, + merge_request_id bigint, + created_at timestamp with time zone NOT NULL, + state smallint NOT NULL, + epic_id integer, + CONSTRAINT resource_state_events_must_belong_to_issue_or_merge_request CHECK ((((issue_id <> NULL::bigint) AND (merge_request_id IS NULL)) OR ((merge_request_id <> NULL::bigint) AND (issue_id IS NULL)))) +); + +CREATE SEQUENCE public.resource_state_events_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE public.resource_state_events_id_seq OWNED BY public.resource_state_events.id; + CREATE TABLE public.resource_weight_events ( id bigint NOT NULL, user_id bigint NOT NULL, @@ -5821,7 +6071,9 @@ CREATE TABLE public.services ( description character varying(500), comment_on_event_enabled boolean DEFAULT true NOT NULL, template boolean DEFAULT false, - instance boolean DEFAULT false NOT NULL + instance boolean DEFAULT false NOT NULL, + comment_detail smallint, + inherit_from_id bigint ); CREATE SEQUENCE public.services_id_seq @@ -5994,6 +6246,50 @@ CREATE SEQUENCE public.spam_logs_id_seq ALTER SEQUENCE public.spam_logs_id_seq OWNED BY public.spam_logs.id; +CREATE TABLE public.sprints ( + id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + start_date date, + due_date date, + project_id bigint, + group_id bigint, + iid integer NOT NULL, + cached_markdown_version integer, + title text NOT NULL, + title_html text, + description text, + description_html text, + state_enum smallint DEFAULT 1 NOT NULL, + CONSTRAINT sprints_must_belong_to_project_or_group CHECK ((((project_id <> NULL::bigint) AND (group_id IS NULL)) OR ((group_id <> NULL::bigint) AND (project_id IS NULL)))), + CONSTRAINT sprints_title CHECK ((char_length(title) <= 255)) +); + +CREATE SEQUENCE public.sprints_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE public.sprints_id_seq OWNED BY public.sprints.id; + +CREATE TABLE public.status_page_published_incidents ( + id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + issue_id bigint NOT NULL +); + +CREATE SEQUENCE public.status_page_published_incidents_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE public.status_page_published_incidents_id_seq OWNED BY public.status_page_published_incidents.id; + CREATE TABLE public.status_page_settings ( project_id bigint NOT NULL, created_at timestamp with time zone NOT NULL, @@ -6243,7 +6539,7 @@ CREATE TABLE public.uploads ( model_type character varying, uploader character varying NOT NULL, created_at timestamp without time zone NOT NULL, - store integer, + store integer DEFAULT 1, mount_point character varying, secret character varying ); @@ -6504,7 +6800,6 @@ CREATE TABLE public.users ( commit_email character varying, group_view integer, managing_group_id integer, - bot_type smallint, first_name character varying(255), last_name character varying(255), static_object_token character varying(255), @@ -6634,10 +6929,11 @@ CREATE TABLE public.vulnerability_exports ( finished_at timestamp with time zone, status character varying(255) NOT NULL, file character varying(255), - project_id bigint NOT NULL, + project_id bigint, author_id bigint NOT NULL, file_store integer, - format smallint DEFAULT 0 NOT NULL + format smallint DEFAULT 0 NOT NULL, + group_id integer ); CREATE SEQUENCE public.vulnerability_exports_id_seq @@ -6987,6 +7283,8 @@ ALTER SEQUENCE public.zoom_meetings_id_seq OWNED BY public.zoom_meetings.id; ALTER TABLE ONLY public.abuse_reports ALTER COLUMN id SET DEFAULT nextval('public.abuse_reports_id_seq'::regclass); +ALTER TABLE ONLY public.alert_management_alerts ALTER COLUMN id SET DEFAULT nextval('public.alert_management_alerts_id_seq'::regclass); + ALTER TABLE ONLY public.alerts_service_data ALTER COLUMN id SET DEFAULT nextval('public.alerts_service_data_id_seq'::regclass); ALTER TABLE ONLY public.allowed_email_domains ALTER COLUMN id SET DEFAULT nextval('public.allowed_email_domains_id_seq'::regclass); @@ -7057,10 +7355,16 @@ ALTER TABLE ONLY public.ci_builds_metadata ALTER COLUMN id SET DEFAULT nextval(' ALTER TABLE ONLY public.ci_builds_runner_session ALTER COLUMN id SET DEFAULT nextval('public.ci_builds_runner_session_id_seq'::regclass); +ALTER TABLE ONLY public.ci_daily_build_group_report_results ALTER COLUMN id SET DEFAULT nextval('public.ci_daily_build_group_report_results_id_seq'::regclass); + ALTER TABLE ONLY public.ci_daily_report_results ALTER COLUMN id SET DEFAULT nextval('public.ci_daily_report_results_id_seq'::regclass); +ALTER TABLE ONLY public.ci_freeze_periods ALTER COLUMN id SET DEFAULT nextval('public.ci_freeze_periods_id_seq'::regclass); + ALTER TABLE ONLY public.ci_group_variables ALTER COLUMN id SET DEFAULT nextval('public.ci_group_variables_id_seq'::regclass); +ALTER TABLE ONLY public.ci_instance_variables ALTER COLUMN id SET DEFAULT nextval('public.ci_instance_variables_id_seq'::regclass); + ALTER TABLE ONLY public.ci_job_artifacts ALTER COLUMN id SET DEFAULT nextval('public.ci_job_artifacts_id_seq'::regclass); ALTER TABLE ONLY public.ci_job_variables ALTER COLUMN id SET DEFAULT nextval('public.ci_job_variables_id_seq'::regclass); @@ -7247,6 +7551,8 @@ ALTER TABLE ONLY public.group_deploy_tokens ALTER COLUMN id SET DEFAULT nextval( ALTER TABLE ONLY public.group_group_links ALTER COLUMN id SET DEFAULT nextval('public.group_group_links_id_seq'::regclass); +ALTER TABLE ONLY public.group_import_states ALTER COLUMN group_id SET DEFAULT nextval('public.group_import_states_group_id_seq'::regclass); + ALTER TABLE ONLY public.historical_data ALTER COLUMN id SET DEFAULT nextval('public.historical_data_id_seq'::regclass); ALTER TABLE ONLY public.identities ALTER COLUMN id SET DEFAULT nextval('public.identities_id_seq'::regclass); @@ -7325,6 +7631,8 @@ ALTER TABLE ONLY public.merge_trains ALTER COLUMN id SET DEFAULT nextval('public ALTER TABLE ONLY public.metrics_dashboard_annotations ALTER COLUMN id SET DEFAULT nextval('public.metrics_dashboard_annotations_id_seq'::regclass); +ALTER TABLE ONLY public.metrics_users_starred_dashboards ALTER COLUMN id SET DEFAULT nextval('public.metrics_users_starred_dashboards_id_seq'::regclass); + ALTER TABLE ONLY public.milestones ALTER COLUMN id SET DEFAULT nextval('public.milestones_id_seq'::regclass); ALTER TABLE ONLY public.namespace_statistics ALTER COLUMN id SET DEFAULT nextval('public.namespace_statistics_id_seq'::regclass); @@ -7357,6 +7665,8 @@ ALTER TABLE ONLY public.operations_scopes ALTER COLUMN id SET DEFAULT nextval('p ALTER TABLE ONLY public.operations_strategies ALTER COLUMN id SET DEFAULT nextval('public.operations_strategies_id_seq'::regclass); +ALTER TABLE ONLY public.operations_strategies_user_lists ALTER COLUMN id SET DEFAULT nextval('public.operations_strategies_user_lists_id_seq'::regclass); + ALTER TABLE ONLY public.operations_user_lists ALTER COLUMN id SET DEFAULT nextval('public.operations_user_lists_id_seq'::regclass); ALTER TABLE ONLY public.packages_build_infos ALTER COLUMN id SET DEFAULT nextval('public.packages_build_infos_id_seq'::regclass); @@ -7381,6 +7691,8 @@ ALTER TABLE ONLY public.pages_domain_acme_orders ALTER COLUMN id SET DEFAULT nex ALTER TABLE ONLY public.pages_domains ALTER COLUMN id SET DEFAULT nextval('public.pages_domains_id_seq'::regclass); +ALTER TABLE ONLY public.partitioned_foreign_keys ALTER COLUMN id SET DEFAULT nextval('public.partitioned_foreign_keys_id_seq'::regclass); + ALTER TABLE ONLY public.path_locks ALTER COLUMN id SET DEFAULT nextval('public.path_locks_id_seq'::regclass); ALTER TABLE ONLY public.personal_access_tokens ALTER COLUMN id SET DEFAULT nextval('public.personal_access_tokens_id_seq'::regclass); @@ -7423,6 +7735,8 @@ ALTER TABLE ONLY public.project_repositories ALTER COLUMN id SET DEFAULT nextval ALTER TABLE ONLY public.project_repository_states ALTER COLUMN id SET DEFAULT nextval('public.project_repository_states_id_seq'::regclass); +ALTER TABLE ONLY public.project_repository_storage_moves ALTER COLUMN id SET DEFAULT nextval('public.project_repository_storage_moves_id_seq'::regclass); + ALTER TABLE ONLY public.project_statistics ALTER COLUMN id SET DEFAULT nextval('public.project_statistics_id_seq'::regclass); ALTER TABLE ONLY public.project_tracing_settings ALTER COLUMN id SET DEFAULT nextval('public.project_tracing_settings_id_seq'::regclass); @@ -7467,6 +7781,8 @@ ALTER TABLE ONLY public.resource_label_events ALTER COLUMN id SET DEFAULT nextva ALTER TABLE ONLY public.resource_milestone_events ALTER COLUMN id SET DEFAULT nextval('public.resource_milestone_events_id_seq'::regclass); +ALTER TABLE ONLY public.resource_state_events ALTER COLUMN id SET DEFAULT nextval('public.resource_state_events_id_seq'::regclass); + ALTER TABLE ONLY public.resource_weight_events ALTER COLUMN id SET DEFAULT nextval('public.resource_weight_events_id_seq'::regclass); ALTER TABLE ONLY public.reviews ALTER COLUMN id SET DEFAULT nextval('public.reviews_id_seq'::regclass); @@ -7505,6 +7821,10 @@ ALTER TABLE ONLY public.software_licenses ALTER COLUMN id SET DEFAULT nextval('p ALTER TABLE ONLY public.spam_logs ALTER COLUMN id SET DEFAULT nextval('public.spam_logs_id_seq'::regclass); +ALTER TABLE ONLY public.sprints ALTER COLUMN id SET DEFAULT nextval('public.sprints_id_seq'::regclass); + +ALTER TABLE ONLY public.status_page_published_incidents ALTER COLUMN id SET DEFAULT nextval('public.status_page_published_incidents_id_seq'::regclass); + ALTER TABLE ONLY public.status_page_settings ALTER COLUMN project_id SET DEFAULT nextval('public.status_page_settings_project_id_seq'::regclass); ALTER TABLE ONLY public.subscriptions ALTER COLUMN id SET DEFAULT nextval('public.subscriptions_id_seq'::regclass); @@ -7594,6 +7914,9 @@ ALTER TABLE ONLY public.zoom_meetings ALTER COLUMN id SET DEFAULT nextval('publi ALTER TABLE ONLY public.abuse_reports ADD CONSTRAINT abuse_reports_pkey PRIMARY KEY (id); +ALTER TABLE ONLY public.alert_management_alerts + ADD CONSTRAINT alert_management_alerts_pkey PRIMARY KEY (id); + ALTER TABLE ONLY public.alerts_service_data ADD CONSTRAINT alerts_service_data_pkey PRIMARY KEY (id); @@ -7687,6 +8010,15 @@ ALTER TABLE ONLY public.chat_names ALTER TABLE ONLY public.chat_teams ADD CONSTRAINT chat_teams_pkey PRIMARY KEY (id); +ALTER TABLE public.ci_job_artifacts + ADD CONSTRAINT check_27f0f6dbab CHECK ((file_store IS NOT NULL)) NOT VALID; + +ALTER TABLE public.uploads + ADD CONSTRAINT check_5e9547379c CHECK ((store IS NOT NULL)) NOT VALID; + +ALTER TABLE public.lfs_objects + ADD CONSTRAINT check_eecfc5717d CHECK ((file_store IS NOT NULL)) NOT VALID; + ALTER TABLE ONLY public.ci_build_needs ADD CONSTRAINT ci_build_needs_pkey PRIMARY KEY (id); @@ -7705,12 +8037,21 @@ ALTER TABLE ONLY public.ci_builds ALTER TABLE ONLY public.ci_builds_runner_session ADD CONSTRAINT ci_builds_runner_session_pkey PRIMARY KEY (id); +ALTER TABLE ONLY public.ci_daily_build_group_report_results + ADD CONSTRAINT ci_daily_build_group_report_results_pkey PRIMARY KEY (id); + ALTER TABLE ONLY public.ci_daily_report_results ADD CONSTRAINT ci_daily_report_results_pkey PRIMARY KEY (id); +ALTER TABLE ONLY public.ci_freeze_periods + ADD CONSTRAINT ci_freeze_periods_pkey PRIMARY KEY (id); + ALTER TABLE ONLY public.ci_group_variables ADD CONSTRAINT ci_group_variables_pkey PRIMARY KEY (id); +ALTER TABLE ONLY public.ci_instance_variables + ADD CONSTRAINT ci_instance_variables_pkey PRIMARY KEY (id); + ALTER TABLE ONLY public.ci_job_artifacts ADD CONSTRAINT ci_job_artifacts_pkey PRIMARY KEY (id); @@ -7999,6 +8340,12 @@ ALTER TABLE ONLY public.group_deploy_tokens ALTER TABLE ONLY public.group_group_links ADD CONSTRAINT group_group_links_pkey PRIMARY KEY (id); +ALTER TABLE ONLY public.group_import_states + ADD CONSTRAINT group_import_states_pkey PRIMARY KEY (group_id); + +ALTER TABLE ONLY public.group_wiki_repositories + ADD CONSTRAINT group_wiki_repositories_pkey PRIMARY KEY (group_id); + ALTER TABLE ONLY public.historical_data ADD CONSTRAINT historical_data_pkey PRIMARY KEY (id); @@ -8116,6 +8463,9 @@ ALTER TABLE ONLY public.merge_trains ALTER TABLE ONLY public.metrics_dashboard_annotations ADD CONSTRAINT metrics_dashboard_annotations_pkey PRIMARY KEY (id); +ALTER TABLE ONLY public.metrics_users_starred_dashboards + ADD CONSTRAINT metrics_users_starred_dashboards_pkey PRIMARY KEY (id); + ALTER TABLE ONLY public.milestones ADD CONSTRAINT milestones_pkey PRIMARY KEY (id); @@ -8170,6 +8520,9 @@ ALTER TABLE ONLY public.operations_scopes ALTER TABLE ONLY public.operations_strategies ADD CONSTRAINT operations_strategies_pkey PRIMARY KEY (id); +ALTER TABLE ONLY public.operations_strategies_user_lists + ADD CONSTRAINT operations_strategies_user_lists_pkey PRIMARY KEY (id); + ALTER TABLE ONLY public.operations_user_lists ADD CONSTRAINT operations_user_lists_pkey PRIMARY KEY (id); @@ -8191,6 +8544,12 @@ ALTER TABLE ONLY public.packages_dependency_links ALTER TABLE ONLY public.packages_maven_metadata ADD CONSTRAINT packages_maven_metadata_pkey PRIMARY KEY (id); +ALTER TABLE ONLY public.packages_nuget_dependency_link_metadata + ADD CONSTRAINT packages_nuget_dependency_link_metadata_pkey PRIMARY KEY (dependency_link_id); + +ALTER TABLE ONLY public.packages_nuget_metadata + ADD CONSTRAINT packages_nuget_metadata_pkey PRIMARY KEY (package_id); + ALTER TABLE ONLY public.packages_package_files ADD CONSTRAINT packages_package_files_pkey PRIMARY KEY (id); @@ -8209,6 +8568,9 @@ ALTER TABLE ONLY public.pages_domain_acme_orders ALTER TABLE ONLY public.pages_domains ADD CONSTRAINT pages_domains_pkey PRIMARY KEY (id); +ALTER TABLE ONLY public.partitioned_foreign_keys + ADD CONSTRAINT partitioned_foreign_keys_pkey PRIMARY KEY (id); + ALTER TABLE ONLY public.path_locks ADD CONSTRAINT path_locks_pkey PRIMARY KEY (id); @@ -8284,6 +8646,9 @@ ALTER TABLE ONLY public.project_repositories ALTER TABLE ONLY public.project_repository_states ADD CONSTRAINT project_repository_states_pkey PRIMARY KEY (id); +ALTER TABLE ONLY public.project_repository_storage_moves + ADD CONSTRAINT project_repository_storage_moves_pkey PRIMARY KEY (id); + ALTER TABLE ONLY public.project_settings ADD CONSTRAINT project_settings_pkey PRIMARY KEY (project_id); @@ -8353,6 +8718,9 @@ ALTER TABLE ONLY public.resource_label_events ALTER TABLE ONLY public.resource_milestone_events ADD CONSTRAINT resource_milestone_events_pkey PRIMARY KEY (id); +ALTER TABLE ONLY public.resource_state_events + ADD CONSTRAINT resource_state_events_pkey PRIMARY KEY (id); + ALTER TABLE ONLY public.resource_weight_events ADD CONSTRAINT resource_weight_events_pkey PRIMARY KEY (id); @@ -8422,6 +8790,12 @@ ALTER TABLE ONLY public.software_licenses ALTER TABLE ONLY public.spam_logs ADD CONSTRAINT spam_logs_pkey PRIMARY KEY (id); +ALTER TABLE ONLY public.sprints + ADD CONSTRAINT sprints_pkey PRIMARY KEY (id); + +ALTER TABLE ONLY public.status_page_published_incidents + ADD CONSTRAINT status_page_published_incidents_pkey PRIMARY KEY (id); + ALTER TABLE ONLY public.status_page_settings ADD CONSTRAINT status_page_settings_pkey PRIMARY KEY (project_id); @@ -8616,6 +8990,8 @@ CREATE INDEX idx_merge_requests_on_state_id_and_merge_status ON public.merge_req CREATE INDEX idx_merge_requests_on_target_project_id_and_iid_opened ON public.merge_requests USING btree (target_project_id, iid) WHERE (state_id = 1); +CREATE UNIQUE INDEX idx_metrics_users_starred_dashboard_on_user_project_dashboard ON public.metrics_users_starred_dashboards USING btree (user_id, project_id, dashboard_path); + CREATE INDEX idx_mr_cc_diff_files_on_mr_cc_id_and_sha ON public.merge_request_context_commit_diff_files USING btree (merge_request_context_commit_id, sha); CREATE INDEX idx_packages_packages_on_project_id_name_version_package_type ON public.packages_packages USING btree (project_id, name, version, package_type); @@ -8654,6 +9030,12 @@ CREATE UNIQUE INDEX idx_vulnerability_issue_links_on_vulnerability_id_and_link_t CREATE INDEX index_abuse_reports_on_user_id ON public.abuse_reports USING btree (user_id); +CREATE INDEX index_alert_management_alerts_on_issue_id ON public.alert_management_alerts USING btree (issue_id); + +CREATE UNIQUE INDEX index_alert_management_alerts_on_project_id_and_fingerprint ON public.alert_management_alerts USING btree (project_id, fingerprint); + +CREATE UNIQUE INDEX index_alert_management_alerts_on_project_id_and_iid ON public.alert_management_alerts USING btree (project_id, iid); + CREATE INDEX index_alerts_service_data_on_service_id ON public.alerts_service_data USING btree (service_id); CREATE INDEX index_allowed_email_domains_on_group_id ON public.allowed_email_domains USING btree (group_id); @@ -8864,10 +9246,16 @@ CREATE INDEX index_ci_builds_project_id_and_status_for_live_jobs_partial2 ON pub CREATE UNIQUE INDEX index_ci_builds_runner_session_on_build_id ON public.ci_builds_runner_session USING btree (build_id); +CREATE INDEX index_ci_daily_build_group_report_results_on_last_pipeline_id ON public.ci_daily_build_group_report_results USING btree (last_pipeline_id); + CREATE INDEX index_ci_daily_report_results_on_last_pipeline_id ON public.ci_daily_report_results USING btree (last_pipeline_id); +CREATE INDEX index_ci_freeze_periods_on_project_id ON public.ci_freeze_periods USING btree (project_id); + CREATE UNIQUE INDEX index_ci_group_variables_on_group_id_and_key ON public.ci_group_variables USING btree (group_id, key); +CREATE UNIQUE INDEX index_ci_instance_variables_on_key ON public.ci_instance_variables USING btree (key); + CREATE INDEX index_ci_job_artifacts_file_store_is_null ON public.ci_job_artifacts USING btree (id) WHERE (file_store IS NULL); CREATE INDEX index_ci_job_artifacts_on_expire_at_and_job_id ON public.ci_job_artifacts USING btree (expire_at, job_id); @@ -9030,6 +9418,8 @@ CREATE UNIQUE INDEX index_clusters_applications_helm_on_cluster_id ON public.clu CREATE UNIQUE INDEX index_clusters_applications_ingress_on_cluster_id ON public.clusters_applications_ingress USING btree (cluster_id); +CREATE INDEX index_clusters_applications_ingress_on_modsecurity ON public.clusters_applications_ingress USING btree (modsecurity_enabled, modsecurity_mode, cluster_id); + CREATE UNIQUE INDEX index_clusters_applications_jupyter_on_cluster_id ON public.clusters_applications_jupyter USING btree (cluster_id); CREATE INDEX index_clusters_applications_jupyter_on_oauth_application_id ON public.clusters_applications_jupyter USING btree (oauth_application_id); @@ -9052,6 +9442,8 @@ CREATE INDEX index_clusters_kubernetes_namespaces_on_project_id ON public.cluste CREATE INDEX index_clusters_on_enabled_and_provider_type_and_id ON public.clusters USING btree (enabled, provider_type, id); +CREATE INDEX index_clusters_on_enabled_cluster_type_id_and_created_at ON public.clusters USING btree (enabled, cluster_type, id, created_at); + CREATE INDEX index_clusters_on_management_project_id ON public.clusters USING btree (management_project_id) WHERE (management_project_id IS NOT NULL); CREATE INDEX index_clusters_on_user_id ON public.clusters USING btree (user_id); @@ -9064,6 +9456,10 @@ CREATE INDEX index_container_repositories_on_project_id ON public.container_repo CREATE UNIQUE INDEX index_container_repositories_on_project_id_and_name ON public.container_repositories USING btree (project_id, name); +CREATE INDEX index_container_repository_on_name_trigram ON public.container_repositories USING gin (name public.gin_trgm_ops); + +CREATE UNIQUE INDEX index_daily_build_group_report_results_unique_columns ON public.ci_daily_build_group_report_results USING btree (project_id, ref_path, date, group_name); + CREATE UNIQUE INDEX index_daily_report_results_unique_columns ON public.ci_daily_report_results USING btree (project_id, ref_path, param_type, date, title); CREATE INDEX index_dependency_proxy_blobs_on_group_id_and_file_name ON public.dependency_proxy_blobs USING btree (group_id, file_name); @@ -9158,6 +9554,8 @@ CREATE UNIQUE INDEX index_emails_on_email ON public.emails USING btree (email); CREATE INDEX index_emails_on_user_id ON public.emails USING btree (user_id); +CREATE INDEX index_enabled_clusters_on_id ON public.clusters USING btree (id) WHERE (enabled = true); + CREATE INDEX index_environments_on_auto_stop_at ON public.environments USING btree (auto_stop_at) WHERE (auto_stop_at IS NOT NULL); CREATE INDEX index_environments_on_name_varchar_pattern_ops ON public.environments USING btree (name varchar_pattern_ops); @@ -9234,8 +9632,6 @@ CREATE UNIQUE INDEX index_feature_gates_on_feature_key_and_key_and_value ON publ CREATE UNIQUE INDEX index_features_on_key ON public.features USING btree (key); -CREATE INDEX index_for_migrating_user_highest_roles_table ON public.users USING btree (id) WHERE (((state)::text = 'active'::text) AND (user_type IS NULL) AND (bot_type IS NULL) AND (ghost IS NOT TRUE)); - CREATE INDEX index_for_resource_group ON public.ci_builds USING btree (resource_group_id, id) WHERE (resource_group_id IS NOT NULL); CREATE INDEX index_for_status_per_branch_per_project ON public.merge_trains USING btree (target_project_id, target_branch, status); @@ -9362,6 +9758,12 @@ CREATE UNIQUE INDEX index_group_group_links_on_shared_group_and_shared_with_grou CREATE INDEX index_group_group_links_on_shared_with_group_id ON public.group_group_links USING btree (shared_with_group_id); +CREATE INDEX index_group_import_states_on_group_id ON public.group_import_states USING btree (group_id); + +CREATE UNIQUE INDEX index_group_wiki_repositories_on_disk_path ON public.group_wiki_repositories USING btree (disk_path); + +CREATE INDEX index_group_wiki_repositories_on_shard_id ON public.group_wiki_repositories USING btree (shard_id); + CREATE INDEX index_identities_on_saml_provider_id ON public.identities USING btree (saml_provider_id) WHERE (saml_provider_id IS NOT NULL); CREATE INDEX index_identities_on_user_id ON public.identities USING btree (user_id); @@ -9440,6 +9842,8 @@ CREATE INDEX index_issues_on_promoted_to_epic_id ON public.issues USING btree (p CREATE INDEX index_issues_on_relative_position ON public.issues USING btree (relative_position); +CREATE INDEX index_issues_on_sprint_id ON public.issues USING btree (sprint_id); + CREATE INDEX index_issues_on_title_trigram ON public.issues USING gin (title public.gin_trgm_ops); CREATE INDEX index_issues_on_updated_at ON public.issues USING btree (updated_at); @@ -9602,6 +10006,8 @@ CREATE INDEX index_merge_requests_on_source_branch ON public.merge_requests USIN CREATE INDEX index_merge_requests_on_source_project_id_and_source_branch ON public.merge_requests USING btree (source_project_id, source_branch); +CREATE INDEX index_merge_requests_on_sprint_id ON public.merge_requests USING btree (sprint_id); + CREATE INDEX index_merge_requests_on_target_branch ON public.merge_requests USING btree (target_branch); CREATE UNIQUE INDEX index_merge_requests_on_target_project_id_and_iid ON public.merge_requests USING btree (target_project_id, iid); @@ -9628,6 +10034,8 @@ CREATE INDEX index_metrics_dashboard_annotations_on_cluster_id_and_3_columns ON CREATE INDEX index_metrics_dashboard_annotations_on_environment_id_and_3_col ON public.metrics_dashboard_annotations USING btree (environment_id, dashboard_path, starting_at, ending_at) WHERE (environment_id IS NOT NULL); +CREATE INDEX index_metrics_users_starred_dashboards_on_project_id ON public.metrics_users_starred_dashboards USING btree (project_id); + CREATE INDEX index_milestone_releases_on_release_id ON public.milestone_releases USING btree (release_id); CREATE INDEX index_milestones_on_description_trigram ON public.milestones USING gin (description public.gin_trgm_ops); @@ -9678,8 +10086,6 @@ CREATE INDEX index_namespaces_on_path ON public.namespaces USING btree (path); CREATE INDEX index_namespaces_on_path_trigram ON public.namespaces USING gin (path public.gin_trgm_ops); -CREATE INDEX index_namespaces_on_plan_id ON public.namespaces USING btree (plan_id); - CREATE UNIQUE INDEX index_namespaces_on_push_rule_id ON public.namespaces USING btree (push_rule_id); CREATE INDEX index_namespaces_on_require_two_factor_authentication ON public.namespaces USING btree (require_two_factor_authentication); @@ -9694,6 +10100,8 @@ CREATE INDEX index_namespaces_on_trial_ends_on ON public.namespaces USING btree CREATE INDEX index_namespaces_on_type_partial ON public.namespaces USING btree (type) WHERE (type IS NOT NULL); +CREATE INDEX index_non_requested_project_members_on_source_id_and_type ON public.members USING btree (source_id, source_type) WHERE ((requested_at IS NULL) AND ((type)::text = 'ProjectMember'::text)); + CREATE UNIQUE INDEX index_note_diff_files_on_diff_note_id ON public.note_diff_files USING btree (diff_note_id); CREATE INDEX index_notes_on_author_id_and_created_at_and_id ON public.notes USING btree (author_id, created_at, id); @@ -9756,10 +10164,14 @@ CREATE UNIQUE INDEX index_operations_scopes_on_strategy_id_and_environment_scope CREATE INDEX index_operations_strategies_on_feature_flag_id ON public.operations_strategies USING btree (feature_flag_id); +CREATE INDEX index_operations_strategies_user_lists_on_user_list_id ON public.operations_strategies_user_lists USING btree (user_list_id); + CREATE UNIQUE INDEX index_operations_user_lists_on_project_id_and_iid ON public.operations_user_lists USING btree (project_id, iid); CREATE UNIQUE INDEX index_operations_user_lists_on_project_id_and_name ON public.operations_user_lists USING btree (project_id, name); +CREATE UNIQUE INDEX index_ops_strategies_user_lists_on_strategy_id_and_user_list_id ON public.operations_strategies_user_lists USING btree (strategy_id, user_list_id); + CREATE UNIQUE INDEX index_packages_build_infos_on_package_id ON public.packages_build_infos USING btree (package_id); CREATE INDEX index_packages_build_infos_on_pipeline_id ON public.packages_build_infos USING btree (pipeline_id); @@ -9774,6 +10186,8 @@ CREATE INDEX index_packages_dependency_links_on_dependency_id ON public.packages CREATE INDEX index_packages_maven_metadata_on_package_id_and_path ON public.packages_maven_metadata USING btree (package_id, path); +CREATE INDEX index_packages_nuget_dl_metadata_on_dependency_link_id ON public.packages_nuget_dependency_link_metadata USING btree (dependency_link_id); + CREATE INDEX index_packages_package_files_on_package_id_and_file_name ON public.packages_package_files USING btree (package_id, file_name); CREATE INDEX index_packages_packages_on_name_trigram ON public.packages_packages USING gin (name public.gin_trgm_ops); @@ -9794,7 +10208,9 @@ CREATE INDEX index_pages_domain_acme_orders_on_challenge_token ON public.pages_d CREATE INDEX index_pages_domain_acme_orders_on_pages_domain_id ON public.pages_domain_acme_orders USING btree (pages_domain_id); -CREATE INDEX index_pages_domains_need_auto_ssl_renewal ON public.pages_domains USING btree (certificate_source, certificate_valid_not_after) WHERE (auto_ssl_enabled = true); +CREATE INDEX index_pages_domains_need_auto_ssl_renewal_user_provided ON public.pages_domains USING btree (id) WHERE ((auto_ssl_enabled = true) AND (auto_ssl_failed = false) AND (certificate_source = 0)); + +CREATE INDEX index_pages_domains_need_auto_ssl_renewal_valid_not_after ON public.pages_domains USING btree (certificate_valid_not_after) WHERE ((auto_ssl_enabled = true) AND (auto_ssl_failed = false)); CREATE UNIQUE INDEX index_pages_domains_on_domain_and_wildcard ON public.pages_domains USING btree (domain, wildcard); @@ -9816,6 +10232,8 @@ CREATE INDEX index_pages_domains_on_verified_at_and_enabled_until ON public.page CREATE INDEX index_pages_domains_on_wildcard ON public.pages_domains USING btree (wildcard); +CREATE UNIQUE INDEX index_partitioned_foreign_keys_unique_index ON public.partitioned_foreign_keys USING btree (to_table, from_table, from_column); + CREATE INDEX index_pat_on_user_id_and_expires_at ON public.personal_access_tokens USING btree (user_id, expires_at); CREATE INDEX index_path_locks_on_path ON public.path_locks USING btree (path); @@ -9830,7 +10248,7 @@ CREATE INDEX index_personal_access_tokens_on_user_id ON public.personal_access_t CREATE UNIQUE INDEX index_plan_limits_on_plan_id ON public.plan_limits USING btree (plan_id); -CREATE INDEX index_plans_on_name ON public.plans USING btree (name); +CREATE UNIQUE INDEX index_plans_on_name ON public.plans USING btree (name); CREATE UNIQUE INDEX index_pool_repositories_on_disk_path ON public.pool_repositories USING btree (disk_path); @@ -9906,6 +10324,8 @@ CREATE INDEX index_project_repositories_on_shard_id ON public.project_repositori CREATE UNIQUE INDEX index_project_repository_states_on_project_id ON public.project_repository_states USING btree (project_id); +CREATE INDEX index_project_repository_storage_moves_on_project_id ON public.project_repository_storage_moves USING btree (project_id); + CREATE UNIQUE INDEX index_project_settings_on_push_rule_id ON public.project_settings USING btree (push_rule_id); CREATE INDEX index_project_statistics_on_namespace_id ON public.project_statistics USING btree (namespace_id); @@ -10118,6 +10538,16 @@ CREATE INDEX index_resource_milestone_events_on_milestone_id ON public.resource_ CREATE INDEX index_resource_milestone_events_on_user_id ON public.resource_milestone_events USING btree (user_id); +CREATE INDEX index_resource_state_events_on_epic_id ON public.resource_state_events USING btree (epic_id); + +CREATE INDEX index_resource_state_events_on_issue_id_and_created_at ON public.resource_state_events USING btree (issue_id, created_at); + +CREATE INDEX index_resource_state_events_on_merge_request_id ON public.resource_state_events USING btree (merge_request_id); + +CREATE INDEX index_resource_state_events_on_user_id ON public.resource_state_events USING btree (user_id); + +CREATE INDEX index_resource_weight_events_on_issue_id_and_created_at ON public.resource_weight_events USING btree (issue_id, created_at); + CREATE INDEX index_resource_weight_events_on_issue_id_and_weight ON public.resource_weight_events USING btree (issue_id, weight); CREATE INDEX index_resource_weight_events_on_user_id ON public.resource_weight_events USING btree (user_id); @@ -10162,6 +10592,8 @@ CREATE INDEX index_serverless_domain_cluster_on_pages_domain_id ON public.server CREATE INDEX index_service_desk_enabled_projects_on_id_creator_id_created_at ON public.projects USING btree (id, creator_id, created_at) WHERE (service_desk_enabled = true); +CREATE INDEX index_services_on_inherit_from_id ON public.services USING btree (inherit_from_id); + CREATE INDEX index_services_on_project_id_and_type ON public.services USING btree (project_id, type); CREATE INDEX index_services_on_template ON public.services USING btree (template); @@ -10216,12 +10648,32 @@ CREATE INDEX index_software_licenses_on_spdx_identifier ON public.software_licen CREATE UNIQUE INDEX index_software_licenses_on_unique_name ON public.software_licenses USING btree (name); +CREATE INDEX index_sprints_on_description_trigram ON public.sprints USING gin (description public.gin_trgm_ops); + +CREATE INDEX index_sprints_on_due_date ON public.sprints USING btree (due_date); + +CREATE INDEX index_sprints_on_group_id ON public.sprints USING btree (group_id); + +CREATE UNIQUE INDEX index_sprints_on_group_id_and_title ON public.sprints USING btree (group_id, title) WHERE (group_id IS NOT NULL); + +CREATE UNIQUE INDEX index_sprints_on_project_id_and_iid ON public.sprints USING btree (project_id, iid); + +CREATE UNIQUE INDEX index_sprints_on_project_id_and_title ON public.sprints USING btree (project_id, title) WHERE (project_id IS NOT NULL); + +CREATE INDEX index_sprints_on_title ON public.sprints USING btree (title); + +CREATE INDEX index_sprints_on_title_trigram ON public.sprints USING gin (title public.gin_trgm_ops); + +CREATE UNIQUE INDEX index_status_page_published_incidents_on_issue_id ON public.status_page_published_incidents USING btree (issue_id); + CREATE INDEX index_status_page_settings_on_project_id ON public.status_page_settings USING btree (project_id); CREATE INDEX index_subscriptions_on_project_id ON public.subscriptions USING btree (project_id); CREATE UNIQUE INDEX index_subscriptions_on_subscribable_and_user_id_and_project_id ON public.subscriptions USING btree (subscribable_id, subscribable_type, user_id, project_id); +CREATE INDEX index_successful_deployments_on_cluster_id_and_environment_id ON public.deployments USING btree (cluster_id, environment_id) WHERE (status = 2); + CREATE UNIQUE INDEX index_suggestions_on_note_id_and_relative_order ON public.suggestions USING btree (note_id, relative_order); CREATE UNIQUE INDEX index_system_note_metadata_on_description_version_id ON public.system_note_metadata USING btree (description_version_id) WHERE (description_version_id IS NOT NULL); @@ -10326,8 +10778,6 @@ CREATE INDEX index_users_on_accepted_term_id ON public.users USING btree (accept CREATE INDEX index_users_on_admin ON public.users USING btree (admin); -CREATE INDEX index_users_on_bot_type ON public.users USING btree (bot_type); - CREATE UNIQUE INDEX index_users_on_confirmation_token ON public.users USING btree (confirmation_token); CREATE INDEX index_users_on_created_at ON public.users USING btree (created_at); @@ -10404,7 +10854,9 @@ CREATE INDEX index_vulnerabilities_on_updated_by_id ON public.vulnerabilities US CREATE INDEX index_vulnerability_exports_on_author_id ON public.vulnerability_exports USING btree (author_id); -CREATE UNIQUE INDEX index_vulnerability_exports_on_project_id_and_id ON public.vulnerability_exports USING btree (project_id, id); +CREATE INDEX index_vulnerability_exports_on_group_id_not_null ON public.vulnerability_exports USING btree (group_id) WHERE (group_id IS NOT NULL); + +CREATE INDEX index_vulnerability_exports_on_project_id_not_null ON public.vulnerability_exports USING btree (project_id) WHERE (project_id IS NOT NULL); CREATE INDEX index_vulnerability_feedback_on_author_id ON public.vulnerability_feedback USING btree (author_id); @@ -10426,6 +10878,8 @@ CREATE UNIQUE INDEX index_vulnerability_occurrence_identifiers_on_unique_keys ON CREATE INDEX index_vulnerability_occurrence_pipelines_on_pipeline_id ON public.vulnerability_occurrence_pipelines USING btree (pipeline_id); +CREATE INDEX index_vulnerability_occurrences_on_id_and_confidence_eq_zero ON public.vulnerability_occurrences USING btree (id) WHERE (confidence = 0); + CREATE INDEX index_vulnerability_occurrences_on_primary_identifier_id ON public.vulnerability_occurrences USING btree (primary_identifier_id); CREATE INDEX index_vulnerability_occurrences_on_scanner_id ON public.vulnerability_occurrences USING btree (scanner_id); @@ -10436,6 +10890,8 @@ CREATE UNIQUE INDEX index_vulnerability_occurrences_on_uuid ON public.vulnerabil CREATE INDEX index_vulnerability_occurrences_on_vulnerability_id ON public.vulnerability_occurrences USING btree (vulnerability_id); +CREATE INDEX index_vulnerability_on_id_and_confidence_eq_zero ON public.vulnerabilities USING btree (id) WHERE (confidence = 0); + CREATE UNIQUE INDEX index_vulnerability_scanners_on_project_id_and_external_id ON public.vulnerability_scanners USING btree (project_id, external_id); CREATE UNIQUE INDEX index_vulnerability_user_mentions_on_note_id ON public.vulnerability_user_mentions USING btree (note_id) WHERE (note_id IS NOT NULL); @@ -10504,6 +10960,10 @@ CREATE INDEX note_mentions_temp_index ON public.notes USING btree (id, noteable_ CREATE UNIQUE INDEX one_canonical_wiki_page_slug_per_metadata ON public.wiki_page_slugs USING btree (wiki_page_meta_id) WHERE (canonical = true); +CREATE INDEX packages_packages_verification_checksum_partial ON public.packages_package_files USING btree (verification_checksum) WHERE (verification_checksum IS NOT NULL); + +CREATE INDEX packages_packages_verification_failure_partial ON public.packages_package_files USING btree (verification_failure) WHERE (verification_failure IS NOT NULL); + CREATE INDEX partial_index_ci_builds_on_scheduled_at_with_scheduled_jobs ON public.ci_builds USING btree (scheduled_at) WHERE ((scheduled_at IS NOT NULL) AND ((type)::text = 'Ci::Build'::text) AND ((status)::text = 'scheduled'::text)); CREATE INDEX partial_index_deployments_for_legacy_successful_deployments ON public.deployments USING btree (id) WHERE ((finished_at IS NULL) AND (status = 2)); @@ -10522,6 +10982,12 @@ CREATE INDEX tmp_build_stage_position_index ON public.ci_builds USING btree (sta CREATE INDEX tmp_idx_on_user_id_where_bio_is_filled ON public.users USING btree (id) WHERE ((COALESCE(bio, ''::character varying))::text IS DISTINCT FROM ''::text); +CREATE INDEX tmp_index_ci_builds_lock_version ON public.ci_builds USING btree (id) WHERE (lock_version IS NULL); + +CREATE INDEX tmp_index_ci_pipelines_lock_version ON public.ci_pipelines USING btree (id) WHERE (lock_version IS NULL); + +CREATE INDEX tmp_index_ci_stages_lock_version ON public.ci_stages USING btree (id) WHERE (lock_version IS NULL); + CREATE UNIQUE INDEX users_security_dashboard_projects_unique_index ON public.users_security_dashboard_projects USING btree (project_id, user_id); CREATE UNIQUE INDEX vulnerability_feedback_unique_idx ON public.vulnerability_feedback USING btree (project_id, category, feedback_type, project_fingerprint); @@ -10597,6 +11063,9 @@ ALTER TABLE ONLY public.geo_container_repository_updated_events ALTER TABLE ONLY public.users_star_projects ADD CONSTRAINT fk_22cd27ddfc FOREIGN KEY (project_id) REFERENCES public.projects(id) ON DELETE CASCADE; +ALTER TABLE ONLY public.alert_management_alerts + ADD CONSTRAINT fk_2358b75436 FOREIGN KEY (issue_id) REFERENCES public.issues(id) ON DELETE SET NULL; + ALTER TABLE ONLY public.ci_stages ADD CONSTRAINT fk_2360681d1d FOREIGN KEY (project_id) REFERENCES public.projects(id) ON DELETE CASCADE; @@ -10654,15 +11123,15 @@ ALTER TABLE ONLY public.push_event_payloads ALTER TABLE ONLY public.ci_builds ADD CONSTRAINT fk_3a9eaa254d FOREIGN KEY (stage_id) REFERENCES public.ci_stages(id) ON DELETE CASCADE; +ALTER TABLE ONLY public.issues + ADD CONSTRAINT fk_3b8c72ea56 FOREIGN KEY (sprint_id) REFERENCES public.sprints(id) ON DELETE CASCADE; + ALTER TABLE ONLY public.epics ADD CONSTRAINT fk_3c1fd1cccc FOREIGN KEY (due_date_sourcing_milestone_id) REFERENCES public.milestones(id) ON DELETE SET NULL; ALTER TABLE ONLY public.ci_pipelines ADD CONSTRAINT fk_3d34ab2e06 FOREIGN KEY (pipeline_schedule_id) REFERENCES public.ci_pipeline_schedules(id) ON DELETE SET NULL; -ALTER TABLE ONLY public.project_settings - ADD CONSTRAINT fk_413a953e20 FOREIGN KEY (push_rule_id) REFERENCES public.push_rules(id) ON DELETE CASCADE; - ALTER TABLE ONLY public.ci_pipeline_schedule_variables ADD CONSTRAINT fk_41c35fda51 FOREIGN KEY (pipeline_schedule_id) REFERENCES public.ci_pipeline_schedules(id) ON DELETE CASCADE; @@ -10771,9 +11240,15 @@ ALTER TABLE ONLY public.vulnerabilities ALTER TABLE ONLY public.labels ADD CONSTRAINT fk_7de4989a69 FOREIGN KEY (project_id) REFERENCES public.projects(id) ON DELETE CASCADE; +ALTER TABLE ONLY public.merge_requests + ADD CONSTRAINT fk_7e85395a64 FOREIGN KEY (sprint_id) REFERENCES public.sprints(id) ON DELETE CASCADE; + ALTER TABLE ONLY public.merge_request_metrics ADD CONSTRAINT fk_7f28d925f3 FOREIGN KEY (merged_by_id) REFERENCES public.users(id) ON DELETE SET NULL; +ALTER TABLE ONLY public.sprints + ADD CONSTRAINT fk_80aa8a1f95 FOREIGN KEY (group_id) REFERENCES public.namespaces(id) ON DELETE CASCADE; + ALTER TABLE ONLY public.import_export_uploads ADD CONSTRAINT fk_83319d9721 FOREIGN KEY (group_id) REFERENCES public.namespaces(id) ON DELETE CASCADE; @@ -10786,6 +11261,9 @@ ALTER TABLE ONLY public.merge_request_diffs ALTER TABLE ONLY public.ci_pipelines ADD CONSTRAINT fk_86635dbd80 FOREIGN KEY (project_id) REFERENCES public.projects(id) ON DELETE CASCADE; +ALTER TABLE ONLY public.services + ADD CONSTRAINT fk_868a8e7ad6 FOREIGN KEY (inherit_from_id) REFERENCES public.services(id) ON DELETE SET NULL; + ALTER TABLE ONLY public.geo_event_log ADD CONSTRAINT fk_86c84214ec FOREIGN KEY (repository_renamed_event_id) REFERENCES public.geo_repository_renamed_events(id) ON DELETE CASCADE; @@ -10852,6 +11330,9 @@ ALTER TABLE ONLY public.issues ALTER TABLE ONLY public.epics ADD CONSTRAINT fk_9d480c64b2 FOREIGN KEY (start_date_sourcing_epic_id) REFERENCES public.epics(id) ON DELETE SET NULL; +ALTER TABLE ONLY public.alert_management_alerts + ADD CONSTRAINT fk_9e49e5c2b7 FOREIGN KEY (project_id) REFERENCES public.projects(id) ON DELETE CASCADE; + ALTER TABLE ONLY public.ci_pipeline_schedules ADD CONSTRAINT fk_9ea99f58d2 FOREIGN KEY (owner_id) REFERENCES public.users(id) ON DELETE SET NULL; @@ -10915,6 +11396,9 @@ ALTER TABLE ONLY public.deployments ALTER TABLE ONLY public.gitlab_subscriptions ADD CONSTRAINT fk_bd0c4019c3 FOREIGN KEY (hosted_plan_id) REFERENCES public.plans(id) ON DELETE CASCADE; +ALTER TABLE ONLY public.metrics_users_starred_dashboards + ADD CONSTRAINT fk_bd6ae32fac FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE; + ALTER TABLE ONLY public.snippets ADD CONSTRAINT fk_be41fd4bb7 FOREIGN KEY (project_id) REFERENCES public.projects(id) ON DELETE CASCADE; @@ -10933,6 +11417,9 @@ ALTER TABLE ONLY public.design_management_versions ALTER TABLE ONLY public.geo_event_log ADD CONSTRAINT fk_c1f241c70d FOREIGN KEY (upload_deleted_event_id) REFERENCES public.geo_upload_deleted_events(id) ON DELETE CASCADE; +ALTER TABLE ONLY public.vulnerability_exports + ADD CONSTRAINT fk_c3d3cb5d0f FOREIGN KEY (group_id) REFERENCES public.namespaces(id) ON DELETE CASCADE; + ALTER TABLE ONLY public.geo_event_log ADD CONSTRAINT fk_c4b1c1f66e FOREIGN KEY (repository_deleted_event_id) REFERENCES public.geo_repository_deleted_events(id) ON DELETE CASCADE; @@ -10966,6 +11453,9 @@ ALTER TABLE ONLY public.geo_event_log ALTER TABLE ONLY public.lists ADD CONSTRAINT fk_d6cf4279f7 FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE; +ALTER TABLE ONLY public.metrics_users_starred_dashboards + ADD CONSTRAINT fk_d76a2b9a8c FOREIGN KEY (project_id) REFERENCES public.projects(id) ON DELETE CASCADE; + ALTER TABLE ONLY public.system_note_metadata ADD CONSTRAINT fk_d83a918cb1 FOREIGN KEY (note_id) REFERENCES public.notes(id) ON DELETE CASCADE; @@ -11008,6 +11498,9 @@ ALTER TABLE ONLY public.namespaces ALTER TABLE ONLY public.fork_networks ADD CONSTRAINT fk_e7b436b2b5 FOREIGN KEY (root_project_id) REFERENCES public.projects(id) ON DELETE SET NULL; +ALTER TABLE ONLY public.sprints + ADD CONSTRAINT fk_e8206c9686 FOREIGN KEY (project_id) REFERENCES public.projects(id) ON DELETE CASCADE; + ALTER TABLE ONLY public.application_settings ADD CONSTRAINT fk_e8a145f3a7 FOREIGN KEY (instance_administrators_group_id) REFERENCES public.namespaces(id) ON DELETE SET NULL; @@ -11053,9 +11546,6 @@ ALTER TABLE ONLY public.system_note_metadata ALTER TABLE ONLY public.merge_requests ADD CONSTRAINT fk_fd82eae0b9 FOREIGN KEY (head_pipeline_id) REFERENCES public.ci_pipelines(id) ON DELETE SET NULL; -ALTER TABLE ONLY public.namespaces - ADD CONSTRAINT fk_fdd12e5b80 FOREIGN KEY (plan_id) REFERENCES public.plans(id) ON DELETE SET NULL; - ALTER TABLE ONLY public.project_import_data ADD CONSTRAINT fk_ffb9ee3a10 FOREIGN KEY (project_id) REFERENCES public.projects(id) ON DELETE CASCADE; @@ -11071,6 +11561,12 @@ ALTER TABLE ONLY public.path_locks ALTER TABLE ONLY public.personal_access_tokens ADD CONSTRAINT fk_personal_access_tokens_user_id FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE; +ALTER TABLE ONLY public.project_settings + ADD CONSTRAINT fk_project_settings_push_rule_id FOREIGN KEY (push_rule_id) REFERENCES public.push_rules(id) ON DELETE SET NULL; + +ALTER TABLE ONLY public.projects + ADD CONSTRAINT fk_projects_namespace_id FOREIGN KEY (namespace_id) REFERENCES public.namespaces(id) ON DELETE RESTRICT; + ALTER TABLE ONLY public.protected_branch_merge_access_levels ADD CONSTRAINT fk_protected_branch_merge_access_levels_user_id FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE; @@ -11095,6 +11591,9 @@ ALTER TABLE ONLY public.events ALTER TABLE ONLY public.ip_restrictions ADD CONSTRAINT fk_rails_04a93778d5 FOREIGN KEY (group_id) REFERENCES public.namespaces(id) ON DELETE CASCADE; +ALTER TABLE ONLY public.ci_daily_build_group_report_results + ADD CONSTRAINT fk_rails_0667f7608c FOREIGN KEY (project_id) REFERENCES public.projects(id) ON DELETE CASCADE; + ALTER TABLE ONLY public.ci_subscriptions_projects ADD CONSTRAINT fk_rails_0818751483 FOREIGN KEY (downstream_project_id) REFERENCES public.projects(id) ON DELETE CASCADE; @@ -11179,6 +11678,9 @@ ALTER TABLE ONLY public.cluster_providers_aws ALTER TABLE ONLY public.grafana_integrations ADD CONSTRAINT fk_rails_18d0e2b564 FOREIGN KEY (project_id) REFERENCES public.projects(id) ON DELETE CASCADE; +ALTER TABLE ONLY public.group_wiki_repositories + ADD CONSTRAINT fk_rails_19755e374b FOREIGN KEY (shard_id) REFERENCES public.shards(id) ON DELETE RESTRICT; + ALTER TABLE ONLY public.open_project_tracker_data ADD CONSTRAINT fk_rails_1987546e48 FOREIGN KEY (service_id) REFERENCES public.services(id) ON DELETE CASCADE; @@ -11227,12 +11729,18 @@ ALTER TABLE ONLY public.service_desk_settings ALTER TABLE ONLY public.group_custom_attributes ADD CONSTRAINT fk_rails_246e0db83a FOREIGN KEY (group_id) REFERENCES public.namespaces(id) ON DELETE CASCADE; +ALTER TABLE ONLY public.group_wiki_repositories + ADD CONSTRAINT fk_rails_26f867598c FOREIGN KEY (group_id) REFERENCES public.namespaces(id) ON DELETE CASCADE; + ALTER TABLE ONLY public.lfs_file_locks ADD CONSTRAINT fk_rails_27a1d98fa8 FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE; ALTER TABLE ONLY public.project_alerting_settings ADD CONSTRAINT fk_rails_27a84b407d FOREIGN KEY (project_id) REFERENCES public.projects(id) ON DELETE CASCADE; +ALTER TABLE ONLY public.resource_state_events + ADD CONSTRAINT fk_rails_29af06892a FOREIGN KEY (issue_id) REFERENCES public.issues(id) ON DELETE CASCADE; + ALTER TABLE ONLY public.reviews ADD CONSTRAINT fk_rails_29e6f859c4 FOREIGN KEY (author_id) REFERENCES public.users(id) ON DELETE SET NULL; @@ -11248,12 +11756,21 @@ ALTER TABLE ONLY public.geo_repository_updated_events ALTER TABLE ONLY public.protected_branch_unprotect_access_levels ADD CONSTRAINT fk_rails_2d2aba21ef FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE; +ALTER TABLE ONLY public.ci_freeze_periods + ADD CONSTRAINT fk_rails_2e02bbd1a6 FOREIGN KEY (project_id) REFERENCES public.projects(id); + ALTER TABLE ONLY public.saml_providers ADD CONSTRAINT fk_rails_306d459be7 FOREIGN KEY (group_id) REFERENCES public.namespaces(id) ON DELETE CASCADE; +ALTER TABLE ONLY public.resource_state_events + ADD CONSTRAINT fk_rails_3112bba7dc FOREIGN KEY (merge_request_id) REFERENCES public.merge_requests(id) ON DELETE CASCADE; + ALTER TABLE ONLY public.merge_request_diff_commits ADD CONSTRAINT fk_rails_316aaceda3 FOREIGN KEY (merge_request_diff_id) REFERENCES public.merge_request_diffs(id) ON DELETE CASCADE; +ALTER TABLE ONLY public.group_import_states + ADD CONSTRAINT fk_rails_31c3e0503a FOREIGN KEY (group_id) REFERENCES public.namespaces(id) ON DELETE CASCADE; + ALTER TABLE ONLY public.zoom_meetings ADD CONSTRAINT fk_rails_3263f29616 FOREIGN KEY (issue_id) REFERENCES public.issues(id) ON DELETE CASCADE; @@ -11347,6 +11864,9 @@ ALTER TABLE ONLY public.ci_resources ALTER TABLE ONLY public.clusters_applications_fluentd ADD CONSTRAINT fk_rails_4319b1dcd2 FOREIGN KEY (cluster_id) REFERENCES public.clusters(id) ON DELETE CASCADE; +ALTER TABLE ONLY public.operations_strategies_user_lists + ADD CONSTRAINT fk_rails_43241e8d29 FOREIGN KEY (strategy_id) REFERENCES public.operations_strategies(id) ON DELETE CASCADE; + ALTER TABLE ONLY public.lfs_file_locks ADD CONSTRAINT fk_rails_43df7a0412 FOREIGN KEY (project_id) REFERENCES public.projects(id) ON DELETE CASCADE; @@ -11416,6 +11936,9 @@ ALTER TABLE ONLY public.merge_request_diff_files ALTER TABLE ONLY public.status_page_settings ADD CONSTRAINT fk_rails_506e5ba391 FOREIGN KEY (project_id) REFERENCES public.projects(id) ON DELETE CASCADE; +ALTER TABLE ONLY public.project_repository_storage_moves + ADD CONSTRAINT fk_rails_5106dbd44a FOREIGN KEY (project_id) REFERENCES public.projects(id) ON DELETE CASCADE; + ALTER TABLE ONLY public.x509_commit_signatures ADD CONSTRAINT fk_rails_53fe41188f FOREIGN KEY (x509_certificate_id) REFERENCES public.x509_certificates(id) ON DELETE CASCADE; @@ -11482,6 +12005,9 @@ ALTER TABLE ONLY public.dependency_proxy_group_settings ALTER TABLE ONLY public.group_deploy_tokens ADD CONSTRAINT fk_rails_61a572b41a FOREIGN KEY (group_id) REFERENCES public.namespaces(id) ON DELETE CASCADE; +ALTER TABLE ONLY public.status_page_published_incidents + ADD CONSTRAINT fk_rails_61e5493940 FOREIGN KEY (issue_id) REFERENCES public.issues(id) ON DELETE CASCADE; + ALTER TABLE ONLY public.deployment_clusters ADD CONSTRAINT fk_rails_6359a164df FOREIGN KEY (deployment_id) REFERENCES public.deployments(id) ON DELETE CASCADE; @@ -11881,6 +12407,9 @@ ALTER TABLE ONLY public.user_canonical_emails ALTER TABLE ONLY public.project_repositories ADD CONSTRAINT fk_rails_c3258dc63b FOREIGN KEY (shard_id) REFERENCES public.shards(id) ON DELETE RESTRICT; +ALTER TABLE ONLY public.packages_nuget_dependency_link_metadata + ADD CONSTRAINT fk_rails_c3313ee2e4 FOREIGN KEY (dependency_link_id) REFERENCES public.packages_dependency_links(id) ON DELETE CASCADE; + ALTER TABLE ONLY public.merge_request_user_mentions ADD CONSTRAINT fk_rails_c440b9ea31 FOREIGN KEY (note_id) REFERENCES public.notes(id) ON DELETE CASCADE; @@ -11905,6 +12434,9 @@ ALTER TABLE ONLY public.vulnerability_occurrences ALTER TABLE ONLY public.project_export_jobs ADD CONSTRAINT fk_rails_c88d8db2e1 FOREIGN KEY (project_id) REFERENCES public.projects(id) ON DELETE CASCADE; +ALTER TABLE ONLY public.resource_state_events + ADD CONSTRAINT fk_rails_c913c64977 FOREIGN KEY (epic_id) REFERENCES public.epics(id) ON DELETE CASCADE; + ALTER TABLE ONLY public.resource_milestone_events ADD CONSTRAINT fk_rails_c940fb9fc5 FOREIGN KEY (milestone_id) REFERENCES public.milestones(id) ON DELETE CASCADE; @@ -11920,6 +12452,9 @@ ALTER TABLE ONLY public.ci_daily_report_results ALTER TABLE ONLY public.issues_self_managed_prometheus_alert_events ADD CONSTRAINT fk_rails_cc5d88bbb0 FOREIGN KEY (issue_id) REFERENCES public.issues(id) ON DELETE CASCADE; +ALTER TABLE ONLY public.operations_strategies_user_lists + ADD CONSTRAINT fk_rails_ccb7e4bc0b FOREIGN KEY (user_list_id) REFERENCES public.operations_user_lists(id) ON DELETE CASCADE; + ALTER TABLE ONLY public.issue_tracker_data ADD CONSTRAINT fk_rails_ccc0840427 FOREIGN KEY (service_id) REFERENCES public.services(id) ON DELETE CASCADE; @@ -12019,6 +12554,9 @@ ALTER TABLE ONLY public.ci_daily_report_results ALTER TABLE ONLY public.cluster_providers_aws ADD CONSTRAINT fk_rails_ed1fdfaeb2 FOREIGN KEY (created_by_user_id) REFERENCES public.users(id) ON DELETE SET NULL; +ALTER TABLE ONLY public.ci_daily_build_group_report_results + ADD CONSTRAINT fk_rails_ee072d13b3 FOREIGN KEY (last_pipeline_id) REFERENCES public.ci_pipelines(id) ON DELETE CASCADE; + ALTER TABLE ONLY public.label_priorities ADD CONSTRAINT fk_rails_ef916d14fa FOREIGN KEY (project_id) REFERENCES public.projects(id) ON DELETE CASCADE; @@ -12052,6 +12590,9 @@ ALTER TABLE ONLY public.insights ALTER TABLE ONLY public.board_group_recent_visits ADD CONSTRAINT fk_rails_f410736518 FOREIGN KEY (group_id) REFERENCES public.namespaces(id) ON DELETE CASCADE; +ALTER TABLE ONLY public.resource_state_events + ADD CONSTRAINT fk_rails_f5827a7ccd FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE SET NULL; + ALTER TABLE ONLY public.design_user_mentions ADD CONSTRAINT fk_rails_f7075a53c1 FOREIGN KEY (design_id) REFERENCES public.design_management_designs(id) ON DELETE CASCADE; @@ -12082,6 +12623,9 @@ ALTER TABLE ONLY public.serverless_domain_cluster ALTER TABLE ONLY public.ci_job_variables ADD CONSTRAINT fk_rails_fbf3b34792 FOREIGN KEY (job_id) REFERENCES public.ci_builds(id) ON DELETE CASCADE; +ALTER TABLE ONLY public.packages_nuget_metadata + ADD CONSTRAINT fk_rails_fc0c19f5b4 FOREIGN KEY (package_id) REFERENCES public.packages_packages(id) ON DELETE CASCADE; + ALTER TABLE ONLY public.cluster_groups ADD CONSTRAINT fk_rails_fdb8648a96 FOREIGN KEY (cluster_id) REFERENCES public.clusters(id) ON DELETE CASCADE; @@ -13016,14 +13560,17 @@ COPY "schema_migrations" (version) FROM STDIN; 20200213204737 20200213220159 20200213220211 +20200213224220 20200214025454 20200214034836 20200214085940 20200214214934 20200215222507 20200215225103 +20200217210353 20200217223651 20200217225719 +20200218113721 20200219105209 20200219133859 20200219135440 @@ -13064,6 +13611,10 @@ COPY "schema_migrations" (version) FROM STDIN; 20200303055348 20200303074328 20200303181648 +20200304023245 +20200304023851 +20200304024025 +20200304024042 20200304085423 20200304090155 20200304121828 @@ -13094,6 +13645,7 @@ COPY "schema_migrations" (version) FROM STDIN; 20200310135818 20200310135823 20200310145304 +20200310215714 20200311074438 20200311082301 20200311084025 @@ -13108,6 +13660,7 @@ COPY "schema_migrations" (version) FROM STDIN; 20200311214912 20200312053852 20200312125121 +20200312134637 20200312160532 20200312163407 20200313101649 @@ -13136,6 +13689,7 @@ COPY "schema_migrations" (version) FROM STDIN; 20200319203901 20200320112455 20200320123839 +20200320212400 20200323011225 20200323011955 20200323071918 @@ -13169,18 +13723,27 @@ COPY "schema_migrations" (version) FROM STDIN; 20200331132103 20200331195952 20200331220930 +20200401091051 20200401095430 20200401211005 +20200402001106 +20200402115013 +20200402115623 20200402123926 20200402124802 20200402135250 20200402185044 +20200403132349 20200403184110 20200403185127 20200403185422 +20200406095930 +20200406100909 20200406102111 20200406102120 +20200406132529 20200406135648 +20200406141452 20200406192059 20200406193427 20200407094005 @@ -13189,7 +13752,10 @@ COPY "schema_migrations" (version) FROM STDIN; 20200407121321 20200407171133 20200407171417 +20200407182205 +20200407222647 20200408110856 +20200408125046 20200408133211 20200408153842 20200408154331 @@ -13203,18 +13769,103 @@ COPY "schema_migrations" (version) FROM STDIN; 20200408175424 20200408212219 20200409085956 +20200409105455 +20200409105456 20200409211607 +20200410104828 20200410232012 +20200411125656 20200413072059 +20200413230056 +20200414112444 +20200414114611 +20200414115801 20200414144547 +20200415153154 20200415160722 20200415161021 20200415161206 20200415192656 +20200415203024 +20200416005331 20200416111111 20200416120128 20200416120354 +20200417044453 +20200417075843 +20200417145946 +20200420092011 +20200420094444 +20200420104303 +20200420104323 +20200420115948 +20200420141733 +20200420162730 +20200420172113 +20200420172752 +20200420172927 +20200420201933 +20200421092907 +20200421111005 +20200421233150 +20200422091541 +20200422213749 +20200423075720 +20200423080334 +20200423080607 +20200423081409 +20200423081441 +20200423081519 +20200423101529 +20200424043515 +20200424050250 +20200424101920 +20200424135319 +20200427064130 +20200428134356 +20200429001827 +20200429002150 +20200429015603 +20200429181335 +20200429181955 +20200429182245 +20200430103158 +20200430130048 +20200505164958 +20200505171834 +20200505172405 +20200506085748 +20200506125731 +20200506154421 +20200507221434 +20200508091106 +20200511080113 +20200511083541 +20200511092246 +20200511092505 +20200511092714 +20200511115430 +20200511115431 +20200511121549 +20200511121610 +20200511121620 +20200511130129 +20200511130130 +20200511145545 20200511162057 20200511162115 +20200511220023 +20200512085150 +20200512164334 +20200513160930 +20200513171959 +20200513224143 +20200513234502 +20200513235347 +20200513235532 +20200514000009 +20200514000132 +20200514000340 +20200515155620 \. |