Commit 0dcd050b authored by Douwe Maan's avatar Douwe Maan

Merge branch 'enable-rubocop-for-migrations' into 'master'

Enable RuboCop for migrations

## What does this MR do?

Enable RuboCop for all files inside `db/migrate`, then add magic comments to all existing files, so that this only affects new migrations.

## Are there points in the code the reviewer needs to double check?

This entire change is a config change and a bunch of comments.

## Why was this MR needed?

```
Yorick Peterse [11:55 AM]  
I don't think we have any use case for nested def, might as well blacklist it

Sean McGivern [11:57 AM]  
http://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Lint/NestedMethodDefinition

Sean McGivern [11:57 AM]  
hmm, it's already enabled

Sean McGivern [11:57 AM]  
... because we exclude `db/` from rubocop 🙂

Douwe Maan [11:57 AM]  
@smcgivern: heh

Sean McGivern [11:59 AM]  
I guess that's because we don't want to change the old migrations? I wonder if it's worth enabling it and adding magic comments to all the previous ones to ignore rubocop

Douwe Maan [11:59 AM]  
@smcgivern: agreed
```

## What are the relevant issue numbers?

None.

## Screenshots (if relevant)

None, but if I remove the magic comment from the migration `20160416182152_convert_award_note_to_emoji_award.rb` I get:
```
$ be rubocop
Inspecting 1959 files
..................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................W....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................

Offenses:

db/migrate/20160416182152_convert_award_note_to_emoji_award.rb:3:5: W: Lint/NestedMethodDefinition: Method definitions must not be nested. Use lambda instead.
    def up ...
    ^^^^^^

1959 files inspected, 1 offense detected
```

## Does this MR meet the acceptance criteria?

- [ ] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
- [ ] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)
- [ ] API support added
- [ ] Tests
  - [ ] Added for this feature/bug
  - [ ] All builds are passing
- [ ] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [ ] Branch has no merge conflicts with `master` (if you do - rebase it please)
- [ ] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)

See merge request !4559
parents a9a9f19b 98bb435f
...@@ -13,7 +13,8 @@ AllCops: ...@@ -13,7 +13,8 @@ AllCops:
# Exclude some GitLab files # Exclude some GitLab files
Exclude: Exclude:
- 'vendor/**/*' - 'vendor/**/*'
- 'db/**/*' - 'db/*'
- 'db/fixtures/**/*'
- 'tmp/**/*' - 'tmp/**/*'
- 'bin/**/*' - 'bin/**/*'
- 'lib/backup/**/*' - 'lib/backup/**/*'
......
# rubocop:disable all
class InitSchema < ActiveRecord::Migration class InitSchema < ActiveRecord::Migration
def up def up
......
# rubocop:disable all
class RenameOwnerToCreatorForProject < ActiveRecord::Migration class RenameOwnerToCreatorForProject < ActiveRecord::Migration
def change def change
rename_column :projects, :owner_id, :creator_id rename_column :projects, :owner_id, :creator_id
......
# rubocop:disable all
class AddPublicToProject < ActiveRecord::Migration class AddPublicToProject < ActiveRecord::Migration
def change def change
add_column :projects, :public, :boolean, default: false, null: false add_column :projects, :public, :boolean, default: false, null: false
......
# rubocop:disable all
class AddIssuesTrackerToProject < ActiveRecord::Migration class AddIssuesTrackerToProject < ActiveRecord::Migration
def change def change
add_column :projects, :issues_tracker, :string, default: :gitlab, null: false add_column :projects, :issues_tracker, :string, default: :gitlab, null: false
......
# rubocop:disable all
class AddUserPermissions < ActiveRecord::Migration class AddUserPermissions < ActiveRecord::Migration
def up def up
add_column :users, :can_create_group, :boolean, default: true, null: false add_column :users, :can_create_group, :boolean, default: true, null: false
......
# rubocop:disable all
class RemovePrivateFlagFromProject < ActiveRecord::Migration class RemovePrivateFlagFromProject < ActiveRecord::Migration
def up def up
remove_column :projects, :private_flag remove_column :projects, :private_flag
......
# rubocop:disable all
class AddDescriptionToNamsespace < ActiveRecord::Migration class AddDescriptionToNamsespace < ActiveRecord::Migration
def change def change
add_column :namespaces, :description, :string, default: '', null: false add_column :namespaces, :description, :string, default: '', null: false
......
# rubocop:disable all
class AddDescriptionToTeams < ActiveRecord::Migration class AddDescriptionToTeams < ActiveRecord::Migration
def change def change
add_column :user_teams, :description, :string, default: '', null: false add_column :user_teams, :description, :string, default: '', null: false
......
# rubocop:disable all
class AddIssuesTrackerIdToProject < ActiveRecord::Migration class AddIssuesTrackerIdToProject < ActiveRecord::Migration
def change def change
add_column :projects, :issues_tracker_id, :string add_column :projects, :issues_tracker_id, :string
......
# rubocop:disable all
class RenameStateToMergeStatusInMilestone < ActiveRecord::Migration class RenameStateToMergeStatusInMilestone < ActiveRecord::Migration
def change def change
rename_column :merge_requests, :state, :merge_status rename_column :merge_requests, :state, :merge_status
......
# rubocop:disable all
class AddStateToIssue < ActiveRecord::Migration class AddStateToIssue < ActiveRecord::Migration
def change def change
add_column :issues, :state, :string add_column :issues, :state, :string
......
# rubocop:disable all
class AddStateToMergeRequest < ActiveRecord::Migration class AddStateToMergeRequest < ActiveRecord::Migration
def change def change
add_column :merge_requests, :state, :string add_column :merge_requests, :state, :string
......
# rubocop:disable all
class AddStateToMilestone < ActiveRecord::Migration class AddStateToMilestone < ActiveRecord::Migration
def change def change
add_column :milestones, :state, :string add_column :milestones, :state, :string
......
# rubocop:disable all
class ConvertClosedToStateInIssue < ActiveRecord::Migration class ConvertClosedToStateInIssue < ActiveRecord::Migration
include Gitlab::Database include Gitlab::Database
......
# rubocop:disable all
class ConvertClosedToStateInMergeRequest < ActiveRecord::Migration class ConvertClosedToStateInMergeRequest < ActiveRecord::Migration
include Gitlab::Database include Gitlab::Database
......
# rubocop:disable all
class ConvertClosedToStateInMilestone < ActiveRecord::Migration class ConvertClosedToStateInMilestone < ActiveRecord::Migration
include Gitlab::Database include Gitlab::Database
......
# rubocop:disable all
class RemoveMergedFromMergeRequest < ActiveRecord::Migration class RemoveMergedFromMergeRequest < ActiveRecord::Migration
def up def up
remove_column :merge_requests, :merged remove_column :merge_requests, :merged
......
# rubocop:disable all
class RemoveClosedFromIssue < ActiveRecord::Migration class RemoveClosedFromIssue < ActiveRecord::Migration
def up def up
remove_column :issues, :closed remove_column :issues, :closed
......
# rubocop:disable all
class RemoveClosedFromMergeRequest < ActiveRecord::Migration class RemoveClosedFromMergeRequest < ActiveRecord::Migration
def up def up
remove_column :merge_requests, :closed remove_column :merge_requests, :closed
......
# rubocop:disable all
class RemoveClosedFromMilestone < ActiveRecord::Migration class RemoveClosedFromMilestone < ActiveRecord::Migration
def up def up
remove_column :milestones, :closed remove_column :milestones, :closed
......
# rubocop:disable all
class AddNewMergeStatusToMergeRequest < ActiveRecord::Migration class AddNewMergeStatusToMergeRequest < ActiveRecord::Migration
def change def change
add_column :merge_requests, :new_merge_status, :string add_column :merge_requests, :new_merge_status, :string
......
# rubocop:disable all
class ConvertMergeStatusInMergeRequest < ActiveRecord::Migration class ConvertMergeStatusInMergeRequest < ActiveRecord::Migration
def up def up
execute "UPDATE #{table_name} SET new_merge_status = 'unchecked' WHERE merge_status = 1" execute "UPDATE #{table_name} SET new_merge_status = 'unchecked' WHERE merge_status = 1"
......
# rubocop:disable all
class RemoveMergeStatusFromMergeRequest < ActiveRecord::Migration class RemoveMergeStatusFromMergeRequest < ActiveRecord::Migration
def up def up
remove_column :merge_requests, :merge_status remove_column :merge_requests, :merge_status
......
# rubocop:disable all
class RenameNewMergeStatusToMergeStatusInMilestone < ActiveRecord::Migration class RenameNewMergeStatusToMergeStatusInMilestone < ActiveRecord::Migration
def change def change
rename_column :merge_requests, :new_merge_status, :merge_status rename_column :merge_requests, :new_merge_status, :merge_status
......
# rubocop:disable all
class AddStateToUser < ActiveRecord::Migration class AddStateToUser < ActiveRecord::Migration
def change def change
add_column :users, :state, :string add_column :users, :state, :string
......
# rubocop:disable all
class ConvertBlockedToState < ActiveRecord::Migration class ConvertBlockedToState < ActiveRecord::Migration
def up def up
User.transaction do User.transaction do
......
# rubocop:disable all
class RemoveBlockedFromUser < ActiveRecord::Migration class RemoveBlockedFromUser < ActiveRecord::Migration
def up def up
remove_column :users, :blocked remove_column :users, :blocked
......
# rubocop:disable all
class UserColorScheme < ActiveRecord::Migration class UserColorScheme < ActiveRecord::Migration
include Gitlab::Database include Gitlab::Database
......
# rubocop:disable all
class AddSnippetsToFeatures < ActiveRecord::Migration class AddSnippetsToFeatures < ActiveRecord::Migration
def change def change
add_column :projects, :snippets_enabled, :boolean, null: false, default: true add_column :projects, :snippets_enabled, :boolean, null: false, default: true
......
# rubocop:disable all
class CreateForkedProjectLinks < ActiveRecord::Migration class CreateForkedProjectLinks < ActiveRecord::Migration
def change def change
create_table :forked_project_links do |t| create_table :forked_project_links do |t|
......
# rubocop:disable all
class AddPrivateToSnippets < ActiveRecord::Migration class AddPrivateToSnippets < ActiveRecord::Migration
def change def change
add_column :snippets, :private, :boolean, null: false, default: true add_column :snippets, :private, :boolean, null: false, default: true
......
# rubocop:disable all
class AddTypeToSnippets < ActiveRecord::Migration class AddTypeToSnippets < ActiveRecord::Migration
def change def change
add_column :snippets, :type, :string add_column :snippets, :type, :string
......
# rubocop:disable all
class ChangeProjectIdToNullInSnipepts < ActiveRecord::Migration class ChangeProjectIdToNullInSnipepts < ActiveRecord::Migration
def up def up
change_column :snippets, :project_id, :integer, :null => true change_column :snippets, :project_id, :integer, :null => true
......
# rubocop:disable all
class AddTypeValueForSnippets < ActiveRecord::Migration class AddTypeValueForSnippets < ActiveRecord::Migration
def up def up
Snippet.where("project_id IS NOT NULL").update_all(type: 'ProjectSnippet') Snippet.where("project_id IS NOT NULL").update_all(type: 'ProjectSnippet')
......
# rubocop:disable all
class AddNotificationLevelToUser < ActiveRecord::Migration class AddNotificationLevelToUser < ActiveRecord::Migration
def change def change
add_column :users, :notification_level, :integer, null: false, default: 1 add_column :users, :notification_level, :integer, null: false, default: 1
......
# rubocop:disable all
class AddIndexToUsersAuthenticationToken < ActiveRecord::Migration class AddIndexToUsersAuthenticationToken < ActiveRecord::Migration
def change def change
add_index :users, :authentication_token, unique: true add_index :users, :authentication_token, unique: true
......
# rubocop:disable all
class AddLastActivityColumnIntoProject < ActiveRecord::Migration class AddLastActivityColumnIntoProject < ActiveRecord::Migration
def up def up
add_column :projects, :last_activity_at, :datetime add_column :projects, :last_activity_at, :datetime
......
# rubocop:disable all
class AddNotificationLevelToUserProject < ActiveRecord::Migration class AddNotificationLevelToUserProject < ActiveRecord::Migration
def change def change
add_column :users_projects, :notification_level, :integer, null: false, default: 3 add_column :users_projects, :notification_level, :integer, null: false, default: 3
......
# rubocop:disable all
class RemoveWikiTable < ActiveRecord::Migration class RemoveWikiTable < ActiveRecord::Migration
def up def up
drop_table :wikis drop_table :wikis
......
# rubocop:disable all
class AllowMergesForForks < ActiveRecord::Migration class AllowMergesForForks < ActiveRecord::Migration
def self.up def self.up
add_column :merge_requests, :target_project_id, :integer, :null => true add_column :merge_requests, :target_project_id, :integer, :null => true
......
# rubocop:disable all
class AddTypeToKey < ActiveRecord::Migration class AddTypeToKey < ActiveRecord::Migration
def change def change
add_column :keys, :type, :string add_column :keys, :type, :string
......
# rubocop:disable all
class CreateDeployKeysProjects < ActiveRecord::Migration class CreateDeployKeysProjects < ActiveRecord::Migration
def change def change
create_table :deploy_keys_projects do |t| create_table :deploy_keys_projects do |t|
......
# rubocop:disable all
class RemoveProjectIdFromKey < ActiveRecord::Migration class RemoveProjectIdFromKey < ActiveRecord::Migration
def up def up
puts 'Migrate deploy keys: ' puts 'Migrate deploy keys: '
......
# rubocop:disable all
class AddMoreFieldsToService < ActiveRecord::Migration class AddMoreFieldsToService < ActiveRecord::Migration
def change def change
add_column :services, :subdomain, :string add_column :services, :subdomain, :string
......
# rubocop:disable all
class AddSystemToNotes < ActiveRecord::Migration class AddSystemToNotes < ActiveRecord::Migration
class Note < ActiveRecord::Base class Note < ActiveRecord::Base
end end
......
# rubocop:disable all
class IncreaseSnippetTextColumnSize < ActiveRecord::Migration class IncreaseSnippetTextColumnSize < ActiveRecord::Migration
def up def up
# MYSQL LARGETEXT for snippet # MYSQL LARGETEXT for snippet
......
# rubocop:disable all
class AddPasswordExpiresAtToUsers < ActiveRecord::Migration class AddPasswordExpiresAtToUsers < ActiveRecord::Migration
def change def change
add_column :users, :password_expires_at, :datetime add_column :users, :password_expires_at, :datetime
......
# rubocop:disable all
class AddCreatedByIdToUser < ActiveRecord::Migration class AddCreatedByIdToUser < ActiveRecord::Migration
def change def change
add_column :users, :created_by_id, :integer add_column :users, :created_by_id, :integer
......
# rubocop:disable all
class AddImprotedToProject < ActiveRecord::Migration class AddImprotedToProject < ActiveRecord::Migration
def change def change
add_column :projects, :imported, :boolean, default: false, null: false add_column :projects, :imported, :boolean, default: false, null: false
......
# rubocop:disable all
class CreateUsersGroups < ActiveRecord::Migration class CreateUsersGroups < ActiveRecord::Migration
def change def change
create_table :users_groups do |t| create_table :users_groups do |t|
......
# rubocop:disable all
class AddNotificationLevelToUserGroup < ActiveRecord::Migration class AddNotificationLevelToUserGroup < ActiveRecord::Migration
def change def change
add_column :users_groups, :notification_level, :integer, null: false, default: 3 add_column :users_groups, :notification_level, :integer, null: false, default: 3
......
# rubocop:disable all
class AddMoreDbIndex < ActiveRecord::Migration class AddMoreDbIndex < ActiveRecord::Migration
def change def change
add_index :deploy_keys_projects, :project_id add_index :deploy_keys_projects, :project_id
......
# rubocop:disable all
class AddFingerprintToKey < ActiveRecord::Migration class AddFingerprintToKey < ActiveRecord::Migration
def change def change
add_column :keys, :fingerprint, :string add_column :keys, :fingerprint, :string
......
# rubocop:disable all
class CreateProjectGroupLinks < ActiveRecord::Migration class CreateProjectGroupLinks < ActiveRecord::Migration
def change def change
create_table :project_group_links do |t| create_table :project_group_links do |t|
......
# rubocop:disable all
class AddStDiffToNote < ActiveRecord::Migration class AddStDiffToNote < ActiveRecord::Migration
def change def change
add_column :notes, :st_diff, :text, :null => true add_column :notes, :st_diff, :text, :null => true
......
# rubocop:disable all
class AddPermissionCheckToUser < ActiveRecord::Migration class AddPermissionCheckToUser < ActiveRecord::Migration
def change def change
add_column :users, :last_credential_check_at, :datetime add_column :users, :last_credential_check_at, :datetime
......
# rubocop:disable all
class AddImportUrlToProject < ActiveRecord::Migration class AddImportUrlToProject < ActiveRecord::Migration
def change def change
add_column :projects, :import_url, :string add_column :projects, :import_url, :string
......
# rubocop:disable all
class AddInternalIdsToIssuesAndMr < ActiveRecord::Migration class AddInternalIdsToIssuesAndMr < ActiveRecord::Migration
def change def change
add_column :issues, :iid, :integer add_column :issues, :iid, :integer
......
# rubocop:disable all
class AddAccessToProjectGroupLink < ActiveRecord::Migration class AddAccessToProjectGroupLink < ActiveRecord::Migration
def change def change
add_column :project_group_links, :group_access, :integer, null: false, default: ProjectGroupLink.default_access add_column :project_group_links, :group_access, :integer, null: false, default: ProjectGroupLink.default_access
......
# rubocop:disable all
class RemoveDeprecatedTables < ActiveRecord::Migration class RemoveDeprecatedTables < ActiveRecord::Migration
def up def up
drop_table :user_teams drop_table :user_teams
......
# rubocop:disable all
class AddInternalIdsToMilestones < ActiveRecord::Migration class AddInternalIdsToMilestones < ActiveRecord::Migration
def change def change
add_column :milestones, :iid, :integer add_column :milestones, :iid, :integer
......
# rubocop:disable all
class AddDescriptionToMergeRequest < ActiveRecord::Migration class AddDescriptionToMergeRequest < ActiveRecord::Migration
def change def change
add_column :merge_requests, :description, :text, null: true add_column :merge_requests, :description, :text, null: true
......
# rubocop:disable all
class ChangeOwnerIdForGroup < ActiveRecord::Migration class ChangeOwnerIdForGroup < ActiveRecord::Migration
def up def up
change_column :namespaces, :owner_id, :integer, null: true change_column :namespaces, :owner_id, :integer, null: true
......
# rubocop:disable all
class AddAvatarToUsers < ActiveRecord::Migration class AddAvatarToUsers < ActiveRecord::Migration
def change def change
add_column :users, :avatar, :string add_column :users, :avatar, :string
......
# rubocop:disable all
class AddConfirmableToUsers < ActiveRecord::Migration class AddConfirmableToUsers < ActiveRecord::Migration
def self.up def self.up
add_column :users, :confirmation_token, :string add_column :users, :confirmation_token, :string
......
# rubocop:disable all
class RemoveDefaultBranch < ActiveRecord::Migration class RemoveDefaultBranch < ActiveRecord::Migration
def up def up
remove_column :projects, :default_branch remove_column :projects, :default_branch
......
# rubocop:disable all
class CreateBroadcastMessages < ActiveRecord::Migration class CreateBroadcastMessages < ActiveRecord::Migration
def change def change
create_table :broadcast_messages do |t| create_table :broadcast_messages do |t|
......
# rubocop:disable all
class AddVisibilityLevelToProjects < ActiveRecord::Migration class AddVisibilityLevelToProjects < ActiveRecord::Migration
include Gitlab::Database include Gitlab::Database
......
# rubocop:disable all
class AddArchivedToProjects < ActiveRecord::Migration class AddArchivedToProjects < ActiveRecord::Migration
def change def change
add_column :projects, :archived, :boolean, default: false, null: false add_column :projects, :archived, :boolean, default: false, null: false
......
# rubocop:disable all
class AddColorAndFontToBroadcastMessages < ActiveRecord::Migration class AddColorAndFontToBroadcastMessages < ActiveRecord::Migration
def change def change
add_column :broadcast_messages, :color, :string add_column :broadcast_messages, :color, :string
......
# rubocop:disable all
class AddEventFieldsForWebHook < ActiveRecord::Migration class AddEventFieldsForWebHook < ActiveRecord::Migration
def change def change
add_column :web_hooks, :push_events, :boolean, default: true, null: false add_column :web_hooks, :push_events, :boolean, default: true, null: false
......
# rubocop:disable all
class AddHideNoSshKeyToUsers < ActiveRecord::Migration class AddHideNoSshKeyToUsers < ActiveRecord::Migration
def change def change
add_column :users, :hide_no_ssh_key, :boolean, :default => false add_column :users, :hide_no_ssh_key, :boolean, :default => false
......
# rubocop:disable all
class AddRecipientsToService < ActiveRecord::Migration class AddRecipientsToService < ActiveRecord::Migration
def change def change
add_column :services, :recipients, :text add_column :services, :recipients, :text
......
# rubocop:disable all
class AddWebsiteUrlToUsers < ActiveRecord::Migration class AddWebsiteUrlToUsers < ActiveRecord::Migration
def change def change
add_column :users, :website_url, :string, {:null => false, :default => ''} add_column :users, :website_url, :string, {:null => false, :default => ''}
......
# rubocop:disable all
class CreateMergeRequestDiffs < ActiveRecord::Migration class CreateMergeRequestDiffs < ActiveRecord::Migration
def up def up
create_table :merge_request_diffs do |t| create_table :merge_request_diffs do |t|
......
# rubocop:disable all
class MigrateMrDiffs < ActiveRecord::Migration class MigrateMrDiffs < ActiveRecord::Migration
def self.up def self.up
execute "INSERT INTO merge_request_diffs ( merge_request_id, st_commits, st_diffs ) SELECT id, st_commits, st_diffs FROM merge_requests" execute "INSERT INTO merge_request_diffs ( merge_request_id, st_commits, st_diffs ) SELECT id, st_commits, st_diffs FROM merge_requests"
......
# rubocop:disable all
class RemoveMRdiffFields < ActiveRecord::Migration class RemoveMRdiffFields < ActiveRecord::Migration
def up def up
remove_column :merge_requests, :st_commits remove_column :merge_requests, :st_commits
......
# rubocop:disable all
class AddAvatarToProjects < ActiveRecord::Migration class AddAvatarToProjects < ActiveRecord::Migration
def change def change
add_column :projects, :avatar, :string add_column :projects, :avatar, :string
......
# rubocop:disable all
class AddGroupAvatars < ActiveRecord::Migration class AddGroupAvatars < ActiveRecord::Migration
def change def change
add_column :namespaces, :avatar, :string add_column :namespaces, :avatar, :string
......
# rubocop:disable all
class CreateEmails < ActiveRecord::Migration class CreateEmails < ActiveRecord::Migration
def change def change
create_table :emails do |t| create_table :emails do |t|
......
# rubocop:disable all
class AddApiKeyToServices < ActiveRecord::Migration class AddApiKeyToServices < ActiveRecord::Migration
def change def change
add_column :services, :api_key, :string add_column :services, :api_key, :string
......
# rubocop:disable all
class AddIndexMergeRequestDiffsOnMergeRequestId < ActiveRecord::Migration class AddIndexMergeRequestDiffsOnMergeRequestId < ActiveRecord::Migration
def change def change
add_index :merge_request_diffs, :merge_request_id, unique: true add_index :merge_request_diffs, :merge_request_id, unique: true
......
# rubocop:disable all
class AddTagPushHooksToProjectHook < ActiveRecord::Migration class AddTagPushHooksToProjectHook < ActiveRecord::Migration
def change def change
add_column :web_hooks, :tag_push_events, :boolean, default: false add_column :web_hooks, :tag_push_events, :boolean, default: false
......
# rubocop:disable all
class AddImportStatusToProject < ActiveRecord::Migration class AddImportStatusToProject < ActiveRecord::Migration
def change def change
add_column :projects, :import_status, :string add_column :projects, :import_status, :string
......
# rubocop:disable all
class MigrateAlreadyImportedProjects < ActiveRecord::Migration class MigrateAlreadyImportedProjects < ActiveRecord::Migration
include Gitlab::Database include Gitlab::Database
......
# rubocop:disable all
class FixNamespaces < ActiveRecord::Migration class FixNamespaces < ActiveRecord::Migration
def up def up
Namespace.where('name <> path and type is null').each do |namespace| Namespace.where('name <> path and type is null').each do |namespace|
......
# rubocop:disable all
class ChangeStateToAllowEmptyMergeRequestDiffs < ActiveRecord::Migration class ChangeStateToAllowEmptyMergeRequestDiffs < ActiveRecord::Migration
def up def up
change_column :merge_request_diffs, :state, :string, null: true, change_column :merge_request_diffs, :state, :string, null: true,
......
# rubocop:disable all
require_relative 'limits_to_mysql' require_relative 'limits_to_mysql'
# rubocop:disable all
class AddIndexOnIid < ActiveRecord::Migration class AddIndexOnIid < ActiveRecord::Migration
def change def change
RemoveDuplicateIid.clean(Issue) RemoveDuplicateIid.clean(Issue)
......
# rubocop:disable all
class IndexOnCurrentSignInAt < ActiveRecord::Migration class IndexOnCurrentSignInAt < ActiveRecord::Migration
def change def change
add_index :users, :current_sign_in_at add_index :users, :current_sign_in_at
......
# rubocop:disable all
class AddNotesIndexUpdatedAt < ActiveRecord::Migration class AddNotesIndexUpdatedAt < ActiveRecord::Migration
def change def change
add_index :notes, :updated_at add_index :notes, :updated_at
......
# rubocop:disable all
class AddRepoSizeToDb < ActiveRecord::Migration class AddRepoSizeToDb < ActiveRecord::Migration
def change def change
add_column :projects, :repository_size, :float, default: 0 add_column :projects, :repository_size, :float, default: 0
......
# rubocop:disable all
class MigrateRepoSize < ActiveRecord::Migration class MigrateRepoSize < ActiveRecord::Migration
def up def up
project_data = execute('SELECT projects.id, namespaces.path AS namespace_path, projects.path AS project_path FROM projects LEFT JOIN namespaces ON projects.namespace_id = namespaces.id') project_data = execute('SELECT projects.id, namespaces.path AS namespace_path, projects.path AS project_path FROM projects LEFT JOIN namespaces ON projects.namespace_id = namespaces.id')
......
# rubocop:disable all
class AddPositionToMergeRequest < ActiveRecord::Migration class AddPositionToMergeRequest < ActiveRecord::Migration
def change def change
add_column :merge_requests, :position, :integer, default: 0 add_column :merge_requests, :position, :integer, default: 0
......
# rubocop:disable all
class CreateUsersStarProjects < ActiveRecord::Migration class CreateUsersStarProjects < ActiveRecord::Migration
def change def change
create_table :users_star_projects do |t| create_table :users_star_projects do |t|
......
# rubocop:disable all
class CreateLabels < ActiveRecord::Migration class CreateLabels < ActiveRecord::Migration
def change def change
create_table :labels do |t| create_table :labels do |t|
......
# rubocop:disable all
class CreateLabelLinks < ActiveRecord::Migration class CreateLabelLinks < ActiveRecord::Migration
def change def change
create_table :label_links do |t| create_table :label_links do |t|
......
# rubocop:disable all
class MigrateProjectTags < ActiveRecord::Migration class MigrateProjectTags < ActiveRecord::Migration
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')
......
# rubocop:disable all
class MigrateTaggableLabels < ActiveRecord::Migration class MigrateTaggableLabels < ActiveRecord::Migration
def up def up
taggings = ActsAsTaggableOn::Tagging.where(taggable_type: ['Issue', 'MergeRequest'], context: 'labels') taggings = ActsAsTaggableOn::Tagging.where(taggable_type: ['Issue', 'MergeRequest'], context: 'labels')
......
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