Skip to content
代码片段 群组 项目
提交 76a6f555 编辑于 作者: Jan Provaznik's avatar Jan Provaznik 提交者: Rémy Coutable
浏览文件

[EE] Add rails version to all migrations

上级 0d47652a
No related branches found
No related tags found
无相关合并请求
显示
22 个添加19 个删除
...@@ -28,6 +28,9 @@ class Application < Rails::Application ...@@ -28,6 +28,9 @@ class Application < Rails::Application
# 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"
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册