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 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"
......