Commit b2ee26c9 authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch '30453-add-rubocop-to-enforce-text-columns-with-limit' into 'master'

Enforce text columns with a limit over strings on migrations

See merge request gitlab-org/gitlab!29304
parents ee10c8ed 54d2e98d
...@@ -5,7 +5,8 @@ ...@@ -5,7 +5,8 @@
# rubocop:disable Metrics/AbcSize # rubocop:disable Metrics/AbcSize
# rubocop:disable Migration/AddConcurrentForeignKey # rubocop:disable Migration/AddConcurrentForeignKey
# rubocop:disable Style/WordArray # rubocop:disable Style/WordArray
# rubocop:disable Migration/AddLimitToStringColumns # rubocop:disable Migration/PreventStrings
# rubocop:disable Migration/AddLimitToTextColumns
# rubocop:disable Migration/Datetime # rubocop:disable Migration/Datetime
class InitSchema < ActiveRecord::Migration[4.2] class InitSchema < ActiveRecord::Migration[4.2]
...@@ -1854,4 +1855,5 @@ 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" raise ActiveRecord::IrreversibleMigration, "The initial migration is not revertable"
end end
end end
# rubocop:enable Migration/AddLimitToStringColumns # rubocop:enable Migration/AddLimitToTextColumns
# rubocop:enable Migration/PreventStrings
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
class CreatePrometheusMetrics < ActiveRecord::Migration[4.2] class CreatePrometheusMetrics < ActiveRecord::Migration[4.2]
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/PreventStrings
def change def change
# rubocop:disable Migration/AddLimitToStringColumns
create_table :prometheus_metrics do |t| create_table :prometheus_metrics do |t|
t.references :project, index: true, foreign_key: { on_delete: :cascade }, null: false t.references :project, index: true, foreign_key: { on_delete: :cascade }, null: false
t.string :title, null: false t.string :title, null: false
...@@ -15,6 +15,6 @@ class CreatePrometheusMetrics < ActiveRecord::Migration[4.2] ...@@ -15,6 +15,6 @@ class CreatePrometheusMetrics < ActiveRecord::Migration[4.2]
t.integer :group, null: false, index: true t.integer :group, null: false, index: true
t.timestamps_with_timezone null: false t.timestamps_with_timezone null: false
end end
# rubocop:enable Migration/AddLimitToStringColumns
end end
# rubocop:enable Migration/PreventStrings
end end
...@@ -10,7 +10,7 @@ class CreateLfsFileLocks < ActiveRecord::Migration[4.2] ...@@ -10,7 +10,7 @@ class CreateLfsFileLocks < ActiveRecord::Migration[4.2]
t.references :project, null: false, foreign_key: { on_delete: :cascade } t.references :project, null: false, foreign_key: { on_delete: :cascade }
t.references :user, null: false, index: true, 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.datetime :created_at, null: false # rubocop:disable Migration/Datetime
t.string :path, limit: 511 t.string :path, limit: 511 # rubocop:disable Migration/PreventStrings
end end
add_index :lfs_file_locks, [:project_id, :path], unique: true add_index :lfs_file_locks, [:project_id, :path], unique: true
......
...@@ -7,7 +7,9 @@ class AddAutoDevopsDomainToApplicationSettings < ActiveRecord::Migration[4.2] ...@@ -7,7 +7,9 @@ class AddAutoDevopsDomainToApplicationSettings < ActiveRecord::Migration[4.2]
# Set this constant to true if this migration requires downtime. # Set this constant to true if this migration requires downtime.
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/PreventStrings
def change def change
add_column :application_settings, :auto_devops_domain, :string # rubocop:disable Migration/AddLimitToStringColumns add_column :application_settings, :auto_devops_domain, :string
end end
# rubocop:enable Migration/PreventStrings
end end
...@@ -7,10 +7,10 @@ class AddUploadsBuilderContext < ActiveRecord::Migration[4.2] ...@@ -7,10 +7,10 @@ class AddUploadsBuilderContext < ActiveRecord::Migration[4.2]
# Set this constant to true if this migration requires downtime. # Set this constant to true if this migration requires downtime.
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/PreventStrings
def change def change
# rubocop:disable Migration/AddLimitToStringColumns
add_column :uploads, :mount_point, :string add_column :uploads, :mount_point, :string
add_column :uploads, :secret, :string add_column :uploads, :secret, :string
# rubocop:enable Migration/AddLimitToStringColumns
end end
# rubocop:enable Migration/PreventStrings
end end
...@@ -9,7 +9,7 @@ class CreateChatopsTables < ActiveRecord::Migration[4.2] ...@@ -9,7 +9,7 @@ class CreateChatopsTables < ActiveRecord::Migration[4.2]
create_table :ci_pipeline_chat_data, id: :bigserial do |t| create_table :ci_pipeline_chat_data, id: :bigserial do |t|
t.integer :pipeline_id, null: false t.integer :pipeline_id, null: false
t.references :chat_name, foreign_key: { on_delete: :cascade }, 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 # A pipeline can only contain one row in this table, hence this index is
# unique. # unique.
......
...@@ -3,7 +3,9 @@ class AddExternalIpToClustersApplicationsIngress < ActiveRecord::Migration[4.2] ...@@ -3,7 +3,9 @@ class AddExternalIpToClustersApplicationsIngress < ActiveRecord::Migration[4.2]
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/PreventStrings
def change def change
add_column :clusters_applications_ingress, :external_ip, :string # rubocop:disable Migration/AddLimitToStringColumns add_column :clusters_applications_ingress, :external_ip, :string
end end
# rubocop:enable Migration/PreventStrings
end end
class CreateBadges < ActiveRecord::Migration[4.2] class CreateBadges < ActiveRecord::Migration[4.2]
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/PreventStrings
def change def change
# rubocop:disable Migration/AddLimitToStringColumns
create_table :badges do |t| create_table :badges do |t|
t.string :link_url, null: false t.string :link_url, null: false
t.string :image_url, null: false t.string :image_url, null: false
...@@ -12,9 +12,10 @@ class CreateBadges < ActiveRecord::Migration[4.2] ...@@ -12,9 +12,10 @@ class CreateBadges < ActiveRecord::Migration[4.2]
t.timestamps_with_timezone null: false t.timestamps_with_timezone null: false
end end
# rubocop:enable Migration/AddLimitToStringColumns
# rubocop:disable Migration/AddConcurrentForeignKey # rubocop:disable Migration/AddConcurrentForeignKey
add_foreign_key :badges, :namespaces, column: :group_id, on_delete: :cascade add_foreign_key :badges, :namespaces, column: :group_id, on_delete: :cascade
# rubocop:enable Migration/AddConcurrentForeignKey
end end
# rubocop:enable Migration/PreventStrings
end end
...@@ -13,8 +13,8 @@ class CreateClustersApplicationsRunners < ActiveRecord::Migration[4.2] ...@@ -13,8 +13,8 @@ class CreateClustersApplicationsRunners < ActiveRecord::Migration[4.2]
t.index :cluster_id, unique: true t.index :cluster_id, unique: true
t.integer :status, null: false t.integer :status, null: false
t.timestamps_with_timezone null: false t.timestamps_with_timezone null: false
t.string :version, null: false # rubocop:disable Migration/AddLimitToStringColumns t.string :version, null: false # rubocop:disable Migration/PreventStrings
t.text :status_reason t.text :status_reason # rubocop:disable Migration/AddLimitToTextColumns
end end
add_concurrent_foreign_key :clusters_applications_runners, :ci_runners, add_concurrent_foreign_key :clusters_applications_runners, :ci_runners,
......
...@@ -3,6 +3,6 @@ class AddPagesDomainVerification < ActiveRecord::Migration[4.2] ...@@ -3,6 +3,6 @@ class AddPagesDomainVerification < ActiveRecord::Migration[4.2]
def change def change
add_column :pages_domains, :verified_at, :datetime_with_timezone 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
end end
...@@ -4,6 +4,6 @@ class AddIpAddressToRunner < ActiveRecord::Migration[4.2] ...@@ -4,6 +4,6 @@ class AddIpAddressToRunner < ActiveRecord::Migration[4.2]
DOWNTIME = false DOWNTIME = false
def change 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
end end
...@@ -3,9 +3,11 @@ class AddUserInternalRegexToApplicationSetting < ActiveRecord::Migration[4.2] ...@@ -3,9 +3,11 @@ class AddUserInternalRegexToApplicationSetting < ActiveRecord::Migration[4.2]
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/PreventStrings
def up 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 end
# rubocop:enable Migration/PreventStrings
def down def down
remove_column :application_settings, :user_default_internal_regex remove_column :application_settings, :user_default_internal_regex
......
...@@ -6,6 +6,7 @@ class AddHeaderAndFooterBannersToAppearancesTable < ActiveRecord::Migration[4.2] ...@@ -6,6 +6,7 @@ class AddHeaderAndFooterBannersToAppearancesTable < ActiveRecord::Migration[4.2]
DOWNTIME = false DOWNTIME = false
def change def change
# rubocop:disable Migration/AddLimitToTextColumns
add_column :appearances, :header_message, :text add_column :appearances, :header_message, :text
add_column :appearances, :header_message_html, :text add_column :appearances, :header_message_html, :text
...@@ -14,5 +15,6 @@ class AddHeaderAndFooterBannersToAppearancesTable < ActiveRecord::Migration[4.2] ...@@ -14,5 +15,6 @@ class AddHeaderAndFooterBannersToAppearancesTable < ActiveRecord::Migration[4.2]
add_column :appearances, :message_background_color, :text add_column :appearances, :message_background_color, :text
add_column :appearances, :message_font_color, :text add_column :appearances, :message_font_color, :text
# rubocop:enable Migration/AddLimitToTextColumns
end end
end end
class AddExternalAuthMutualTlsFieldsToProjectSettings < ActiveRecord::Migration[4.2] class AddExternalAuthMutualTlsFieldsToProjectSettings < ActiveRecord::Migration[4.2]
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/PreventStrings
# rubocop:disable Migration/AddLimitToTextColumns
def change def change
# rubocop:disable Migration/AddLimitToStringColumns
add_column :application_settings, add_column :application_settings,
:external_auth_client_cert, :text :external_auth_client_cert, :text
add_column :application_settings, add_column :application_settings,
...@@ -13,6 +14,7 @@ class AddExternalAuthMutualTlsFieldsToProjectSettings < ActiveRecord::Migration[ ...@@ -13,6 +14,7 @@ class AddExternalAuthMutualTlsFieldsToProjectSettings < ActiveRecord::Migration[
:encrypted_external_auth_client_key_pass, :string :encrypted_external_auth_client_key_pass, :string
add_column :application_settings, add_column :application_settings,
:encrypted_external_auth_client_key_pass_iv, :string :encrypted_external_auth_client_key_pass_iv, :string
# rubocop:enable Migration/AddLimitToStringColumns
end end
# rubocop:enable Migration/AddLimitToTextColumns
# rubocop:enable Migration/PreventStrings
end end
class CreateDeployTokens < ActiveRecord::Migration[4.2] class CreateDeployTokens < ActiveRecord::Migration[4.2]
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/PreventStrings
def change def change
# rubocop:disable Migration/AddLimitToStringColumns
create_table :deploy_tokens do |t| create_table :deploy_tokens do |t|
t.boolean :revoked, default: false t.boolean :revoked, default: false
t.boolean :read_repository, null: false, default: false t.boolean :read_repository, null: false, default: false
...@@ -16,6 +16,6 @@ class CreateDeployTokens < ActiveRecord::Migration[4.2] ...@@ -16,6 +16,6 @@ class CreateDeployTokens < ActiveRecord::Migration[4.2]
t.index [:token, :expires_at, :id], where: "(revoked IS FALSE)" t.index [:token, :expires_at, :id], where: "(revoked IS FALSE)"
end end
# rubocop:enable Migration/AddLimitToStringColumns
end end
# rubocop:enable Migration/PreventStrings
end end
...@@ -3,6 +3,7 @@ class CreateApplicationSettingTerms < ActiveRecord::Migration[4.2] ...@@ -3,6 +3,7 @@ class CreateApplicationSettingTerms < ActiveRecord::Migration[4.2]
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/AddLimitToTextColumns
def change def change
create_table :application_setting_terms do |t| create_table :application_setting_terms do |t|
t.integer :cached_markdown_version t.integer :cached_markdown_version
...@@ -10,4 +11,5 @@ class CreateApplicationSettingTerms < ActiveRecord::Migration[4.2] ...@@ -10,4 +11,5 @@ class CreateApplicationSettingTerms < ActiveRecord::Migration[4.2]
t.text :terms_html t.text :terms_html
end end
end end
# rubocop:enable Migration/AddLimitToTextColumns
end end
...@@ -3,7 +3,8 @@ class CreateProjectMirrorData < ActiveRecord::Migration[4.2] ...@@ -3,7 +3,8 @@ class CreateProjectMirrorData < ActiveRecord::Migration[4.2]
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/AddLimitToStringColumns # rubocop:disable Migration/PreventStrings
# rubocop:disable Migration/AddLimitToTextColumns
def up def up
if table_exists?(:project_mirror_data) if table_exists?(:project_mirror_data)
add_column :project_mirror_data, :status, :string unless column_exists?(:project_mirror_data, :status) add_column :project_mirror_data, :status, :string unless column_exists?(:project_mirror_data, :status)
...@@ -18,7 +19,8 @@ class CreateProjectMirrorData < ActiveRecord::Migration[4.2] ...@@ -18,7 +19,8 @@ class CreateProjectMirrorData < ActiveRecord::Migration[4.2]
end end
end end
end end
# rubocop:enable Migration/AddLimitToStringColumns # rubocop:enable Migration/AddLimitToTextColumns
# rubocop:enable Migration/PreventStrings
def down def down
remove_column :project_mirror_data, :status remove_column :project_mirror_data, :status
......
...@@ -5,7 +5,7 @@ class CreateRemoteMirrors < ActiveRecord::Migration[4.2] ...@@ -5,7 +5,7 @@ class CreateRemoteMirrors < ActiveRecord::Migration[4.2]
disable_ddl_transaction! disable_ddl_transaction!
# rubocop:disable Migration/AddLimitToStringColumns # rubocop:disable Migration/PreventStrings
def up def up
return if table_exists?(:remote_mirrors) return if table_exists?(:remote_mirrors)
...@@ -20,7 +20,7 @@ class CreateRemoteMirrors < ActiveRecord::Migration[4.2] ...@@ -20,7 +20,7 @@ class CreateRemoteMirrors < ActiveRecord::Migration[4.2]
t.string :last_error t.string :last_error
t.boolean :only_protected_branches, default: false, null: false t.boolean :only_protected_branches, default: false, null: false
t.string :remote_name 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_iv
t.string :encrypted_credentials_salt t.string :encrypted_credentials_salt
...@@ -28,7 +28,7 @@ class CreateRemoteMirrors < ActiveRecord::Migration[4.2] ...@@ -28,7 +28,7 @@ class CreateRemoteMirrors < ActiveRecord::Migration[4.2]
t.timestamps null: false t.timestamps null: false
end end
end end
# rubocop:enable Migration/AddLimitToStringColumns # rubocop:enable Migration/PreventStrings
def down def down
# ee/db/migrate/20160321161032_create_remote_mirrors_ee.rb will remove the table # ee/db/migrate/20160321161032_create_remote_mirrors_ee.rb will remove the table
......
...@@ -3,11 +3,15 @@ class EnsureMissingColumnsToProjectMirrorData < ActiveRecord::Migration[4.2] ...@@ -3,11 +3,15 @@ class EnsureMissingColumnsToProjectMirrorData < ActiveRecord::Migration[4.2]
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/AddLimitToTextColumns
# rubocop:disable Migration/PreventStrings
def up 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, :status, :string unless column_exists?(:project_mirror_data, :status)
add_column :project_mirror_data, :jid, :string unless column_exists?(:project_mirror_data, :jid) # rubocop:disable Migration/AddLimitToStringColumns 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) add_column :project_mirror_data, :last_error, :text unless column_exists?(:project_mirror_data, :last_error)
end end
# rubocop:enable Migration/PreventStrings
# rubocop:enable Migration/AddLimitToTextColumns
def down def down
# db/migrate/20180502122856_create_project_mirror_data.rb will remove the table # db/migrate/20180502122856_create_project_mirror_data.rb will remove the table
......
...@@ -6,20 +6,20 @@ class CreateClustersApplicationsJupyter < ActiveRecord::Migration[4.2] ...@@ -6,20 +6,20 @@ class CreateClustersApplicationsJupyter < ActiveRecord::Migration[4.2]
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/PreventStrings
def change def change
# rubocop:disable Migration/AddLimitToStringColumns
create_table :clusters_applications_jupyter do |t| create_table :clusters_applications_jupyter do |t|
t.references :cluster, null: false, unique: true, foreign_key: { on_delete: :cascade } t.references :cluster, null: false, unique: true, foreign_key: { on_delete: :cascade }
t.references :oauth_application, foreign_key: { on_delete: :nullify } t.references :oauth_application, foreign_key: { on_delete: :nullify }
t.integer :status, null: false t.integer :status, null: false
t.string :version, null: false # rubocop:disable Migration/AddLimitToStringColumns t.string :version, null: false
t.string :hostname # rubocop:disable Migration/AddLimitToStringColumns t.string :hostname
t.timestamps_with_timezone null: false t.timestamps_with_timezone null: false
t.text :status_reason t.text :status_reason # rubocop:disable Migration/AddLimitToTextColumns
end end
# rubocop:enable Migration/AddLimitToStringColumns
end end
# rubocop:enable Migration/PreventStrings
end end
...@@ -3,8 +3,9 @@ class CreateNotesDiffFiles < ActiveRecord::Migration[4.2] ...@@ -3,8 +3,9 @@ class CreateNotesDiffFiles < ActiveRecord::Migration[4.2]
disable_ddl_transaction! disable_ddl_transaction!
# rubocop:disable Migration/AddLimitToTextColumns
# rubocop:disable Migration/PreventStrings
def change def change
# rubocop:disable Migration/AddLimitToStringColumns
create_table :note_diff_files do |t| create_table :note_diff_files do |t|
t.references :diff_note, references: :notes, null: false, index: { unique: true } t.references :diff_note, references: :notes, null: false, index: { unique: true }
t.text :diff, null: false t.text :diff, null: false
...@@ -19,6 +20,8 @@ class CreateNotesDiffFiles < ActiveRecord::Migration[4.2] ...@@ -19,6 +20,8 @@ class CreateNotesDiffFiles < ActiveRecord::Migration[4.2]
# rubocop:disable Migration/AddConcurrentForeignKey # rubocop:disable Migration/AddConcurrentForeignKey
add_foreign_key :note_diff_files, :notes, column: :diff_note_id, on_delete: :cascade add_foreign_key :note_diff_files, :notes, column: :diff_note_id, on_delete: :cascade
# rubocop:enable Migration/AddLimitToStringColumns # rubocop:enable Migration/AddConcurrentForeignKey
end end
# rubocop:enable Migration/PreventStrings
# rubocop:enable Migration/AddLimitToTextColumns
end end
...@@ -5,10 +5,11 @@ class EnsureRemoteMirrorColumns < ActiveRecord::Migration[4.2] ...@@ -5,10 +5,11 @@ class EnsureRemoteMirrorColumns < ActiveRecord::Migration[4.2]
disable_ddl_transaction! disable_ddl_transaction!
# rubocop:disable Migration/Datetime
# rubocop:disable Migration/PreventStrings
def up 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, :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) unless column_exists?(:remote_mirrors, :only_protected_branches)
add_column_with_default(:remote_mirrors, add_column_with_default(:remote_mirrors,
...@@ -18,6 +19,8 @@ class EnsureRemoteMirrorColumns < ActiveRecord::Migration[4.2] ...@@ -18,6 +19,8 @@ class EnsureRemoteMirrorColumns < ActiveRecord::Migration[4.2]
allow_null: false) allow_null: false)
end end
end end
# rubocop:enable Migration/PreventStrings
# rubocop:enable Migration/Datetime
def down def down
# db/migrate/20180503131624_create_remote_mirrors.rb will remove the table # db/migrate/20180503131624_create_remote_mirrors.rb will remove the table
......
...@@ -3,8 +3,8 @@ class AddRepositoryLanguages < ActiveRecord::Migration[4.2] ...@@ -3,8 +3,8 @@ class AddRepositoryLanguages < ActiveRecord::Migration[4.2]
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/PreventStrings
def up def up
# rubocop:disable Migration/AddLimitToStringColumns
create_table(:programming_languages) do |t| create_table(:programming_languages) do |t|
t.string :name, null: false t.string :name, null: false
t.string :color, null: false t.string :color, null: false
...@@ -20,8 +20,8 @@ class AddRepositoryLanguages < ActiveRecord::Migration[4.2] ...@@ -20,8 +20,8 @@ class AddRepositoryLanguages < ActiveRecord::Migration[4.2]
add_index :programming_languages, :name, unique: true add_index :programming_languages, :name, unique: true
add_index :repository_languages, [:project_id, :programming_language_id], add_index :repository_languages, [:project_id, :programming_language_id],
unique: true, name: "index_repository_languages_on_project_and_languages_id" unique: true, name: "index_repository_languages_on_project_and_languages_id"
# rubocop:enable Migration/AddLimitToStringColumns
end end
# rubocop:enable Migration/PreventStrings
def down def down
drop_table :repository_languages drop_table :repository_languages
......
...@@ -7,6 +7,6 @@ class AddPushEventsBranchFilterToWebHooks < ActiveRecord::Migration[4.2] ...@@ -7,6 +7,6 @@ class AddPushEventsBranchFilterToWebHooks < ActiveRecord::Migration[4.2]
DOWNTIME = false DOWNTIME = false
def change 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
end end
...@@ -4,9 +4,11 @@ class AddColumnsForHelmTillerCertificates < ActiveRecord::Migration[4.2] ...@@ -4,9 +4,11 @@ class AddColumnsForHelmTillerCertificates < ActiveRecord::Migration[4.2]
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/AddLimitToTextColumns
def change def change
add_column :clusters_applications_helm, :encrypted_ca_key, :text add_column :clusters_applications_helm, :encrypted_ca_key, :text
add_column :clusters_applications_helm, :encrypted_ca_key_iv, :text add_column :clusters_applications_helm, :encrypted_ca_key_iv, :text
add_column :clusters_applications_helm, :ca_cert, :text add_column :clusters_applications_helm, :ca_cert, :text
end end
# rubocop:enable Migration/AddLimitToTextColumns
end end
...@@ -7,8 +7,8 @@ class CreateCiBuildsRunnerSession < ActiveRecord::Migration[4.2] ...@@ -7,8 +7,8 @@ class CreateCiBuildsRunnerSession < ActiveRecord::Migration[4.2]
# Set this constant to true if this migration requires downtime. # Set this constant to true if this migration requires downtime.
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/PreventStrings
def change def change
# rubocop:disable Migration/AddLimitToStringColumns
create_table :ci_builds_runner_session, id: :bigserial do |t| create_table :ci_builds_runner_session, id: :bigserial do |t|
t.integer :build_id, null: false t.integer :build_id, null: false
t.string :url, null: false t.string :url, null: false
...@@ -18,6 +18,6 @@ class CreateCiBuildsRunnerSession < ActiveRecord::Migration[4.2] ...@@ -18,6 +18,6 @@ class CreateCiBuildsRunnerSession < ActiveRecord::Migration[4.2]
t.foreign_key :ci_builds, column: :build_id, on_delete: :cascade t.foreign_key :ci_builds, column: :build_id, on_delete: :cascade
t.index :build_id, unique: true t.index :build_id, unique: true
end end
# rubocop:enable Migration/AddLimitToStringColumns
end end
# rubocop:enable Migration/PreventStrings
end end
class CreateImportExportUploads < ActiveRecord::Migration[4.2] class CreateImportExportUploads < ActiveRecord::Migration[4.2]
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/AddLimitToTextColumns
def change def change
create_table :import_export_uploads do |t| create_table :import_export_uploads do |t|
t.datetime_with_timezone :updated_at, null: false t.datetime_with_timezone :updated_at, null: false
...@@ -13,4 +14,5 @@ class CreateImportExportUploads < ActiveRecord::Migration[4.2] ...@@ -13,4 +14,5 @@ class CreateImportExportUploads < ActiveRecord::Migration[4.2]
add_index :import_export_uploads, :updated_at add_index :import_export_uploads, :updated_at
end end
# rubocop:enable Migration/AddLimitToTextColumns
end end
...@@ -5,8 +5,8 @@ class CreateUserStatuses < ActiveRecord::Migration[4.2] ...@@ -5,8 +5,8 @@ class CreateUserStatuses < ActiveRecord::Migration[4.2]
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/PreventStrings
def change def change
# rubocop:disable Migration/AddLimitToStringColumns
create_table :user_statuses, id: false, primary_key: :user_id do |t| create_table :user_statuses, id: false, primary_key: :user_id do |t|
t.references :user, t.references :user,
foreign_key: { on_delete: :cascade }, foreign_key: { on_delete: :cascade },
...@@ -17,6 +17,6 @@ class CreateUserStatuses < ActiveRecord::Migration[4.2] ...@@ -17,6 +17,6 @@ class CreateUserStatuses < ActiveRecord::Migration[4.2]
t.string :message, limit: 100 t.string :message, limit: 100
t.string :message_html t.string :message_html
end end
# rubocop:enable Migration/AddLimitToStringColumns
end end
# rubocop:enable Migration/PreventStrings
end end
...@@ -27,11 +27,11 @@ class AddCommitEmailToUsers < ActiveRecord::Migration[4.2] ...@@ -27,11 +27,11 @@ class AddCommitEmailToUsers < ActiveRecord::Migration[4.2]
# comments: # comments:
# disable_ddl_transaction! # disable_ddl_transaction!
# rubocop:disable Migration/AddLimitToStringColumns # rubocop:disable Migration/PreventStrings
# rubocop:disable Migration/AddColumnsToWideTables # rubocop:disable Migration/AddColumnsToWideTables
def change def change
add_column :users, :commit_email, :string add_column :users, :commit_email, :string
end end
# rubocop:enable Migration/AddLimitToStringColumns
# rubocop:enable Migration/AddColumnsToWideTables # rubocop:enable Migration/AddColumnsToWideTables
# rubocop:enable Migration/PreventStrings
end end
...@@ -3,7 +3,9 @@ ...@@ -3,7 +3,9 @@
class AddOutboundRequestsWhitelistToApplicationSettings < ActiveRecord::Migration[5.1] class AddOutboundRequestsWhitelistToApplicationSettings < ActiveRecord::Migration[5.1]
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/PreventStrings
def change def change
add_column :application_settings, :outbound_local_requests_whitelist, :string, array: true, limit: 255 add_column :application_settings, :outbound_local_requests_whitelist, :string, array: true, limit: 255
end end
# rubocop:enable Migration/PreventStrings
end end
...@@ -6,6 +6,6 @@ class AddIdentifierToPrometheusMetric < ActiveRecord::Migration[4.2] ...@@ -6,6 +6,6 @@ class AddIdentifierToPrometheusMetric < ActiveRecord::Migration[4.2]
DOWNTIME = false DOWNTIME = false
def change def change
add_column :prometheus_metrics, :identifier, :string # rubocop:disable Migration/AddLimitToStringColumns add_column :prometheus_metrics, :identifier, :string # rubocop:disable Migration/PreventStrings
end end
end end
...@@ -3,9 +3,11 @@ ...@@ -3,9 +3,11 @@
class AddResourceLabelEventReferenceFields < ActiveRecord::Migration[4.2] class AddResourceLabelEventReferenceFields < ActiveRecord::Migration[4.2]
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/AddLimitToTextColumns
def change def change
add_column :resource_label_events, :cached_markdown_version, :integer add_column :resource_label_events, :cached_markdown_version, :integer
add_column :resource_label_events, :reference, :text add_column :resource_label_events, :reference, :text
add_column :resource_label_events, :reference_html, :text add_column :resource_label_events, :reference_html, :text
end end
# rubocop:enable Migration/AddLimitToTextColumns
end end
...@@ -5,13 +5,13 @@ class AddAttrEncryptedColumnsToWebHook < ActiveRecord::Migration[4.2] ...@@ -5,13 +5,13 @@ class AddAttrEncryptedColumnsToWebHook < ActiveRecord::Migration[4.2]
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/PreventStrings
def change def change
# rubocop:disable Migration/AddLimitToStringColumns
add_column :web_hooks, :encrypted_token, :string add_column :web_hooks, :encrypted_token, :string
add_column :web_hooks, :encrypted_token_iv, :string add_column :web_hooks, :encrypted_token_iv, :string
add_column :web_hooks, :encrypted_url, :string add_column :web_hooks, :encrypted_url, :string
add_column :web_hooks, :encrypted_url_iv, :string add_column :web_hooks, :encrypted_url_iv, :string
# rubocop:enable Migration/AddLimitToStringColumns
end end
# rubocop:enable Migration/PreventStrings
end end
...@@ -8,7 +8,7 @@ class AddTokenDigestToPersonalAccessTokens < ActiveRecord::Migration[4.2] ...@@ -8,7 +8,7 @@ class AddTokenDigestToPersonalAccessTokens < ActiveRecord::Migration[4.2]
def up def up
change_column :personal_access_tokens, :token, :string, null: true 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 end
def down def down
......
...@@ -5,8 +5,8 @@ class AddKnativeApplication < ActiveRecord::Migration[4.2] ...@@ -5,8 +5,8 @@ class AddKnativeApplication < ActiveRecord::Migration[4.2]
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/PreventStrings
def change def change
# rubocop:disable Migration/AddLimitToStringColumns
create_table "clusters_applications_knative" do |t| create_table "clusters_applications_knative" do |t|
t.references :cluster, null: false, unique: true, foreign_key: { on_delete: :cascade } t.references :cluster, null: false, unique: true, foreign_key: { on_delete: :cascade }
...@@ -15,8 +15,8 @@ class AddKnativeApplication < ActiveRecord::Migration[4.2] ...@@ -15,8 +15,8 @@ class AddKnativeApplication < ActiveRecord::Migration[4.2]
t.integer "status", null: false t.integer "status", null: false
t.string "version", null: false t.string "version", null: false
t.string "hostname" t.string "hostname"
t.text "status_reason" t.text "status_reason" # rubocop:disable Migration/AddLimitToTextColumns
end end
# rubocop:enable Migration/AddLimitToStringColumns
end end
# rubocop:enable Migration/PreventStrings
end end
...@@ -4,8 +4,8 @@ class CreateClustersKubernetesNamespaces < ActiveRecord::Migration[4.2] ...@@ -4,8 +4,8 @@ class CreateClustersKubernetesNamespaces < ActiveRecord::Migration[4.2]
DOWNTIME = false DOWNTIME = false
INDEX_NAME = 'kubernetes_namespaces_cluster_and_namespace' INDEX_NAME = 'kubernetes_namespaces_cluster_and_namespace'
# rubocop:disable Migration/PreventStrings
def change def change
# rubocop:disable Migration/AddLimitToStringColumns
create_table :clusters_kubernetes_namespaces, id: :bigserial do |t| create_table :clusters_kubernetes_namespaces, id: :bigserial do |t|
t.references :cluster, null: false, index: true, foreign_key: { on_delete: :cascade } t.references :cluster, null: false, index: true, foreign_key: { on_delete: :cascade }
t.references :project, index: true, foreign_key: { on_delete: :nullify } t.references :project, index: true, foreign_key: { on_delete: :nullify }
...@@ -17,10 +17,10 @@ class CreateClustersKubernetesNamespaces < ActiveRecord::Migration[4.2] ...@@ -17,10 +17,10 @@ class CreateClustersKubernetesNamespaces < ActiveRecord::Migration[4.2]
t.string :namespace, null: false t.string :namespace, null: false
t.string :service_account_name 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 t.index [:cluster_id, :namespace], name: INDEX_NAME, unique: true
end end
# rubocop:enable Migration/AddLimitToStringColumns
end end
# rubocop:enable Migration/PreventStrings
end end
...@@ -5,7 +5,7 @@ class AddShardsTable < ActiveRecord::Migration[4.2] ...@@ -5,7 +5,7 @@ class AddShardsTable < ActiveRecord::Migration[4.2]
def change def change
create_table :shards do |t| 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 end
end end
...@@ -6,7 +6,7 @@ class AddRepositoriesTable < ActiveRecord::Migration[4.2] ...@@ -6,7 +6,7 @@ class AddRepositoriesTable < ActiveRecord::Migration[4.2]
def change def change
create_table :repositories, id: :bigserial do |t| create_table :repositories, id: :bigserial do |t|
t.references :shard, null: false, index: true, foreign_key: { on_delete: :restrict } 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 end
add_column :projects, :pool_repository_id, :bigint # rubocop:disable Migration/AddColumnsToWideTables add_column :projects, :pool_repository_id, :bigint # rubocop:disable Migration/AddColumnsToWideTables
......
...@@ -5,7 +5,9 @@ class AddPrivateCommitEmailHostnameToApplicationSettings < ActiveRecord::Migrati ...@@ -5,7 +5,9 @@ class AddPrivateCommitEmailHostnameToApplicationSettings < ActiveRecord::Migrati
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/PreventStrings
def change 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 end
# rubocop:enable Migration/PreventStrings
end end
...@@ -10,7 +10,6 @@ class DropGcpClustersTable < ActiveRecord::Migration[4.2] ...@@ -10,7 +10,6 @@ class DropGcpClustersTable < ActiveRecord::Migration[4.2]
end end
def down def down
# rubocop:disable Migration/AddLimitToStringColumns
create_table :gcp_clusters do |t| create_table :gcp_clusters do |t|
# Order columns by best align scheme # Order columns by best align scheme
t.references :project, null: false, index: { unique: true }, foreign_key: { on_delete: :cascade } t.references :project, null: false, index: { unique: true }, foreign_key: { on_delete: :cascade }
...@@ -50,6 +49,5 @@ class DropGcpClustersTable < ActiveRecord::Migration[4.2] ...@@ -50,6 +49,5 @@ class DropGcpClustersTable < ActiveRecord::Migration[4.2]
t.text :encrypted_gcp_token t.text :encrypted_gcp_token
t.string :encrypted_gcp_token_iv t.string :encrypted_gcp_token_iv
end end
# rubocop:enable Migration/AddLimitToStringColumns
end end
end end
...@@ -5,17 +5,17 @@ class CreateClustersApplicationsCertManager < ActiveRecord::Migration[4.2] ...@@ -5,17 +5,17 @@ class CreateClustersApplicationsCertManager < ActiveRecord::Migration[4.2]
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/PreventStrings
def change def change
# rubocop:disable Migration/AddLimitToStringColumns
create_table :clusters_applications_cert_managers do |t| create_table :clusters_applications_cert_managers do |t|
t.references :cluster, null: false, index: false, foreign_key: { on_delete: :cascade } t.references :cluster, null: false, index: false, foreign_key: { on_delete: :cascade }
t.integer :status, null: false t.integer :status, null: false
t.string :version, null: false t.string :version, null: false
t.string :email, null: false t.string :email, null: false
t.timestamps_with_timezone 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 t.index :cluster_id, unique: true
end end
# rubocop:enable Migration/AddLimitToStringColumns
end end
# rubocop:enable Migration/PreventStrings
end end
...@@ -5,7 +5,9 @@ class AddEncryptedRunnersTokenToSettings < ActiveRecord::Migration[4.2] ...@@ -5,7 +5,9 @@ class AddEncryptedRunnersTokenToSettings < ActiveRecord::Migration[4.2]
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/PreventStrings
def change 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 end
# rubocop:enable Migration/PreventStrings
end end
...@@ -8,7 +8,9 @@ class KnativeExternalIp < ActiveRecord::Migration[4.2] ...@@ -8,7 +8,9 @@ class KnativeExternalIp < ActiveRecord::Migration[4.2]
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/PreventStrings
def change def change
add_column :clusters_applications_knative, :external_ip, :string # rubocop:disable Migration/AddLimitToStringColumns add_column :clusters_applications_knative, :external_ip, :string
end end
# rubocop:enable Migration/PreventStrings
end end
...@@ -5,7 +5,9 @@ class AddEncryptedRunnersTokenToNamespaces < ActiveRecord::Migration[4.2] ...@@ -5,7 +5,9 @@ class AddEncryptedRunnersTokenToNamespaces < ActiveRecord::Migration[4.2]
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/PreventStrings
def change def change
add_column :namespaces, :runners_token_encrypted, :string # rubocop:disable Migration/AddLimitToStringColumns add_column :namespaces, :runners_token_encrypted, :string
end end
# rubocop:enable Migration/PreventStrings
end end
...@@ -6,10 +6,10 @@ class AddEncryptedRunnersTokenToProjects < ActiveRecord::Migration[4.2] ...@@ -6,10 +6,10 @@ class AddEncryptedRunnersTokenToProjects < ActiveRecord::Migration[4.2]
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/AddColumnsToWideTables # rubocop:disable Migration/AddColumnsToWideTables
# rubocop:disable Migration/AddLimitToStringColumns # rubocop:disable Migration/PreventStrings
def change def change
add_column :projects, :runners_token_encrypted, :string add_column :projects, :runners_token_encrypted, :string
end end
# rubocop:enable Migration/PreventStrings
# rubocop:enable Migration/AddColumnsToWideTables # rubocop:enable Migration/AddColumnsToWideTables
# rubocop:enable Migration/AddLimitToStringColumns
end end
...@@ -6,6 +6,6 @@ class AddTokenEncryptedToCiRunners < ActiveRecord::Migration[4.2] ...@@ -6,6 +6,6 @@ class AddTokenEncryptedToCiRunners < ActiveRecord::Migration[4.2]
DOWNTIME = false DOWNTIME = false
def change 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
end end
...@@ -11,7 +11,7 @@ class CreateProjectRepositories < ActiveRecord::Migration[5.0] ...@@ -11,7 +11,7 @@ class CreateProjectRepositories < ActiveRecord::Migration[5.0]
def change def change
create_table :project_repositories, id: :bigserial do |t| create_table :project_repositories, id: :bigserial do |t|
t.references :shard, null: false, index: true, foreign_key: { on_delete: :restrict } 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 } t.references :project, null: false, index: { unique: true }, foreign_key: { on_delete: :cascade }
end end
end end
......
...@@ -3,12 +3,14 @@ ...@@ -3,12 +3,14 @@
class CreateSuggestions < ActiveRecord::Migration[5.0] class CreateSuggestions < ActiveRecord::Migration[5.0]
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/PreventStrings
# rubocop:disable Migration/AddLimitToTextColumns
def change def change
create_table :suggestions, id: :bigserial do |t| create_table :suggestions, id: :bigserial do |t|
t.references :note, foreign_key: { on_delete: :cascade }, null: false t.references :note, foreign_key: { on_delete: :cascade }, null: false
t.integer :relative_order, null: false, limit: 2 t.integer :relative_order, null: false, limit: 2
t.boolean :applied, null: false, default: false 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 :from_content, null: false
t.text :to_content, null: false t.text :to_content, null: false
...@@ -17,4 +19,6 @@ class CreateSuggestions < ActiveRecord::Migration[5.0] ...@@ -17,4 +19,6 @@ class CreateSuggestions < ActiveRecord::Migration[5.0]
unique: true unique: true
end end
end end
# rubocop:enable Migration/AddLimitToTextColumns
# rubocop:enable Migration/PreventStrings
end end
...@@ -7,13 +7,17 @@ class AddStateToPoolRepository < ActiveRecord::Migration[5.0] ...@@ -7,13 +7,17 @@ class AddStateToPoolRepository < ActiveRecord::Migration[5.0]
# Given the table is empty, and the non concurrent methods are chosen so # Given the table is empty, and the non concurrent methods are chosen so
# the transactions don't have to be disabled # 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 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_column :pool_repositories, :source_project_id, :integer
add_index :pool_repositories, :source_project_id, unique: true add_index :pool_repositories, :source_project_id, unique: true
add_foreign_key :pool_repositories, :projects, column: :source_project_id, on_delete: :nullify add_foreign_key :pool_repositories, :projects, column: :source_project_id, on_delete: :nullify
end end
# rubocop: enable Migration/AddConcurrentForeignKey, Migration/AddIndex # rubocop:enable Migration/PreventStrings
# rubocop:enable Migration/AddIndex
# rubocop:enable Migration/AddConcurrentForeignKey
end end
...@@ -6,10 +6,10 @@ class AddTokenEncryptedToCiBuilds < ActiveRecord::Migration[5.0] ...@@ -6,10 +6,10 @@ class AddTokenEncryptedToCiBuilds < ActiveRecord::Migration[5.0]
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/AddColumnsToWideTables # rubocop:disable Migration/AddColumnsToWideTables
# rubocop:disable Migration/AddLimitToStringColumns # rubocop:disable Migration/PreventStrings
def change def change
add_column :ci_builds, :token_encrypted, :string add_column :ci_builds, :token_encrypted, :string
end end
# rubocop:enable Migration/PreventStrings
# rubocop:enable Migration/AddColumnsToWideTables # rubocop:enable Migration/AddColumnsToWideTables
# rubocop:enable Migration/AddLimitToStringColumns
end end
...@@ -4,10 +4,10 @@ class AddProjectBfgObjectMapColumn < ActiveRecord::Migration[5.0] ...@@ -4,10 +4,10 @@ class AddProjectBfgObjectMapColumn < ActiveRecord::Migration[5.0]
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/AddColumnsToWideTables # rubocop:disable Migration/AddColumnsToWideTables
# rubocop:disable Migration/AddLimitToStringColumns # rubocop:disable Migration/PreventStrings
def change def change
add_column :projects, :bfg_object_map, :string add_column :projects, :bfg_object_map, :string
end end
# rubocop:enable Migration/PreventStrings
# rubocop:enable Migration/AddColumnsToWideTables # rubocop:enable Migration/AddColumnsToWideTables
# rubocop:enable Migration/AddLimitToStringColumns
end end
...@@ -5,9 +5,11 @@ class AddNameAuthorIdAndShaToReleases < ActiveRecord::Migration[5.0] ...@@ -5,9 +5,11 @@ class AddNameAuthorIdAndShaToReleases < ActiveRecord::Migration[5.0]
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/PreventStrings
def change def change
add_column :releases, :author_id, :integer add_column :releases, :author_id, :integer
add_column :releases, :name, :string # rubocop:disable Migration/AddLimitToStringColumns add_column :releases, :name, :string
add_column :releases, :sha, :string # rubocop:disable Migration/AddLimitToStringColumns add_column :releases, :sha, :string
end end
# rubocop:enable Migration/PreventStrings
end end
...@@ -5,8 +5,8 @@ class CreateErrorTrackingSettings < ActiveRecord::Migration[5.0] ...@@ -5,8 +5,8 @@ class CreateErrorTrackingSettings < ActiveRecord::Migration[5.0]
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/PreventStrings
def change def change
# rubocop:disable Migration/AddLimitToStringColumns
create_table :project_error_tracking_settings, id: :int, primary_key: :project_id, default: nil do |t| create_table :project_error_tracking_settings, id: :int, primary_key: :project_id, default: nil do |t|
t.boolean :enabled, null: false, default: true t.boolean :enabled, null: false, default: true
t.string :api_url, null: false t.string :api_url, null: false
...@@ -14,6 +14,6 @@ class CreateErrorTrackingSettings < ActiveRecord::Migration[5.0] ...@@ -14,6 +14,6 @@ class CreateErrorTrackingSettings < ActiveRecord::Migration[5.0]
t.string :encrypted_token_iv t.string :encrypted_token_iv
t.foreign_key :projects, column: :project_id, on_delete: :cascade t.foreign_key :projects, column: :project_id, on_delete: :cascade
end end
# rubocop:enable Migration/AddLimitToStringColumns
end end
# rubocop:enable Migration/PreventStrings
end end
...@@ -5,8 +5,8 @@ class CreateReleasesLinkTable < ActiveRecord::Migration[5.0] ...@@ -5,8 +5,8 @@ class CreateReleasesLinkTable < ActiveRecord::Migration[5.0]
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/PreventStrings
def change def change
# rubocop:disable Migration/AddLimitToStringColumns
create_table :release_links, id: :bigserial do |t| create_table :release_links, id: :bigserial do |t|
t.references :release, null: false, index: false, foreign_key: { on_delete: :cascade } t.references :release, null: false, index: false, foreign_key: { on_delete: :cascade }
t.string :url, null: false t.string :url, null: false
...@@ -16,6 +16,6 @@ class CreateReleasesLinkTable < ActiveRecord::Migration[5.0] ...@@ -16,6 +16,6 @@ class CreateReleasesLinkTable < ActiveRecord::Migration[5.0]
t.index [:release_id, :url], unique: true t.index [:release_id, :url], unique: true
t.index [:release_id, :name], unique: true t.index [:release_id, :name], unique: true
end end
# rubocop:enable Migration/AddLimitToStringColumns
end end
# rubocop:enable Migration/PreventStrings
end end
...@@ -11,7 +11,7 @@ class AddMergeRequestExternalDiffs < ActiveRecord::Migration[5.0] ...@@ -11,7 +11,7 @@ class AddMergeRequestExternalDiffs < ActiveRecord::Migration[5.0]
def change def change
# Allow the merge request diff to store details about an external file # 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, :external_diff_store, :integer
add_column :merge_request_diffs, :stored_externally, :boolean add_column :merge_request_diffs, :stored_externally, :boolean
......
...@@ -4,6 +4,6 @@ class AddDomainToCluster < ActiveRecord::Migration[5.0] ...@@ -4,6 +4,6 @@ class AddDomainToCluster < ActiveRecord::Migration[5.0]
DOWNTIME = false DOWNTIME = false
def change def change
add_column :clusters, :domain, :string # rubocop:disable Migration/AddLimitToStringColumns add_column :clusters, :domain, :string # rubocop:disable Migration/PreventStrings
end end
end end
...@@ -5,12 +5,14 @@ class AddColumnsProjectErrorTrackingSettings < ActiveRecord::Migration[5.0] ...@@ -5,12 +5,14 @@ class AddColumnsProjectErrorTrackingSettings < ActiveRecord::Migration[5.0]
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/PreventStrings
def change def change
add_column :project_error_tracking_settings, :project_name, :string # rubocop:disable Migration/AddLimitToStringColumns add_column :project_error_tracking_settings, :project_name, :string
add_column :project_error_tracking_settings, :organization_name, :string # rubocop:disable Migration/AddLimitToStringColumns add_column :project_error_tracking_settings, :organization_name, :string
change_column_default :project_error_tracking_settings, :enabled, from: true, to: false change_column_default :project_error_tracking_settings, :enabled, from: true, to: false
change_column_null :project_error_tracking_settings, :api_url, true change_column_null :project_error_tracking_settings, :api_url, true
end end
# rubocop:enable Migration/PreventStrings
end end
...@@ -9,10 +9,12 @@ class AddSortingFieldsToUserPreference < ActiveRecord::Migration[5.0] ...@@ -9,10 +9,12 @@ class AddSortingFieldsToUserPreference < ActiveRecord::Migration[5.0]
# Set this constant to true if this migration requires downtime. # Set this constant to true if this migration requires downtime.
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/PreventStrings
def up def up
add_column :user_preferences, :issues_sort, :string # rubocop:disable Migration/AddLimitToStringColumns add_column :user_preferences, :issues_sort, :string
add_column :user_preferences, :merge_requests_sort, :string # rubocop:disable Migration/AddLimitToStringColumns add_column :user_preferences, :merge_requests_sort, :string
end end
# rubocop:enable Migration/PreventStrings
def down def down
remove_column :user_preferences, :issues_sort remove_column :user_preferences, :issues_sort
......
...@@ -6,11 +6,15 @@ class AddAssetProxySettings < ActiveRecord::Migration[5.0] ...@@ -6,11 +6,15 @@ class AddAssetProxySettings < ActiveRecord::Migration[5.0]
# Set this constant to true if this migration requires downtime. # Set this constant to true if this migration requires downtime.
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/PreventStrings
# rubocop:disable Migration/AddLimitToTextColumns
def change def change
add_column :application_settings, :asset_proxy_enabled, :boolean, default: false, null: false 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, :asset_proxy_whitelist, :text
add_column :application_settings, :encrypted_asset_proxy_secret_key, :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 end
# rubocop:enable Migration/AddLimitToTextColumns
# rubocop:enable Migration/PreventStrings
end end
...@@ -3,8 +3,10 @@ ...@@ -3,8 +3,10 @@
class AddExternalHostnameToIngressAndKnative < ActiveRecord::Migration[5.0] class AddExternalHostnameToIngressAndKnative < ActiveRecord::Migration[5.0]
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/PreventStrings
def change def change
add_column :clusters_applications_ingress, :external_hostname, :string # rubocop:disable Migration/AddLimitToStringColumns add_column :clusters_applications_ingress, :external_hostname, :string
add_column :clusters_applications_knative, :external_hostname, :string # rubocop:disable Migration/AddLimitToStringColumns add_column :clusters_applications_knative, :external_hostname, :string
end end
# rubocop:enable Migration/PreventStrings
end end
...@@ -9,7 +9,9 @@ class AddLetsEncryptNotificationEmailToApplicationSettings < ActiveRecord::Migra ...@@ -9,7 +9,9 @@ class AddLetsEncryptNotificationEmailToApplicationSettings < ActiveRecord::Migra
# Set this constant to true if this migration requires downtime. # Set this constant to true if this migration requires downtime.
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/PreventStrings
def change 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 end
# rubocop:enable Migration/PreventStrings
end end
...@@ -11,7 +11,7 @@ class AddFieldsToUserPreferences < ActiveRecord::Migration[5.0] ...@@ -11,7 +11,7 @@ class AddFieldsToUserPreferences < ActiveRecord::Migration[5.0]
DOWNTIME = false DOWNTIME = false
def up 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_display_relative, :boolean)
add_column(:user_preferences, :time_format_in_24h, :boolean) add_column(:user_preferences, :time_format_in_24h, :boolean)
end end
......
...@@ -5,7 +5,9 @@ class AddNotificationEmailToNotificationSettings < ActiveRecord::Migration[5.0] ...@@ -5,7 +5,9 @@ class AddNotificationEmailToNotificationSettings < ActiveRecord::Migration[5.0]
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/PreventStrings
def change def change
add_column :notification_settings, :notification_email, :string # rubocop:disable Migration/AddLimitToStringColumns add_column :notification_settings, :notification_email, :string
end end
# rubocop:enable Migration/PreventStrings
end end
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
# rubocop: disable Metrics/AbcSize # rubocop: disable Metrics/AbcSize
# rubocop: disable Migration/Datetime # rubocop: disable Migration/Datetime
# rubocop: disable Migration/AddLimitToStringColumns # rubocop: disable Migration/PreventStrings
# rubocop: disable Migration/AddLimitToTextColumns
class BackportEnterpriseSchema < ActiveRecord::Migration[5.0] class BackportEnterpriseSchema < ActiveRecord::Migration[5.0]
include Gitlab::Database::MigrationHelpers include Gitlab::Database::MigrationHelpers
...@@ -2188,4 +2189,5 @@ class BackportEnterpriseSchema < ActiveRecord::Migration[5.0] ...@@ -2188,4 +2189,5 @@ class BackportEnterpriseSchema < ActiveRecord::Migration[5.0]
end end
# rubocop: enable Metrics/AbcSize # rubocop: enable Metrics/AbcSize
# rubocop: enable Migration/Datetime # rubocop: enable Migration/Datetime
# rubocop: enable Migration/AddLimitToStringColumns # rubocop: enable Migration/PreventStrings
# rubocop: enable Migration/AddLimitToTextColumns
...@@ -10,7 +10,7 @@ class AddNameToGeoNodes < ActiveRecord::Migration[5.0] ...@@ -10,7 +10,7 @@ class AddNameToGeoNodes < ActiveRecord::Migration[5.0]
DOWNTIME = false DOWNTIME = false
def up 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, # url is also unique, and its type and size is identical to the name column,
# so this is safe. # so this is safe.
......
...@@ -5,7 +5,7 @@ class AddCommentToVulnerabilityFeedback < ActiveRecord::Migration[5.1] ...@@ -5,7 +5,7 @@ class AddCommentToVulnerabilityFeedback < ActiveRecord::Migration[5.1]
def up def up
add_column :vulnerability_feedback, :comment_author_id, :integer 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 add_column :vulnerability_feedback, :comment_timestamp, :datetime_with_timezone
end end
......
...@@ -7,7 +7,7 @@ class CreateProjectMetricsSettings < ActiveRecord::Migration[5.0] ...@@ -7,7 +7,7 @@ class CreateProjectMetricsSettings < ActiveRecord::Migration[5.0]
def change def change
create_table :project_metrics_settings, id: :int, primary_key: :project_id, default: nil do |t| 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 t.foreign_key :projects, column: :project_id, on_delete: :cascade
end end
end end
......
...@@ -9,8 +9,9 @@ class CreatePagesDomainAcmeOrders < ActiveRecord::Migration[5.1] ...@@ -9,8 +9,9 @@ class CreatePagesDomainAcmeOrders < ActiveRecord::Migration[5.1]
# Set this constant to true if this migration requires downtime. # Set this constant to true if this migration requires downtime.
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/PreventStrings
# rubocop:disable Migration/AddLimitToTextColumns
def change def change
# rubocop:disable Migration/AddLimitToStringColumns
create_table :pages_domain_acme_orders do |t| create_table :pages_domain_acme_orders do |t|
t.references :pages_domain, null: false, index: true, foreign_key: { on_delete: :cascade }, type: :integer 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] ...@@ -25,6 +26,7 @@ class CreatePagesDomainAcmeOrders < ActiveRecord::Migration[5.1]
t.text :encrypted_private_key, null: false t.text :encrypted_private_key, null: false
t.text :encrypted_private_key_iv, null: false t.text :encrypted_private_key_iv, null: false
end end
# rubocop:enable Migration/AddLimitToStringColumns
end end
# rubocop:enable Migration/AddLimitToTextColumns
# rubocop:enable Migration/PreventStrings
end end
...@@ -8,8 +8,8 @@ class CreateIssueTrackerData < ActiveRecord::Migration[5.1] ...@@ -8,8 +8,8 @@ class CreateIssueTrackerData < ActiveRecord::Migration[5.1]
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/PreventStrings
def change def change
# rubocop:disable Migration/AddLimitToStringColumns
create_table :issue_tracker_data do |t| create_table :issue_tracker_data do |t|
t.references :service, foreign_key: { on_delete: :cascade }, type: :integer, index: true, null: false t.references :service, foreign_key: { on_delete: :cascade }, type: :integer, index: true, null: false
t.timestamps_with_timezone t.timestamps_with_timezone
...@@ -20,6 +20,6 @@ class CreateIssueTrackerData < ActiveRecord::Migration[5.1] ...@@ -20,6 +20,6 @@ class CreateIssueTrackerData < ActiveRecord::Migration[5.1]
t.string :encrypted_new_issue_url t.string :encrypted_new_issue_url
t.string :encrypted_new_issue_url_iv t.string :encrypted_new_issue_url_iv
end end
# rubocop:enable Migration/AddLimitToStringColumns
end end
# rubocop:enable Migration/PreventStrings
end end
...@@ -8,8 +8,8 @@ class CreateJiraTrackerData < ActiveRecord::Migration[5.1] ...@@ -8,8 +8,8 @@ class CreateJiraTrackerData < ActiveRecord::Migration[5.1]
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/PreventStrings
def change def change
# rubocop:disable Migration/AddLimitToStringColumns
create_table :jira_tracker_data do |t| create_table :jira_tracker_data do |t|
t.references :service, foreign_key: { on_delete: :cascade }, type: :integer, index: true, null: false t.references :service, foreign_key: { on_delete: :cascade }, type: :integer, index: true, null: false
t.timestamps_with_timezone t.timestamps_with_timezone
...@@ -23,6 +23,6 @@ class CreateJiraTrackerData < ActiveRecord::Migration[5.1] ...@@ -23,6 +23,6 @@ class CreateJiraTrackerData < ActiveRecord::Migration[5.1]
t.string :encrypted_password_iv t.string :encrypted_password_iv
t.string :jira_issue_transition_id t.string :jira_issue_transition_id
end end
# rubocop:enable Migration/AddLimitToStringColumns
end end
# rubocop:enable Migration/PreventStrings
end end
...@@ -12,7 +12,7 @@ class CreateIpRestriction < ActiveRecord::Migration[5.1] ...@@ -12,7 +12,7 @@ class CreateIpRestriction < ActiveRecord::Migration[5.1]
type: :integer, type: :integer,
null: false, null: false,
index: true index: true
t.string :range, null: false # rubocop:disable Migration/AddLimitToStringColumns t.string :range, null: false # rubocop:disable Migration/PreventStrings
end end
add_foreign_key(:ip_restrictions, :namespaces, column: :group_id, on_delete: :cascade) # rubocop: disable Migration/AddConcurrentForeignKey add_foreign_key(:ip_restrictions, :namespaces, column: :group_id, on_delete: :cascade) # rubocop: disable Migration/AddConcurrentForeignKey
......
...@@ -9,8 +9,10 @@ class AddLetsEncryptPrivateKeyToApplicationSettings < ActiveRecord::Migration[5. ...@@ -9,8 +9,10 @@ class AddLetsEncryptPrivateKeyToApplicationSettings < ActiveRecord::Migration[5.
# Set this constant to true if this migration requires downtime. # Set this constant to true if this migration requires downtime.
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/AddLimitToTextColumns
def change def change
add_column :application_settings, :encrypted_lets_encrypt_private_key, :text add_column :application_settings, :encrypted_lets_encrypt_private_key, :text
add_column :application_settings, :encrypted_lets_encrypt_private_key_iv, :text add_column :application_settings, :encrypted_lets_encrypt_private_key_iv, :text
end end
# rubocop:enable Migration/AddLimitToTextColumns
end end
...@@ -9,7 +9,9 @@ class AddRequiredTemplateNameToApplicationSettings < ActiveRecord::Migration[5.1 ...@@ -9,7 +9,9 @@ class AddRequiredTemplateNameToApplicationSettings < ActiveRecord::Migration[5.1
# Set this constant to true if this migration requires downtime. # Set this constant to true if this migration requires downtime.
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/PreventStrings
def change 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 end
# rubocop:enable Migration/PreventStrings
end end
...@@ -5,7 +5,9 @@ class AddTokenEncryptedToOperationsFeatureFlagsClients < ActiveRecord::Migration ...@@ -5,7 +5,9 @@ class AddTokenEncryptedToOperationsFeatureFlagsClients < ActiveRecord::Migration
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/PreventStrings
def change 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 end
# rubocop:enable Migration/PreventStrings
end end
...@@ -6,6 +6,6 @@ class AddNameToBadges < ActiveRecord::Migration[5.0] ...@@ -6,6 +6,6 @@ class AddNameToBadges < ActiveRecord::Migration[5.0]
DOWNTIME = false DOWNTIME = false
def change 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
end end
...@@ -5,10 +5,14 @@ class AddTargetProjectIdToMergeTrains < ActiveRecord::Migration[5.1] ...@@ -5,10 +5,14 @@ class AddTargetProjectIdToMergeTrains < ActiveRecord::Migration[5.1]
DOWNTIME = false DOWNTIME = false
# rubocop:disable Rails/NotNullColumn
# rubocop:disable Migration/AddReference
# rubocop:disable Migration/AddLimitToTextColumns
def change 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_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 add_column :merge_trains, :target_branch, :text, null: false
# rubocop:enable Rails/NotNullColumn, Migration/AddReference
end end
# rubocop:enable Migration/AddLimitToTextColumns
# rubocop:enable Migration/AddReference
# rubocop:enable Rails/NotNullColumn
end end
...@@ -4,6 +4,6 @@ class AddUsernameToDeployTokens < ActiveRecord::Migration[5.1] ...@@ -4,6 +4,6 @@ class AddUsernameToDeployTokens < ActiveRecord::Migration[5.1]
DOWNTIME = false DOWNTIME = false
def change def change
add_column :deploy_tokens, :username, :string # rubocop:disable Migration/AddLimitToStringColumns add_column :deploy_tokens, :username, :string # rubocop:disable Migration/PreventStrings
end end
end end
...@@ -8,7 +8,7 @@ class CreateProjectAliases < ActiveRecord::Migration[5.1] ...@@ -8,7 +8,7 @@ class CreateProjectAliases < ActiveRecord::Migration[5.1]
def change def change
create_table :project_aliases do |t| create_table :project_aliases do |t|
t.references :project, null: false, index: true, foreign_key: { on_delete: :cascade }, type: :integer 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 t.timestamps_with_timezone null: false
end end
......
...@@ -4,6 +4,6 @@ class AddMergeRequestRebaseJid < ActiveRecord::Migration[5.1] ...@@ -4,6 +4,6 @@ class AddMergeRequestRebaseJid < ActiveRecord::Migration[5.1]
DOWNTIME = false DOWNTIME = false
def change 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
end end
...@@ -7,12 +7,12 @@ class AddGrafanaUrlToSettings < ActiveRecord::Migration[5.1] ...@@ -7,12 +7,12 @@ class AddGrafanaUrlToSettings < ActiveRecord::Migration[5.1]
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/PreventStrings
def up def up
# rubocop:disable Migration/AddLimitToStringColumns
add_column_with_default(:application_settings, :grafana_url, :string, add_column_with_default(:application_settings, :grafana_url, :string,
default: '/-/grafana', allow_null: false) default: '/-/grafana', allow_null: false)
# rubocop:enable Migration/AddLimitToStringColumns
end end
# rubocop:enable Migration/PreventStrings
def down def down
remove_column(:application_settings, :grafana_url) remove_column(:application_settings, :grafana_url)
......
...@@ -9,6 +9,6 @@ class AddDescriptionToServices < ActiveRecord::Migration[5.1] ...@@ -9,6 +9,6 @@ class AddDescriptionToServices < ActiveRecord::Migration[5.1]
DOWNTIME = false DOWNTIME = false
def change def change
add_column :services, :description, :string, limit: 500 add_column :services, :description, :string, limit: 500 # rubocop:disable Migration/PreventStrings
end end
end end
...@@ -9,8 +9,9 @@ class CreateJobVariables < ActiveRecord::Migration[5.1] ...@@ -9,8 +9,9 @@ class CreateJobVariables < ActiveRecord::Migration[5.1]
# Set this constant to true if this migration requires downtime. # Set this constant to true if this migration requires downtime.
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/PreventStrings
# rubocop:disable Migration/AddLimitToTextColumns
def change def change
# rubocop:disable Migration/AddLimitToStringColumns
create_table :ci_job_variables do |t| create_table :ci_job_variables do |t|
t.string :key, null: false t.string :key, null: false
t.text :encrypted_value t.text :encrypted_value
...@@ -18,8 +19,9 @@ class CreateJobVariables < ActiveRecord::Migration[5.1] ...@@ -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.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 t.integer :variable_type, null: false, limit: 2, default: 1
end end
# rubocop:enable Migration/AddLimitToStringColumns
add_index :ci_job_variables, [:key, :job_id], unique: true add_index :ci_job_variables, [:key, :job_id], unique: true
end end
# rubocop:enable Migration/AddLimitToTextColumns
# rubocop:enable Migration/PreventStrings
end end
...@@ -5,7 +5,9 @@ class AddTokenEncryptedToDeployTokens < ActiveRecord::Migration[5.1] ...@@ -5,7 +5,9 @@ class AddTokenEncryptedToDeployTokens < ActiveRecord::Migration[5.1]
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/PreventStrings
def change def change
add_column :deploy_tokens, :token_encrypted, :string, limit: 255 add_column :deploy_tokens, :token_encrypted, :string, limit: 255
end end
# rubocop:enable Migration/PreventStrings
end end
...@@ -26,7 +26,7 @@ class CreateAnalyticsCycleAnalyticsProjectStages < ActiveRecord::Migration[5.2] ...@@ -26,7 +26,7 @@ class CreateAnalyticsCycleAnalyticsProjectStages < ActiveRecord::Migration[5.2]
}) })
t.boolean :hidden, default: false, null: false t.boolean :hidden, default: false, null: false
t.boolean :custom, default: true, 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 end
add_index :analytics_cycle_analytics_project_stages, [:project_id, :name], unique: true, name: INDEX_PREFIX + 'on_project_id_and_name' add_index :analytics_cycle_analytics_project_stages, [:project_id, :name], unique: true, name: INDEX_PREFIX + 'on_project_id_and_name'
......
...@@ -8,9 +8,13 @@ class AddStaticObjectTokenToUsers < ActiveRecord::Migration[5.2] ...@@ -8,9 +8,13 @@ class AddStaticObjectTokenToUsers < ActiveRecord::Migration[5.2]
disable_ddl_transaction! disable_ddl_transaction!
# rubocop:disable Migration/AddColumnsToWideTables
# rubocop:disable Migration/PreventStrings
def up 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 end
# rubocop:enable Migration/PreventStrings
# rubocop:enable Migration/AddColumnsToWideTables
def down def down
remove_column :users, :static_object_token remove_column :users, :static_object_token
......
...@@ -7,8 +7,10 @@ class AddStaticObjectsExternalStorageColumnsToApplicationSettings < ActiveRecord ...@@ -7,8 +7,10 @@ class AddStaticObjectsExternalStorageColumnsToApplicationSettings < ActiveRecord
# Set this constant to true if this migration requires downtime. # Set this constant to true if this migration requires downtime.
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/PreventStrings
def change def change
add_column :application_settings, :static_objects_external_storage_url, :string, limit: 255 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 add_column :application_settings, :static_objects_external_storage_auth_token, :string, limit: 255
end end
# rubocop:enable Migration/PreventStrings
end end
...@@ -16,7 +16,7 @@ class CreateAllowedEmailDomainsForGroups < ActiveRecord::Migration[5.2] ...@@ -16,7 +16,7 @@ class CreateAllowedEmailDomainsForGroups < ActiveRecord::Migration[5.2]
null: false, null: false,
index: true index: true
t.foreign_key :namespaces, column: :group_id, on_delete: :cascade 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 end
end end
...@@ -26,7 +26,7 @@ class CreateAnalyticsCycleAnalyticsGroupStages < ActiveRecord::Migration[5.2] ...@@ -26,7 +26,7 @@ class CreateAnalyticsCycleAnalyticsGroupStages < ActiveRecord::Migration[5.2]
}) })
t.boolean :hidden, default: false, null: false t.boolean :hidden, default: false, null: false
t.boolean :custom, default: true, 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 end
add_index :analytics_cycle_analytics_group_stages, [:group_id, :name], unique: true, name: INDEX_PREFIX + 'on_group_id_and_name' add_index :analytics_cycle_analytics_group_stages, [:group_id, :name], unique: true, name: INDEX_PREFIX + 'on_group_id_and_name'
......
...@@ -11,7 +11,7 @@ class AddBuildNeed < ActiveRecord::Migration[5.2] ...@@ -11,7 +11,7 @@ class AddBuildNeed < ActiveRecord::Migration[5.2]
def change def change
create_table :ci_build_needs, id: :serial do |t| create_table :ci_build_needs, id: :serial do |t|
t.integer :build_id, null: false 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.index [:build_id, :name], unique: true
t.foreign_key :ci_builds, column: :build_id, on_delete: :cascade t.foreign_key :ci_builds, column: :build_id, on_delete: :cascade
......
...@@ -16,10 +16,12 @@ class AddThrottleProtectedPathColumns < ActiveRecord::Migration[5.2] ...@@ -16,10 +16,12 @@ class AddThrottleProtectedPathColumns < ActiveRecord::Migration[5.2]
'/import/github/personal_access_token' '/import/github/personal_access_token'
] ]
# rubocop:disable Migration/PreventStrings
def change def change
add_column :application_settings, :throttle_protected_paths_enabled, :boolean, default: true, null: false 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_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, :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 add_column :application_settings, :protected_paths, :string, array: true, limit: 255, default: DEFAULT_PROTECTED_PATHS
end end
# rubocop:enable Migration/PreventStrings
end end
...@@ -3,9 +3,11 @@ ...@@ -3,9 +3,11 @@
class AddProjectsSortingFieldToUserPreferences < ActiveRecord::Migration[5.2] class AddProjectsSortingFieldToUserPreferences < ActiveRecord::Migration[5.2]
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/PreventStrings
def up def up
add_column :user_preferences, :projects_sort, :string, limit: 64 add_column :user_preferences, :projects_sort, :string, limit: 64
end end
# rubocop:enable Migration/PreventStrings
def down def down
remove_column :user_preferences, :projects_sort remove_column :user_preferences, :projects_sort
......
...@@ -8,9 +8,11 @@ class AddFirstLastNameToUser < ActiveRecord::Migration[5.2] ...@@ -8,9 +8,11 @@ class AddFirstLastNameToUser < ActiveRecord::Migration[5.2]
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/AddColumnsToWideTables # rubocop:disable Migration/AddColumnsToWideTables
# rubocop:disable Migration/PreventStrings
def change def change
add_column(:users, :first_name, :string, null: true, limit: 255) add_column(:users, :first_name, :string, null: true, limit: 255)
add_column(:users, :last_name, :string, null: true, limit: 255) add_column(:users, :last_name, :string, null: true, limit: 255)
end end
# rubocop:enable Migration/PreventStrings
# rubocop:enable Migration/AddColumnsToWideTables # rubocop:enable Migration/AddColumnsToWideTables
end end
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
class CreateClusterProvidersAws < ActiveRecord::Migration[5.2] class CreateClusterProvidersAws < ActiveRecord::Migration[5.2]
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/PreventStrings
# rubocop:disable Migration/AddLimitToTextColumns
def change def change
create_table :cluster_providers_aws do |t| create_table :cluster_providers_aws do |t|
t.references :cluster, null: false, type: :bigint, index: { unique: true }, foreign_key: { on_delete: :cascade } 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] ...@@ -30,4 +32,6 @@ class CreateClusterProvidersAws < ActiveRecord::Migration[5.2]
t.index [:cluster_id, :status] t.index [:cluster_id, :status]
end end
end end
# rubocop:enable Migration/AddLimitToTextColumns
# rubocop:enable Migration/PreventStrings
end end
...@@ -9,10 +9,12 @@ class AddSourcegraphConfigurationToApplicationSettings < ActiveRecord::Migration ...@@ -9,10 +9,12 @@ class AddSourcegraphConfigurationToApplicationSettings < ActiveRecord::Migration
# Set this constant to true if this migration requires downtime. # Set this constant to true if this migration requires downtime.
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/PreventStrings
def up def up
add_column(:application_settings, :sourcegraph_enabled, :boolean, default: false, null: false) add_column(:application_settings, :sourcegraph_enabled, :boolean, default: false, null: false)
add_column(:application_settings, :sourcegraph_url, :string, null: true, limit: 255) add_column(:application_settings, :sourcegraph_url, :string, null: true, limit: 255)
end end
# rubocop:enable Migration/PreventStrings
def down def down
remove_column(:application_settings, :sourcegraph_enabled) remove_column(:application_settings, :sourcegraph_enabled)
......
...@@ -8,7 +8,7 @@ class CreatePackageTag < ActiveRecord::Migration[5.2] ...@@ -8,7 +8,7 @@ class CreatePackageTag < ActiveRecord::Migration[5.2]
def change def change
create_table :packages_package_tags do |t| 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.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 end
end end
...@@ -6,6 +6,7 @@ class CreateExternalPullRequests < ActiveRecord::Migration[5.2] ...@@ -6,6 +6,7 @@ class CreateExternalPullRequests < ActiveRecord::Migration[5.2]
DOWNTIME = false DOWNTIME = false
INDEX = 'index_external_pull_requests_on_project_and_branches' INDEX = 'index_external_pull_requests_on_project_and_branches'
# rubocop:disable Migration/PreventStrings
def change def change
create_table :external_pull_requests do |t| create_table :external_pull_requests do |t|
t.timestamps_with_timezone null: false t.timestamps_with_timezone null: false
...@@ -22,4 +23,5 @@ class CreateExternalPullRequests < ActiveRecord::Migration[5.2] ...@@ -22,4 +23,5 @@ class CreateExternalPullRequests < ActiveRecord::Migration[5.2]
t.index [:project_id, :source_branch, :target_branch], unique: true, name: INDEX t.index [:project_id, :source_branch, :target_branch], unique: true, name: INDEX
end end
end end
# rubocop:enable Migration/PreventStrings
end end
...@@ -5,6 +5,7 @@ class CreateAnalyticsRepositoryFilesTable < ActiveRecord::Migration[5.2] ...@@ -5,6 +5,7 @@ class CreateAnalyticsRepositoryFilesTable < ActiveRecord::Migration[5.2]
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/PreventStrings
def change def change
create_table :analytics_repository_files do |t| create_table :analytics_repository_files do |t|
t.references :project, t.references :project,
...@@ -18,4 +19,5 @@ class CreateAnalyticsRepositoryFilesTable < ActiveRecord::Migration[5.2] ...@@ -18,4 +19,5 @@ class CreateAnalyticsRepositoryFilesTable < ActiveRecord::Migration[5.2]
add_index :analytics_repository_files, [:project_id, :file_path], unique: true add_index :analytics_repository_files, [:project_id, :file_path], unique: true
end end
# rubocop:enable Migration/PreventStrings
end end
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
class CreateAlertsServiceData < ActiveRecord::Migration[5.2] class CreateAlertsServiceData < ActiveRecord::Migration[5.2]
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/PreventStrings
def change def change
create_table :alerts_service_data do |t| create_table :alerts_service_data do |t|
t.references :service, type: :integer, index: true, null: false, t.references :service, type: :integer, index: true, null: false,
...@@ -12,4 +13,5 @@ class CreateAlertsServiceData < ActiveRecord::Migration[5.2] ...@@ -12,4 +13,5 @@ class CreateAlertsServiceData < ActiveRecord::Migration[5.2]
t.string :encrypted_token_iv, limit: 255 t.string :encrypted_token_iv, limit: 255
end end
end end
# rubocop:enable Migration/PreventStrings
end end
...@@ -5,6 +5,7 @@ class CreatePackagesConanFileMetadata < ActiveRecord::Migration[5.2] ...@@ -5,6 +5,7 @@ class CreatePackagesConanFileMetadata < ActiveRecord::Migration[5.2]
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/PreventStrings
def change def change
create_table :packages_conan_file_metadata do |t| 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 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] ...@@ -15,4 +16,5 @@ class CreatePackagesConanFileMetadata < ActiveRecord::Migration[5.2]
t.integer "conan_file_type", limit: 2, null: false t.integer "conan_file_type", limit: 2, null: false
end end
end end
# rubocop:enable Migration/PreventStrings
end end
...@@ -3,9 +3,11 @@ ...@@ -3,9 +3,11 @@
class AddSpdxIdToSoftwareLicenses < ActiveRecord::Migration[5.2] class AddSpdxIdToSoftwareLicenses < ActiveRecord::Migration[5.2]
DOWNTIME = false DOWNTIME = false
# rubocop:disable Migration/PreventStrings
def up def up
add_column :software_licenses, :spdx_identifier, :string, limit: 255 add_column :software_licenses, :spdx_identifier, :string, limit: 255
end end
# rubocop:enable Migration/PreventStrings
def down def down
remove_column :software_licenses, :spdx_identifier remove_column :software_licenses, :spdx_identifier
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment