Commit 875a45a6 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'jprovazn-versioned-migrations' into 'master'

Add rails version to all migrations

Closes #54098

See merge request gitlab-org/gitlab-ce!23057
parents 19e9438d 0fc9f9d3

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

...@@ -26,6 +26,9 @@ module Gitlab ...@@ -26,6 +26,9 @@ module Gitlab
# setting disabled # setting disabled
require_dependency Rails.root.join('lib/mysql_zero_date') require_dependency Rails.root.join('lib/mysql_zero_date')
# This can be removed when we drop support for rails 4
require_dependency Rails.root.join('lib/rails4_migration_version')
# Settings in config/environments/* take precedence over those specified here. # Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers # Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded. # -- all .rb files in that directory are automatically loaded.
......
class InitSchema < ActiveRecord::Migration class InitSchema < ActiveRecord::Migration[4.2]
DOWNTIME = true DOWNTIME = true
# rubocop:disable Metrics/AbcSize # rubocop:disable Metrics/AbcSize
......
class FixNamespaces < ActiveRecord::Migration class FixNamespaces < ActiveRecord::Migration[4.2]
DOWNTIME = false DOWNTIME = false
def up def up
......
# rubocop:disable all # rubocop:disable all
class ChangeStateToAllowEmptyMergeRequestDiffs < ActiveRecord::Migration class ChangeStateToAllowEmptyMergeRequestDiffs < ActiveRecord::Migration[4.2]
def up def up
change_column :merge_request_diffs, :state, :string, null: true, change_column :merge_request_diffs, :state, :string, null: true,
default: nil default: nil
......
# rubocop:disable all # rubocop:disable all
class AddIndexOnIid < ActiveRecord::Migration class AddIndexOnIid < ActiveRecord::Migration[4.2]
def change def change
RemoveDuplicateIid.clean(Issue) RemoveDuplicateIid.clean(Issue)
RemoveDuplicateIid.clean(MergeRequest, 'target_project_id') RemoveDuplicateIid.clean(MergeRequest, 'target_project_id')
......
# rubocop:disable all # rubocop:disable all
class IndexOnCurrentSignInAt < ActiveRecord::Migration class IndexOnCurrentSignInAt < ActiveRecord::Migration[4.2]
def change def change
add_index :users, :current_sign_in_at add_index :users, :current_sign_in_at
end end
......
# rubocop:disable all # rubocop:disable all
class AddNotesIndexUpdatedAt < ActiveRecord::Migration class AddNotesIndexUpdatedAt < ActiveRecord::Migration[4.2]
def change def change
add_index :notes, :updated_at add_index :notes, :updated_at
end end
......
# rubocop:disable all # rubocop:disable all
class AddRepoSizeToDb < ActiveRecord::Migration class AddRepoSizeToDb < ActiveRecord::Migration[4.2]
def change def change
add_column :projects, :repository_size, :float, default: 0 add_column :projects, :repository_size, :float, default: 0
end end
......
# rubocop:disable all # rubocop:disable all
class MigrateRepoSize < ActiveRecord::Migration class MigrateRepoSize < ActiveRecord::Migration[4.2]
DOWNTIME = false DOWNTIME = false
def up def up
......
# rubocop:disable all # rubocop:disable all
class AddPositionToMergeRequest < ActiveRecord::Migration class AddPositionToMergeRequest < ActiveRecord::Migration[4.2]
def change def change
add_column :merge_requests, :position, :integer, default: 0 add_column :merge_requests, :position, :integer, default: 0
end end
......
# rubocop:disable all # rubocop:disable all
class CreateUsersStarProjects < ActiveRecord::Migration class CreateUsersStarProjects < ActiveRecord::Migration[4.2]
DOWNTIME = false DOWNTIME = false
def change def change
......
# rubocop:disable all # rubocop:disable all
class CreateLabels < ActiveRecord::Migration class CreateLabels < ActiveRecord::Migration[4.2]
DOWNTIME = false DOWNTIME = false
def change def change
......
# rubocop:disable all # rubocop:disable all
class CreateLabelLinks < ActiveRecord::Migration class CreateLabelLinks < ActiveRecord::Migration[4.2]
DOWNTIME = false DOWNTIME = false
def change def change
......
class MigrateProjectTags < ActiveRecord::Migration class MigrateProjectTags < ActiveRecord::Migration[4.2]
def up def up
ActsAsTaggableOn::Tagging.where(taggable_type: 'Project', context: 'labels').update_all(context: 'tags') ActsAsTaggableOn::Tagging.where(taggable_type: 'Project', context: 'labels').update_all(context: 'tags')
end end
......
# rubocop:disable all # rubocop:disable all
class MigrateTaggableLabels < ActiveRecord::Migration class MigrateTaggableLabels < ActiveRecord::Migration[4.2]
def up def up
taggings = ActsAsTaggableOn::Tagging.where(taggable_type: ['Issue', 'MergeRequest'], context: 'labels') taggings = ActsAsTaggableOn::Tagging.where(taggable_type: ['Issue', 'MergeRequest'], context: 'labels')
taggings.find_each(batch_size: 500) do |tagging| taggings.find_each(batch_size: 500) do |tagging|
......
# rubocop:disable all # rubocop:disable all
class AddIndexToLabels < ActiveRecord::Migration class AddIndexToLabels < ActiveRecord::Migration[4.2]
def change def change
add_index "labels", :project_id add_index "labels", :project_id
add_index "label_links", :label_id add_index "label_links", :label_id
......
# rubocop:disable all # rubocop:disable all
class MigrateToNewShell < ActiveRecord::Migration class MigrateToNewShell < ActiveRecord::Migration[4.2]
def change def change
return if Rails.env.test? return if Rails.env.test?
......
# rubocop:disable all # rubocop:disable all
class SerializeServiceProperties < ActiveRecord::Migration class SerializeServiceProperties < ActiveRecord::Migration[4.2]
def change def change
unless column_exists?(:services, :properties) unless column_exists?(:services, :properties)
add_column :services, :properties, :text add_column :services, :properties, :text
......
# rubocop:disable all # rubocop:disable all
class AddMembersTable < ActiveRecord::Migration class AddMembersTable < ActiveRecord::Migration[4.2]
DOWNTIME = false DOWNTIME = false
def change def change
......
# rubocop:disable all # rubocop:disable all
class MigrateToNewMembersModel < ActiveRecord::Migration class MigrateToNewMembersModel < ActiveRecord::Migration[4.2]
def up def up
execute "INSERT INTO members ( user_id, source_id, source_type, access_level, notification_level, type ) SELECT user_id, group_id, 'Namespace', group_access, notification_level, 'GroupMember' FROM users_groups" execute "INSERT INTO members ( user_id, source_id, source_type, access_level, notification_level, type ) SELECT user_id, group_id, 'Namespace', group_access, notification_level, 'GroupMember' FROM users_groups"
execute "INSERT INTO members ( user_id, source_id, source_type, access_level, notification_level, type ) SELECT user_id, project_id, 'Project', project_access, notification_level, 'ProjectMember' FROM users_projects" execute "INSERT INTO members ( user_id, source_id, source_type, access_level, notification_level, type ) SELECT user_id, project_id, 'Project', project_access, notification_level, 'ProjectMember' FROM users_projects"
......
# rubocop:disable all # rubocop:disable all
class RemoveOldMemberTables < ActiveRecord::Migration class RemoveOldMemberTables < ActiveRecord::Migration[4.2]
DOWNTIME = false DOWNTIME = false
def up def up
......
# rubocop:disable all # rubocop:disable all
class MoveSlackServiceToWebhook < ActiveRecord::Migration class MoveSlackServiceToWebhook < ActiveRecord::Migration[4.2]
DOWNTIME = true DOWNTIME = true
DOWNTIME_REASON = 'Move old fields "token" and "subdomain" to one single field "webhook"' DOWNTIME_REASON = 'Move old fields "token" and "subdomain" to one single field "webhook"'
......
# rubocop:disable all # rubocop:disable all
class AddVisibilityLevelToSnippet < ActiveRecord::Migration class AddVisibilityLevelToSnippet < ActiveRecord::Migration[4.2]
include Gitlab::Database::MigrationHelpers include Gitlab::Database::MigrationHelpers
def up def up
......
# rubocop:disable all # rubocop:disable all
class AddAuditEvent < ActiveRecord::Migration class AddAuditEvent < ActiveRecord::Migration[4.2]
DOWNTIME = false DOWNTIME = false
def change def change
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# became a problem after commit c8e78d972a5a628870eefca0f2ccea0199c55bda which # became a problem after commit c8e78d972a5a628870eefca0f2ccea0199c55bda which
# was added in GitLab 7.5. With this migration we ensure that all rows in # was added in GitLab 7.5. With this migration we ensure that all rows in
# 'members' have at least some created_at and updated_at timestamp. # 'members' have at least some created_at and updated_at timestamp.
class AddTimestampsToMembers < ActiveRecord::Migration class AddTimestampsToMembers < ActiveRecord::Migration[4.2]
def up def up
execute "UPDATE members SET created_at = NOW() WHERE created_at is NULL" execute "UPDATE members SET created_at = NOW() WHERE created_at is NULL"
execute "UPDATE members SET updated_at = NOW() WHERE updated_at is NULL" execute "UPDATE members SET updated_at = NOW() WHERE updated_at is NULL"
......
# rubocop:disable all # rubocop:disable all
class AddIdentityTable < ActiveRecord::Migration class AddIdentityTable < ActiveRecord::Migration[4.2]
def up def up
create_table :identities do |t| create_table :identities do |t|
t.string :extern_uid t.string :extern_uid
......
# rubocop:disable all # rubocop:disable all
class AddMergeRequestRebaseEnabledToProjects < ActiveRecord::Migration class AddMergeRequestRebaseEnabledToProjects < ActiveRecord::Migration[4.2]
include Gitlab::Database::MigrationHelpers include Gitlab::Database::MigrationHelpers
# Set this constant to true if this migration requires downtime. # Set this constant to true if this migration requires downtime.
......
# rubocop:disable all # rubocop:disable all
class AddLockedAtToMergeRequest < ActiveRecord::Migration class AddLockedAtToMergeRequest < ActiveRecord::Migration[4.2]
def change def change
add_column :merge_requests, :locked_at, :datetime add_column :merge_requests, :locked_at, :datetime
end end
......
# rubocop:disable all # rubocop:disable all
class CreateDoorkeeperTables < ActiveRecord::Migration class CreateDoorkeeperTables < ActiveRecord::Migration[4.2]
DOWNTIME = false DOWNTIME = false
def change def change
......
# rubocop:disable all # rubocop:disable all
class AddOwnerToApplication < ActiveRecord::Migration class AddOwnerToApplication < ActiveRecord::Migration[4.2]
def change def change
add_column :oauth_applications, :owner_id, :integer, null: true add_column :oauth_applications, :owner_id, :integer, null: true
add_column :oauth_applications, :owner_type, :string, null: true add_column :oauth_applications, :owner_type, :string, null: true
......
class AddImportDataToProjectTable < ActiveRecord::Migration class AddImportDataToProjectTable < ActiveRecord::Migration[4.2]
def change def change
add_column :projects, :import_type, :string add_column :projects, :import_type, :string
add_column :projects, :import_source, :string add_column :projects, :import_source, :string
......
# rubocop:disable all # rubocop:disable all
class AddDevelopersCanPushToProtectedBranches < ActiveRecord::Migration class AddDevelopersCanPushToProtectedBranches < ActiveRecord::Migration[4.2]
def change def change
add_column :protected_branches, :developers_can_push, :boolean, default: false, null: false add_column :protected_branches, :developers_can_push, :boolean, default: false, null: false
end end
......
# rubocop:disable all # rubocop:disable all
class CreateApplicationSettings < ActiveRecord::Migration class CreateApplicationSettings < ActiveRecord::Migration[4.2]
DOWNTIME = false DOWNTIME = false
def change def change
......
class AddHomePageUrlForApplicationSettings < ActiveRecord::Migration class AddHomePageUrlForApplicationSettings < ActiveRecord::Migration[4.2]
def change def change
add_column :application_settings, :home_page_url, :string add_column :application_settings, :home_page_url, :string
end end
......
class AddGitlabAccessTokenToUser < ActiveRecord::Migration class AddGitlabAccessTokenToUser < ActiveRecord::Migration[4.2]
def change def change
add_column :users, :gitlab_access_token, :string add_column :users, :gitlab_access_token, :string
end end
......
# rubocop:disable all # rubocop:disable all
class AddDefaultBranchProtectionSetting < ActiveRecord::Migration class AddDefaultBranchProtectionSetting < ActiveRecord::Migration[4.2]
def change def change
add_column :application_settings, :default_branch_protection, :integer, :default => 2 add_column :application_settings, :default_branch_protection, :integer, :default => 2
end end
......
# rubocop:disable all # rubocop:disable all
class AddTimestampsToIdentities < ActiveRecord::Migration class AddTimestampsToIdentities < ActiveRecord::Migration[4.2]
def change def change
add_timestamps(:identities) add_timestamps(:identities)
end end
......
# rubocop:disable all # rubocop:disable all
class AddIndexToCreatedAt < ActiveRecord::Migration class AddIndexToCreatedAt < ActiveRecord::Migration[4.2]
def change def change
add_index "users", [:created_at, :id] add_index "users", [:created_at, :id]
add_index "members", [:created_at, :id] add_index "members", [:created_at, :id]
......
class AddNotificationEmailToUser < ActiveRecord::Migration class AddNotificationEmailToUser < ActiveRecord::Migration[4.2]
def up def up
add_column :users, :notification_email, :string add_column :users, :notification_email, :string
......
# rubocop:disable all # rubocop:disable all
class AddMissingIndex < ActiveRecord::Migration class AddMissingIndex < ActiveRecord::Migration[4.2]
def change def change
add_index "services", [:created_at, :id] add_index "services", [:created_at, :id]
end end
......
# rubocop:disable all # rubocop:disable all
class AddTemplateToService < ActiveRecord::Migration class AddTemplateToService < ActiveRecord::Migration[4.2]
def change def change
add_column :services, :template, :boolean, default: false add_column :services, :template, :boolean, default: false
end end
......
class AllowNullInServicesProjectId < ActiveRecord::Migration class AllowNullInServicesProjectId < ActiveRecord::Migration[4.2]
def change def change
change_column :services, :project_id, :integer, null: true change_column :services, :project_id, :integer, null: true
end end
......
# rubocop:disable all # rubocop:disable all
class AddTwitterSharingEnabledToApplicationSettings < ActiveRecord::Migration class AddTwitterSharingEnabledToApplicationSettings < ActiveRecord::Migration[4.2]
def change def change
add_column :application_settings, :twitter_sharing_enabled, :boolean, default: true add_column :application_settings, :twitter_sharing_enabled, :boolean, default: true
end end
......
# rubocop:disable all # rubocop:disable all
class AddHideNoPasswordToUser < ActiveRecord::Migration class AddHideNoPasswordToUser < ActiveRecord::Migration[4.2]
def change def change
add_column :users, :hide_no_password, :boolean, default: false add_column :users, :hide_no_password, :boolean, default: false
end end
......
# rubocop:disable all # rubocop:disable all
class AddPasswordAutomaticallySetToUser < ActiveRecord::Migration class AddPasswordAutomaticallySetToUser < ActiveRecord::Migration[4.2]
def change def change
add_column :users, :password_automatically_set, :boolean, default: false add_column :users, :password_automatically_set, :boolean, default: false
end end
......
class AddBitbucketAccessTokenAndSecretToUser < ActiveRecord::Migration class AddBitbucketAccessTokenAndSecretToUser < ActiveRecord::Migration[4.2]
def change def change
add_column :users, :bitbucket_access_token, :string add_column :users, :bitbucket_access_token, :string
add_column :users, :bitbucket_access_token_secret, :string add_column :users, :bitbucket_access_token_secret, :string
......
# rubocop:disable all # rubocop:disable all
class AddEventsToServices < ActiveRecord::Migration class AddEventsToServices < ActiveRecord::Migration[4.2]
def change def change
add_column :services, :push_events, :boolean, :default => true add_column :services, :push_events, :boolean, :default => true
add_column :services, :issues_events, :boolean, :default => true add_column :services, :issues_events, :boolean, :default => true
......
class SetMissingLastActivityAt < ActiveRecord::Migration class SetMissingLastActivityAt < ActiveRecord::Migration[4.2]
def up def up
execute "UPDATE projects SET last_activity_at = updated_at WHERE last_activity_at IS NULL" execute "UPDATE projects SET last_activity_at = updated_at WHERE last_activity_at IS NULL"
end end
......
# rubocop:disable all # rubocop:disable all
class AddNoteEventsToServices < ActiveRecord::Migration class AddNoteEventsToServices < ActiveRecord::Migration[4.2]
def change def change
add_column :services, :note_events, :boolean, default: true, null: false add_column :services, :note_events, :boolean, default: true, null: false
end end
......
class AddRestrictedVisibilityLevelsToApplicationSettings < ActiveRecord::Migration class AddRestrictedVisibilityLevelsToApplicationSettings < ActiveRecord::Migration[4.2]
def change def change
add_column :application_settings, :restricted_visibility_levels, :text add_column :application_settings, :restricted_visibility_levels, :text
end end
......
# rubocop:disable all # rubocop:disable all
class FixNamespaceDuplication < ActiveRecord::Migration class FixNamespaceDuplication < ActiveRecord::Migration[4.2]
def up def up
#fixes path duplication #fixes path duplication
select_all('SELECT MAX(id) max, COUNT(id) cnt, path FROM namespaces GROUP BY path HAVING COUNT(id) > 1').each do |nms| select_all('SELECT MAX(id) max, COUNT(id) cnt, path FROM namespaces GROUP BY path HAVING COUNT(id) > 1').each do |nms|
......
# rubocop:disable all # rubocop:disable all
class AddUniqueIndexToNamespace < ActiveRecord::Migration class AddUniqueIndexToNamespace < ActiveRecord::Migration[4.2]
def change def change
remove_index :namespaces, column: :name if index_exists?(:namespaces, :name) remove_index :namespaces, column: :name if index_exists?(:namespaces, :name)
remove_index :namespaces, column: :path if index_exists?(:namespaces, :path) remove_index :namespaces, column: :path if index_exists?(:namespaces, :path)
......
# rubocop:disable all # rubocop:disable all
class AddVersionCheckToApplicationSettings < ActiveRecord::Migration class AddVersionCheckToApplicationSettings < ActiveRecord::Migration[4.2]
def change def change
add_column :application_settings, :version_check_enabled, :boolean, default: true add_column :application_settings, :version_check_enabled, :boolean, default: true
end end
......
# rubocop:disable all # rubocop:disable all
class CreateSubscriptionsTable < ActiveRecord::Migration class CreateSubscriptionsTable < ActiveRecord::Migration[4.2]
DOWNTIME = false DOWNTIME = false
def change def change
......
class AddLocationToUser < ActiveRecord::Migration class AddLocationToUser < ActiveRecord::Migration[4.2]
def change def change
add_column :users, :location, :string add_column :users, :location, :string
end end
......
class SetIncorrectAssigneeIdToNull < ActiveRecord::Migration class SetIncorrectAssigneeIdToNull < ActiveRecord::Migration[4.2]
def up def up
execute "UPDATE issues SET assignee_id = NULL WHERE assignee_id = -1" execute "UPDATE issues SET assignee_id = NULL WHERE assignee_id = -1"
execute "UPDATE merge_requests SET assignee_id = NULL WHERE assignee_id = -1" execute "UPDATE merge_requests SET assignee_id = NULL WHERE assignee_id = -1"
......
# rubocop:disable all # rubocop:disable all
class AddPublicToKey < ActiveRecord::Migration class AddPublicToKey < ActiveRecord::Migration[4.2]
def change def change
add_column :keys, :public, :boolean, default: false, null: false add_column :keys, :public, :boolean, default: false, null: false
end end
......
class AddImportDataToProject < ActiveRecord::Migration class AddImportDataToProject < ActiveRecord::Migration[4.2]
def change def change
add_column :projects, :import_data, :text add_column :projects, :import_data, :text
end end
......
class AddDeviseTwoFactorToUsers < ActiveRecord::Migration class AddDeviseTwoFactorToUsers < ActiveRecord::Migration[4.2]
def change def change
add_column :users, :encrypted_otp_secret, :string add_column :users, :encrypted_otp_secret, :string
add_column :users, :encrypted_otp_secret_iv, :string add_column :users, :encrypted_otp_secret_iv, :string
......
class AddMaxAttachmentSizeToApplicationSettings < ActiveRecord::Migration class AddMaxAttachmentSizeToApplicationSettings < ActiveRecord::Migration[4.2]
def change def change
add_column :application_settings, :max_attachment_size, :integer, default: 10, null: false add_column :application_settings, :max_attachment_size, :integer, default: 10, null: false
end end
......
class AddDeviseTwoFactorBackupableToUsers < ActiveRecord::Migration class AddDeviseTwoFactorBackupableToUsers < ActiveRecord::Migration[4.2]
def change def change
add_column :users, :otp_backup_codes, :text add_column :users, :otp_backup_codes, :text
end end
......
# rubocop:disable all # rubocop:disable all
class AddInviteDataToMember < ActiveRecord::Migration class AddInviteDataToMember < ActiveRecord::Migration[4.2]
def up def up
add_column :members, :created_by_id, :integer add_column :members, :created_by_id, :integer
add_column :members, :invite_email, :string add_column :members, :invite_email, :string
......
class FixIdentities < ActiveRecord::Migration class FixIdentities < ActiveRecord::Migration[4.2]
def up def up
# Up until now, legacy 'ldap' references in the database were charitably # Up until now, legacy 'ldap' references in the database were charitably
# interpreted to point to the first LDAP server specified in the GitLab # interpreted to point to the first LDAP server specified in the GitLab
......
class RenameBuildboxService < ActiveRecord::Migration class RenameBuildboxService < ActiveRecord::Migration[4.2]
def up def up
execute "UPDATE services SET type = 'BuildkiteService' WHERE type = 'BuildboxService';" execute "UPDATE services SET type = 'BuildkiteService' WHERE type = 'BuildboxService';"
end end
......
# rubocop:disable all # rubocop:disable all
class AddPublicEmailToUsers < ActiveRecord::Migration class AddPublicEmailToUsers < ActiveRecord::Migration[4.2]
def change def change
add_column :users, :public_email, :string, default: "", null: false add_column :users, :public_email, :string, default: "", null: false
end end
......
class CreateProjectImportData < ActiveRecord::Migration class CreateProjectImportData < ActiveRecord::Migration[4.2]
def change def change
create_table :project_import_data do |t| create_table :project_import_data do |t|
t.references :project t.references :project
......
# rubocop:disable all # rubocop:disable all
class RemoveImportDataFromProject < ActiveRecord::Migration class RemoveImportDataFromProject < ActiveRecord::Migration[4.2]
def up def up
remove_column :projects, :import_data remove_column :projects, :import_data
end end
......
# rubocop:disable all # rubocop:disable all
class RemovePeriodsAtEndsOfUsernames < ActiveRecord::Migration class RemovePeriodsAtEndsOfUsernames < ActiveRecord::Migration[4.2]
include Gitlab::ShellAdapter include Gitlab::ShellAdapter
class Namespace < ActiveRecord::Base class Namespace < ActiveRecord::Base
......
class AddDefaultProjectVisibililtyToApplicationSettings < ActiveRecord::Migration class AddDefaultProjectVisibililtyToApplicationSettings < ActiveRecord::Migration[4.2]
def up def up
add_column :application_settings, :default_project_visibility, :integer add_column :application_settings, :default_project_visibility, :integer
visibility = Settings.gitlab.default_projects_features['visibility_level'] visibility = Settings.gitlab.default_projects_features['visibility_level']
......
# This migration is a duplicate of 20150425164651_change_collation_for_tag_names.acts_as_taggable_on_engine.rb # This migration is a duplicate of 20150425164651_change_collation_for_tag_names.acts_as_taggable_on_engine.rb
# It shold be applied before the index additions to ensure that `name` is case sensitive. # It shold be applied before the index additions to ensure that `name` is case sensitive.
class GitlabChangeCollationForTagNames < ActiveRecord::Migration class GitlabChangeCollationForTagNames < ActiveRecord::Migration[4.2]
def up def up
if ActsAsTaggableOn::Utils.using_mysql? if ActsAsTaggableOn::Utils.using_mysql?
execute("ALTER TABLE tags MODIFY name varchar(255) CHARACTER SET utf8 COLLATE utf8_bin;") execute("ALTER TABLE tags MODIFY name varchar(255) CHARACTER SET utf8 COLLATE utf8_bin;")
......
# rubocop:disable all # rubocop:disable all
class RemoveDuplicateTags < ActiveRecord::Migration class RemoveDuplicateTags < ActiveRecord::Migration[4.2]
def up def up
select_all("SELECT name, COUNT(id) as cnt FROM tags GROUP BY name HAVING COUNT(id) > 1").each do |tag| select_all("SELECT name, COUNT(id) as cnt FROM tags GROUP BY name HAVING COUNT(id) > 1").each do |tag|
tag_name = quote_string(tag["name"]) tag_name = quote_string(tag["name"])
......
# rubocop:disable all # rubocop:disable all
# This migration comes from acts_as_taggable_on_engine (originally 2) # This migration comes from acts_as_taggable_on_engine (originally 2)
class AddMissingUniqueIndices < ActiveRecord::Migration class AddMissingUniqueIndices < ActiveRecord::Migration[4.2]
def self.up def self.up
add_index :tags, :name, unique: true add_index :tags, :name, unique: true
......
# rubocop:disable all # rubocop:disable all
# This migration comes from acts_as_taggable_on_engine (originally 3) # This migration comes from acts_as_taggable_on_engine (originally 3)
class AddTaggingsCounterCacheToTags < ActiveRecord::Migration class AddTaggingsCounterCacheToTags < ActiveRecord::Migration[4.2]
def self.up def self.up
add_column :tags, :taggings_count, :integer, default: 0 add_column :tags, :taggings_count, :integer, default: 0
......
# This migration comes from acts_as_taggable_on_engine (originally 4) # This migration comes from acts_as_taggable_on_engine (originally 4)
class AddMissingTaggableIndex < ActiveRecord::Migration class AddMissingTaggableIndex < ActiveRecord::Migration[4.2]
def self.up def self.up
add_index :taggings, [:taggable_id, :taggable_type, :context] add_index :taggings, [:taggable_id, :taggable_type, :context]
end end
......
# This migration comes from acts_as_taggable_on_engine (originally 5) # This migration comes from acts_as_taggable_on_engine (originally 5)
# This migration is added to circumvent issue #623 and have special characters # This migration is added to circumvent issue #623 and have special characters
# work properly # work properly
class ChangeCollationForTagNames < ActiveRecord::Migration class ChangeCollationForTagNames < ActiveRecord::Migration[4.2]
def up def up
if ActsAsTaggableOn::Utils.using_mysql? if ActsAsTaggableOn::Utils.using_mysql?
execute("ALTER TABLE tags MODIFY name varchar(255) CHARACTER SET utf8 COLLATE utf8_bin;") execute("ALTER TABLE tags MODIFY name varchar(255) CHARACTER SET utf8 COLLATE utf8_bin;")
......
class AddDefaultSnippetVisibilityToAppSettings < ActiveRecord::Migration class AddDefaultSnippetVisibilityToAppSettings < ActiveRecord::Migration[4.2]
def up def up
add_column :application_settings, :default_snippet_visibility, :integer add_column :application_settings, :default_snippet_visibility, :integer
visibility = Settings.gitlab.default_projects_features['visibility_level'] visibility = Settings.gitlab.default_projects_features['visibility_level']
......
class RemoveAbandonedGroupMembersRecords < ActiveRecord::Migration class RemoveAbandonedGroupMembersRecords < ActiveRecord::Migration[4.2]
def up def up
execute("DELETE FROM members WHERE type = 'GroupMember' AND source_id NOT IN(\ execute("DELETE FROM members WHERE type = 'GroupMember' AND source_id NOT IN(\
SELECT id FROM namespaces WHERE type='Group')") SELECT id FROM namespaces WHERE type='Group')")
......
class AddRestrictedSignupDomainsToApplicationSettings < ActiveRecord::Migration class AddRestrictedSignupDomainsToApplicationSettings < ActiveRecord::Migration[4.2]
def change def change
add_column :application_settings, :restricted_signup_domains, :text add_column :application_settings, :restricted_signup_domains, :text
end end
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
# becomes # becomes
# #
# mentioned in 54f7727c850972f0401c1312a7c4a6a380de5666 # mentioned in 54f7727c850972f0401c1312a7c4a6a380de5666
class ConvertLegacyReferenceNotes < ActiveRecord::Migration class ConvertLegacyReferenceNotes < ActiveRecord::Migration[4.2]
def up def up
execute %q{UPDATE notes SET note = trim(both '_' from note) WHERE system = true AND note LIKE '\_%\_'} execute %q{UPDATE notes SET note = trim(both '_' from note) WHERE system = true AND note LIKE '\_%\_'}
end end
......
# rubocop:disable all # rubocop:disable all
class AddNoteEventsToWebHooks < ActiveRecord::Migration class AddNoteEventsToWebHooks < ActiveRecord::Migration[4.2]
def up def up
add_column :web_hooks, :note_events, :boolean, default: false, null: false add_column :web_hooks, :note_events, :boolean, default: false, null: false
end end
......
class AddUserOauthApplicationsToApplicationSettings < ActiveRecord::Migration class AddUserOauthApplicationsToApplicationSettings < ActiveRecord::Migration[4.2]
def change def change
add_column :application_settings, :user_oauth_applications, :bool, default: true add_column :application_settings, :user_oauth_applications, :bool, default: true
end end
......
# rubocop:disable all # rubocop:disable all
class AddAfterSignOutPathForApplicationSettings < ActiveRecord::Migration class AddAfterSignOutPathForApplicationSettings < ActiveRecord::Migration[4.2]
def change def change
add_column :application_settings, :after_sign_out_path, :string add_column :application_settings, :after_sign_out_path, :string
end end
......
class AddSessionExpireDelayForApplicationSettings < ActiveRecord::Migration class AddSessionExpireDelayForApplicationSettings < ActiveRecord::Migration[4.2]
def change def change
unless column_exists?(:application_settings, :session_expire_delay) unless column_exists?(:application_settings, :session_expire_delay)
add_column :application_settings, :session_expire_delay, :integer, default: 10080, null: false add_column :application_settings, :session_expire_delay, :integer, default: 10080, null: false
......
# rubocop:disable all # rubocop:disable all
class AddDashboardToUsers < ActiveRecord::Migration class AddDashboardToUsers < ActiveRecord::Migration[4.2]
def up def up
add_column :users, :dashboard, :integer, default: 0 add_column :users, :dashboard, :integer, default: 0
end end
......
class AddDefaultOtpRequiredForLoginValue < ActiveRecord::Migration class AddDefaultOtpRequiredForLoginValue < ActiveRecord::Migration[4.2]
def up def up
execute %q{UPDATE users SET otp_required_for_login = FALSE WHERE otp_required_for_login IS NULL} execute %q{UPDATE users SET otp_required_for_login = FALSE WHERE otp_required_for_login IS NULL}
......
# rubocop:disable all # rubocop:disable all
class AddProjectViewToUsers < ActiveRecord::Migration class AddProjectViewToUsers < ActiveRecord::Migration[4.2]
def change def change
add_column :users, :project_view, :integer, default: 0 add_column :users, :project_view, :integer, default: 0
end end
......
# rubocop:disable all # rubocop:disable all
class AddCommitsCountToProject < ActiveRecord::Migration class AddCommitsCountToProject < ActiveRecord::Migration[4.2]
def change def change
add_column :projects, :commit_count, :integer, default: 0 add_column :projects, :commit_count, :integer, default: 0
end end
......
class AddUpdatedByToIssuablesAndNotes < ActiveRecord::Migration class AddUpdatedByToIssuablesAndNotes < ActiveRecord::Migration[4.2]
def change def change
add_column :notes, :updated_by_id, :integer add_column :notes, :updated_by_id, :integer
add_column :issues, :updated_by_id, :integer add_column :issues, :updated_by_id, :integer
......
# rubocop:disable all # rubocop:disable all
class CreateAbuseReports < ActiveRecord::Migration class CreateAbuseReports < ActiveRecord::Migration[4.2]
DOWNTIME = false DOWNTIME = false
def change def change
......
# rubocop:disable all # rubocop:disable all
require 'yaml' require 'yaml'
class AddSettingsImportSources < ActiveRecord::Migration class AddSettingsImportSources < ActiveRecord::Migration[4.2]
def change def change
unless column_exists?(:application_settings, :import_sources) unless column_exists?(:application_settings, :import_sources)
add_column :application_settings, :import_sources, :text add_column :application_settings, :import_sources, :text
......
# rubocop:disable all # rubocop:disable all
class RemoveOauthTokensFromUsers < ActiveRecord::Migration class RemoveOauthTokensFromUsers < ActiveRecord::Migration[4.2]
def change def change
remove_column :users, :github_access_token, :string remove_column :users, :github_access_token, :string
remove_column :users, :gitlab_access_token, :string remove_column :users, :gitlab_access_token, :string
......
# rubocop:disable all # rubocop:disable all
class DeduplicateUserIdentities < ActiveRecord::Migration class DeduplicateUserIdentities < ActiveRecord::Migration[4.2]
def change def change
execute 'DROP TABLE IF EXISTS tt_migration_DeduplicateUserIdentities;' execute 'DROP TABLE IF EXISTS tt_migration_DeduplicateUserIdentities;'
execute 'CREATE TABLE tt_migration_DeduplicateUserIdentities AS SELECT id,provider,user_id FROM identities;' execute 'CREATE TABLE tt_migration_DeduplicateUserIdentities AS SELECT id,provider,user_id FROM identities;'
......
class AddSentNotifications < ActiveRecord::Migration class AddSentNotifications < ActiveRecord::Migration[4.2]
def change def change
create_table :sent_notifications do |t| create_table :sent_notifications do |t|
t.references :project t.references :project
......
# rubocop:disable all # rubocop:disable all
class AddEnableSslVerification < ActiveRecord::Migration class AddEnableSslVerification < ActiveRecord::Migration[4.2]
def change def change
add_column :web_hooks, :enable_ssl_verification, :boolean, default: false add_column :web_hooks, :enable_ssl_verification, :boolean, default: false
end end
......
# rubocop:disable all # rubocop:disable all
class AddCiTables < ActiveRecord::Migration class AddCiTables < ActiveRecord::Migration[4.2]
def change def change
create_table "ci_application_settings", force: true do |t| create_table "ci_application_settings", force: true do |t|
t.boolean "all_broken_builds" t.boolean "all_broken_builds"
......
# rubocop:disable all # rubocop:disable all
class AddFastForwardOptionToProject < ActiveRecord::Migration class AddFastForwardOptionToProject < ActiveRecord::Migration[4.2]
include Gitlab::Database::MigrationHelpers include Gitlab::Database::MigrationHelpers
# Set this constant to true if this migration requires downtime. # Set this constant to true if this migration requires downtime.
......
# rubocop:disable all # rubocop:disable all
class AddTemplateToLabel < ActiveRecord::Migration class AddTemplateToLabel < ActiveRecord::Migration[4.2]
def change def change
add_column :labels, :template, :boolean, default: false add_column :labels, :template, :boolean, default: false
end end
......
# rubocop:disable all # rubocop:disable all
class AddCiTags < ActiveRecord::Migration class AddCiTags < ActiveRecord::Migration[4.2]
def change def change
create_table "ci_taggings", force: true do |t| create_table "ci_taggings", force: true do |t|
t.integer "tag_id" t.integer "tag_id"
......
class EnableSslVerificationByDefault < ActiveRecord::Migration class EnableSslVerificationByDefault < ActiveRecord::Migration[4.2]
def change def change
change_column :web_hooks, :enable_ssl_verification, :boolean, default: true change_column :web_hooks, :enable_ssl_verification, :boolean, default: true
end end
......
class EnableSslVerificationForWebHooks < ActiveRecord::Migration class EnableSslVerificationForWebHooks < ActiveRecord::Migration[4.2]
def up def up
execute("UPDATE web_hooks SET enable_ssl_verification = true") execute("UPDATE web_hooks SET enable_ssl_verification = true")
end end
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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