Commit 0fc9f9d3 authored by Jan Provaznik's avatar Jan Provaznik

Add version 4.2 to all existing migrations

DB schema generated by a migration may look different in
rails 4 and 5 (because rails 5 may use different default values).
For this reason it's important to explicitly set for which rails
version a migration was written for.

See https://stackoverflow.com/questions/35929869/activerecordmigration-deprecation-warning-asks-for-rails-version-but-im-no/35930912#35930912
parent fcec474c

Too many changes to show.

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

class InitSchema < ActiveRecord::Migration
class InitSchema < ActiveRecord::Migration[4.2]
DOWNTIME = true
# rubocop:disable Metrics/AbcSize
......
class FixNamespaces < ActiveRecord::Migration
class FixNamespaces < ActiveRecord::Migration[4.2]
DOWNTIME = false
def up
......
# rubocop:disable all
class ChangeStateToAllowEmptyMergeRequestDiffs < ActiveRecord::Migration
class ChangeStateToAllowEmptyMergeRequestDiffs < ActiveRecord::Migration[4.2]
def up
change_column :merge_request_diffs, :state, :string, null: true,
default: nil
......
# rubocop:disable all
class AddIndexOnIid < ActiveRecord::Migration
class AddIndexOnIid < ActiveRecord::Migration[4.2]
def change
RemoveDuplicateIid.clean(Issue)
RemoveDuplicateIid.clean(MergeRequest, 'target_project_id')
......
# rubocop:disable all
class IndexOnCurrentSignInAt < ActiveRecord::Migration
class IndexOnCurrentSignInAt < ActiveRecord::Migration[4.2]
def change
add_index :users, :current_sign_in_at
end
......
# rubocop:disable all
class AddNotesIndexUpdatedAt < ActiveRecord::Migration
class AddNotesIndexUpdatedAt < ActiveRecord::Migration[4.2]
def change
add_index :notes, :updated_at
end
......
# rubocop:disable all
class AddRepoSizeToDb < ActiveRecord::Migration
class AddRepoSizeToDb < ActiveRecord::Migration[4.2]
def change
add_column :projects, :repository_size, :float, default: 0
end
......
# rubocop:disable all
class MigrateRepoSize < ActiveRecord::Migration
class MigrateRepoSize < ActiveRecord::Migration[4.2]
DOWNTIME = false
def up
......
# rubocop:disable all
class AddPositionToMergeRequest < ActiveRecord::Migration
class AddPositionToMergeRequest < ActiveRecord::Migration[4.2]
def change
add_column :merge_requests, :position, :integer, default: 0
end
......
# rubocop:disable all
class CreateUsersStarProjects < ActiveRecord::Migration
class CreateUsersStarProjects < ActiveRecord::Migration[4.2]
DOWNTIME = false
def change
......
# rubocop:disable all
class CreateLabels < ActiveRecord::Migration
class CreateLabels < ActiveRecord::Migration[4.2]
DOWNTIME = false
def change
......
# rubocop:disable all
class CreateLabelLinks < ActiveRecord::Migration
class CreateLabelLinks < ActiveRecord::Migration[4.2]
DOWNTIME = false
def change
......
class MigrateProjectTags < ActiveRecord::Migration
class MigrateProjectTags < ActiveRecord::Migration[4.2]
def up
ActsAsTaggableOn::Tagging.where(taggable_type: 'Project', context: 'labels').update_all(context: 'tags')
end
......
# rubocop:disable all
class MigrateTaggableLabels < ActiveRecord::Migration
class MigrateTaggableLabels < ActiveRecord::Migration[4.2]
def up
taggings = ActsAsTaggableOn::Tagging.where(taggable_type: ['Issue', 'MergeRequest'], context: 'labels')
taggings.find_each(batch_size: 500) do |tagging|
......
# rubocop:disable all
class AddIndexToLabels < ActiveRecord::Migration
class AddIndexToLabels < ActiveRecord::Migration[4.2]
def change
add_index "labels", :project_id
add_index "label_links", :label_id
......
# rubocop:disable all
class MigrateToNewShell < ActiveRecord::Migration
class MigrateToNewShell < ActiveRecord::Migration[4.2]
def change
return if Rails.env.test?
......
# rubocop:disable all
class SerializeServiceProperties < ActiveRecord::Migration
class SerializeServiceProperties < ActiveRecord::Migration[4.2]
def change
unless column_exists?(:services, :properties)
add_column :services, :properties, :text
......
# rubocop:disable all
class AddMembersTable < ActiveRecord::Migration
class AddMembersTable < ActiveRecord::Migration[4.2]
DOWNTIME = false
def change
......
# rubocop:disable all
class MigrateToNewMembersModel < ActiveRecord::Migration
class MigrateToNewMembersModel < ActiveRecord::Migration[4.2]
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, project_id, 'Project', project_access, notification_level, 'ProjectMember' FROM users_projects"
......
# rubocop:disable all
class RemoveOldMemberTables < ActiveRecord::Migration
class RemoveOldMemberTables < ActiveRecord::Migration[4.2]
DOWNTIME = false
def up
......
# rubocop:disable all
class MoveSlackServiceToWebhook < ActiveRecord::Migration
class MoveSlackServiceToWebhook < ActiveRecord::Migration[4.2]
DOWNTIME = true
DOWNTIME_REASON = 'Move old fields "token" and "subdomain" to one single field "webhook"'
......
# rubocop:disable all
class AddVisibilityLevelToSnippet < ActiveRecord::Migration
class AddVisibilityLevelToSnippet < ActiveRecord::Migration[4.2]
include Gitlab::Database::MigrationHelpers
def up
......
# rubocop:disable all
class AddAuditEvent < ActiveRecord::Migration
class AddAuditEvent < ActiveRecord::Migration[4.2]
DOWNTIME = false
def change
......
......@@ -3,7 +3,7 @@
# became a problem after commit c8e78d972a5a628870eefca0f2ccea0199c55bda which
# 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.
class AddTimestampsToMembers < ActiveRecord::Migration
class AddTimestampsToMembers < ActiveRecord::Migration[4.2]
def up
execute "UPDATE members SET created_at = NOW() WHERE created_at is NULL"
execute "UPDATE members SET updated_at = NOW() WHERE updated_at is NULL"
......
# rubocop:disable all
class AddIdentityTable < ActiveRecord::Migration
class AddIdentityTable < ActiveRecord::Migration[4.2]
def up
create_table :identities do |t|
t.string :extern_uid
......
# rubocop:disable all
class AddMergeRequestRebaseEnabledToProjects < ActiveRecord::Migration
class AddMergeRequestRebaseEnabledToProjects < ActiveRecord::Migration[4.2]
include Gitlab::Database::MigrationHelpers
# Set this constant to true if this migration requires downtime.
......