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')
......
# rubocop:disable all
class AddIndexToLabels < ActiveRecord::Migration class AddIndexToLabels < ActiveRecord::Migration
def change def change
add_index "labels", :project_id add_index "labels", :project_id
......
# rubocop:disable all
class MigrateToNewShell < ActiveRecord::Migration class MigrateToNewShell < ActiveRecord::Migration
def change def change
return if Rails.env.test? return if Rails.env.test?
......
# rubocop:disable all
class SerializeServiceProperties < ActiveRecord::Migration class SerializeServiceProperties < ActiveRecord::Migration
def change def change
unless column_exists?(:services, :properties) unless column_exists?(:services, :properties)
......
# rubocop:disable all
class AddMembersTable < ActiveRecord::Migration class AddMembersTable < ActiveRecord::Migration
def change def change
create_table :members do |t| create_table :members do |t|
......
# rubocop:disable all
class MigrateToNewMembersModel < ActiveRecord::Migration class MigrateToNewMembersModel < ActiveRecord::Migration
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"
......
# rubocop:disable all
class RemoveOldMemberTables < ActiveRecord::Migration class RemoveOldMemberTables < ActiveRecord::Migration
def up def up
drop_table :users_groups drop_table :users_groups
......
# rubocop:disable all
class MoveSlackServiceToWebhook < ActiveRecord::Migration class MoveSlackServiceToWebhook < ActiveRecord::Migration
def change def change
SlackService.all.each do |slack_service| SlackService.all.each do |slack_service|
......
# rubocop:disable all
class AddVisibilityLevelToSnippet < ActiveRecord::Migration class AddVisibilityLevelToSnippet < ActiveRecord::Migration
include Gitlab::Database include Gitlab::Database
......
# rubocop:disable all
class AddAuditEvent < ActiveRecord::Migration class AddAuditEvent < ActiveRecord::Migration
def change def change
create_table :audit_events do |t| create_table :audit_events do |t|
......
# rubocop:disable all
# In 20140914145549_migrate_to_new_members_model.rb we forgot to set the # In 20140914145549_migrate_to_new_members_model.rb we forgot to set the
# created_at and updated_at times for new records in the 'members' table. This # created_at and updated_at times for new records in the 'members' table. This
# became a problem after commit c8e78d972a5a628870eefca0f2ccea0199c55bda which # became a problem after commit c8e78d972a5a628870eefca0f2ccea0199c55bda which
......
# rubocop:disable all
class AddIdentityTable < ActiveRecord::Migration class AddIdentityTable < ActiveRecord::Migration
def up def up
create_table :identities do |t| create_table :identities do |t|
......
# rubocop:disable all
class AddLockedAtToMergeRequest < ActiveRecord::Migration class AddLockedAtToMergeRequest < ActiveRecord::Migration
def change def change
add_column :merge_requests, :locked_at, :datetime add_column :merge_requests, :locked_at, :datetime
......
# rubocop:disable all
class CreateDoorkeeperTables < ActiveRecord::Migration class CreateDoorkeeperTables < ActiveRecord::Migration
def change def change
create_table :oauth_applications do |t| create_table :oauth_applications do |t|
......
# rubocop:disable all
class AddOwnerToApplication < ActiveRecord::Migration class AddOwnerToApplication < ActiveRecord::Migration
def change def change
add_column :oauth_applications, :owner_id, :integer, null: true add_column :oauth_applications, :owner_id, :integer, null: true
......
# rubocop:disable all
class AddImportDataToProjectTable < ActiveRecord::Migration class AddImportDataToProjectTable < ActiveRecord::Migration
def change def change
add_column :projects, :import_type, :string add_column :projects, :import_type, :string
......
# rubocop:disable all
class AddDevelopersCanPushToProtectedBranches < ActiveRecord::Migration class AddDevelopersCanPushToProtectedBranches < ActiveRecord::Migration
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
......
# rubocop:disable all
class CreateApplicationSettings < ActiveRecord::Migration class CreateApplicationSettings < ActiveRecord::Migration
def change def change
create_table :application_settings do |t| create_table :application_settings do |t|
......
# rubocop:disable all
class AddHomePageUrlForApplicationSettings < ActiveRecord::Migration class AddHomePageUrlForApplicationSettings < ActiveRecord::Migration
def change def change
add_column :application_settings, :home_page_url, :string add_column :application_settings, :home_page_url, :string
......
# rubocop:disable all
class AddGitlabAccessTokenToUser < ActiveRecord::Migration class AddGitlabAccessTokenToUser < ActiveRecord::Migration
def change def change
add_column :users, :gitlab_access_token, :string add_column :users, :gitlab_access_token, :string
......
# rubocop:disable all
class AddDefaultBranchProtectionSetting < ActiveRecord::Migration class AddDefaultBranchProtectionSetting < ActiveRecord::Migration
def change def change
add_column :application_settings, :default_branch_protection, :integer, :default => 2 add_column :application_settings, :default_branch_protection, :integer, :default => 2
......
# rubocop:disable all
class AddTimestampsToIdentities < ActiveRecord::Migration class AddTimestampsToIdentities < ActiveRecord::Migration
def change def change
add_timestamps(:identities) add_timestamps(:identities)
......
# rubocop:disable all
class AddIndexToCreatedAt < ActiveRecord::Migration class AddIndexToCreatedAt < ActiveRecord::Migration
def change def change
add_index "users", [:created_at, :id] add_index "users", [:created_at, :id]
......
# rubocop:disable all
class AddNotificationEmailToUser < ActiveRecord::Migration class AddNotificationEmailToUser < ActiveRecord::Migration
def up def up
add_column :users, :notification_email, :string add_column :users, :notification_email, :string
......
# rubocop:disable all
class AddMissingIndex < ActiveRecord::Migration class AddMissingIndex < ActiveRecord::Migration
def change def change
add_index "services", [:created_at, :id] add_index "services", [:created_at, :id]
......
# rubocop:disable all
class AddTemplateToService < ActiveRecord::Migration class AddTemplateToService < ActiveRecord::Migration
def change def change
add_column :services, :template, :boolean, default: false add_column :services, :template, :boolean, default: false
......
# rubocop:disable all
class AllowNullInServicesProjectId < ActiveRecord::Migration class AllowNullInServicesProjectId < ActiveRecord::Migration
def change def change
change_column :services, :project_id, :integer, null: true change_column :services, :project_id, :integer, null: true
......
# rubocop:disable all
class AddTwitterSharingEnabledToApplicationSettings < ActiveRecord::Migration class AddTwitterSharingEnabledToApplicationSettings < ActiveRecord::Migration
def change def change
add_column :application_settings, :twitter_sharing_enabled, :boolean, default: true add_column :application_settings, :twitter_sharing_enabled, :boolean, default: true
......
# rubocop:disable all
class AddHideNoPasswordToUser < ActiveRecord::Migration class AddHideNoPasswordToUser < ActiveRecord::Migration
def change def change
add_column :users, :hide_no_password, :boolean, default: false add_column :users, :hide_no_password, :boolean, default: false
......
# rubocop:disable all
class AddPasswordAutomaticallySetToUser < ActiveRecord::Migration class AddPasswordAutomaticallySetToUser < ActiveRecord::Migration
def change def change
add_column :users, :password_automatically_set, :boolean, default: false add_column :users, :password_automatically_set, :boolean, default: false
......
# rubocop:disable all
class AddBitbucketAccessTokenAndSecretToUser < ActiveRecord::Migration class AddBitbucketAccessTokenAndSecretToUser < ActiveRecord::Migration
def change def change
add_column :users, :bitbucket_access_token, :string add_column :users, :bitbucket_access_token, :string
......
# rubocop:disable all
class AddEventsToServices < ActiveRecord::Migration class AddEventsToServices < ActiveRecord::Migration
def change def change
add_column :services, :push_events, :boolean, :default => true add_column :services, :push_events, :boolean, :default => true
......
# rubocop:disable all
class SetMissingLastActivityAt < ActiveRecord::Migration class SetMissingLastActivityAt < ActiveRecord::Migration
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"
......
# rubocop:disable all
class AddNoteEventsToServices < ActiveRecord::Migration class AddNoteEventsToServices < ActiveRecord::Migration
def change def change
add_column :services, :note_events, :boolean, default: true, null: false add_column :services, :note_events, :boolean, default: true, null: false
......
# rubocop:disable all
class AddRestrictedVisibilityLevelsToApplicationSettings < ActiveRecord::Migration class AddRestrictedVisibilityLevelsToApplicationSettings < ActiveRecord::Migration
def change def change
add_column :application_settings, :restricted_visibility_levels, :text add_column :application_settings, :restricted_visibility_levels, :text
......
# rubocop:disable all
class FixNamespaceDuplication < ActiveRecord::Migration class FixNamespaceDuplication < ActiveRecord::Migration
def up def up
#fixes path duplication #fixes path duplication
......
# rubocop:disable all
class AddUniqueIndexToNamespace < ActiveRecord::Migration class AddUniqueIndexToNamespace < ActiveRecord::Migration
def change def change
remove_index :namespaces, column: :name if index_exists?(:namespaces, :name) remove_index :namespaces, column: :name if index_exists?(:namespaces, :name)
......
# rubocop:disable all
class AddVersionCheckToApplicationSettings < ActiveRecord::Migration class AddVersionCheckToApplicationSettings < ActiveRecord::Migration
def change def change
add_column :application_settings, :version_check_enabled, :boolean, default: true add_column :application_settings, :version_check_enabled, :boolean, default: true
......
# rubocop:disable all
class CreateSubscriptionsTable < ActiveRecord::Migration class CreateSubscriptionsTable < ActiveRecord::Migration
def change def change
create_table :subscriptions do |t| create_table :subscriptions do |t|
......
# rubocop:disable all
class AddLocationToUser < ActiveRecord::Migration class AddLocationToUser < ActiveRecord::Migration
def change def change
add_column :users, :location, :string add_column :users, :location, :string
......
# rubocop:disable all
class SetIncorrectAssigneeIdToNull < ActiveRecord::Migration class SetIncorrectAssigneeIdToNull < ActiveRecord::Migration
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"
......
# rubocop:disable all
class AddPublicToKey < ActiveRecord::Migration class AddPublicToKey < ActiveRecord::Migration
def change def change
add_column :keys, :public, :boolean, default: false, null: false add_column :keys, :public, :boolean, default: false, null: false
......
# rubocop:disable all
class AddImportDataToProject < ActiveRecord::Migration class AddImportDataToProject < ActiveRecord::Migration
def change def change
add_column :projects, :import_data, :text add_column :projects, :import_data, :text
......
# rubocop:disable all
class AddDeviseTwoFactorToUsers < ActiveRecord::Migration class AddDeviseTwoFactorToUsers < ActiveRecord::Migration
def change def change
add_column :users, :encrypted_otp_secret, :string add_column :users, :encrypted_otp_secret, :string
......
# rubocop:disable all
class AddMaxAttachmentSizeToApplicationSettings < ActiveRecord::Migration class AddMaxAttachmentSizeToApplicationSettings < ActiveRecord::Migration
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
......
# rubocop:disable all
class AddDeviseTwoFactorBackupableToUsers < ActiveRecord::Migration class AddDeviseTwoFactorBackupableToUsers < ActiveRecord::Migration
def change def change
add_column :users, :otp_backup_codes, :text add_column :users, :otp_backup_codes, :text
......
# rubocop:disable all
class AddInviteDataToMember < ActiveRecord::Migration class AddInviteDataToMember < ActiveRecord::Migration
def up def up
add_column :members, :created_by_id, :integer add_column :members, :created_by_id, :integer
......
# rubocop:disable all
class FixIdentities < ActiveRecord::Migration class FixIdentities < ActiveRecord::Migration
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
......
# rubocop:disable all
class RenameBuildboxService < ActiveRecord::Migration class RenameBuildboxService < ActiveRecord::Migration
def up def up
execute "UPDATE services SET type = 'BuildkiteService' WHERE type = 'BuildboxService';" execute "UPDATE services SET type = 'BuildkiteService' WHERE type = 'BuildboxService';"
......
# rubocop:disable all
class AddPublicEmailToUsers < ActiveRecord::Migration class AddPublicEmailToUsers < ActiveRecord::Migration
def change def change
add_column :users, :public_email, :string, default: "", null: false add_column :users, :public_email, :string, default: "", null: false
......
# rubocop:disable all
class CreateProjectImportData < ActiveRecord::Migration class CreateProjectImportData < ActiveRecord::Migration
def change def change
create_table :project_import_data do |t| create_table :project_import_data do |t|
......
# rubocop:disable all
class RemoveImportDataFromProject < ActiveRecord::Migration class RemoveImportDataFromProject < ActiveRecord::Migration
def up def up
remove_column :projects, :import_data remove_column :projects, :import_data
......
# rubocop:disable all
class RemovePeriodsAtEndsOfUsernames < ActiveRecord::Migration class RemovePeriodsAtEndsOfUsernames < ActiveRecord::Migration
include Gitlab::ShellAdapter include Gitlab::ShellAdapter
......
# rubocop:disable all
class AddDefaultProjectVisibililtyToApplicationSettings < ActiveRecord::Migration class AddDefaultProjectVisibililtyToApplicationSettings < ActiveRecord::Migration
def up def up
add_column :application_settings, :default_project_visibility, :integer add_column :application_settings, :default_project_visibility, :integer
......
# rubocop:disable all
# 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.
......
# rubocop:disable all
class RemoveDuplicateTags < ActiveRecord::Migration class RemoveDuplicateTags < ActiveRecord::Migration
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|
......
# 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
def self.up def self.up
......
# 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
def self.up def self.up
......
# rubocop:disable all
# 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
def self.up def self.up
......
# rubocop:disable all
# 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
......
# rubocop:disable all
class AddDefaultSnippetVisibilityToAppSettings < ActiveRecord::Migration class AddDefaultSnippetVisibilityToAppSettings < ActiveRecord::Migration
def up def up
add_column :application_settings, :default_snippet_visibility, :integer add_column :application_settings, :default_snippet_visibility, :integer
......
# rubocop:disable all
class RemoveAbandonedGroupMembersRecords < ActiveRecord::Migration class RemoveAbandonedGroupMembersRecords < ActiveRecord::Migration
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(\
......
# rubocop:disable all
class AddRestrictedSignupDomainsToApplicationSettings < ActiveRecord::Migration class AddRestrictedSignupDomainsToApplicationSettings < ActiveRecord::Migration
def change def change
add_column :application_settings, :restricted_signup_domains, :text add_column :application_settings, :restricted_signup_domains, :text
......
# rubocop:disable all
# Convert legacy Markdown-emphasized notes to the current, non-emphasized format # Convert legacy Markdown-emphasized notes to the current, non-emphasized format
# #
# _mentioned in 54f7727c850972f0401c1312a7c4a6a380de5666_ # _mentioned in 54f7727c850972f0401c1312a7c4a6a380de5666_
......
# rubocop:disable all
class AddNoteEventsToWebHooks < ActiveRecord::Migration class AddNoteEventsToWebHooks < ActiveRecord::Migration
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
......
# rubocop:disable all
class AddUserOauthApplicationsToApplicationSettings < ActiveRecord::Migration class AddUserOauthApplicationsToApplicationSettings < ActiveRecord::Migration
def change def change
add_column :application_settings, :user_oauth_applications, :bool, default: true add_column :application_settings, :user_oauth_applications, :bool, default: true
......
# rubocop:disable all
class AddAfterSignOutPathForApplicationSettings < ActiveRecord::Migration class AddAfterSignOutPathForApplicationSettings < ActiveRecord::Migration
def change def change
add_column :application_settings, :after_sign_out_path, :string add_column :application_settings, :after_sign_out_path, :string
......
# rubocop:disable all
class AddSessionExpireDelayForApplicationSettings < ActiveRecord::Migration class AddSessionExpireDelayForApplicationSettings < ActiveRecord::Migration
def change def change
unless column_exists?(:application_settings, :session_expire_delay) unless column_exists?(:application_settings, :session_expire_delay)
......
# rubocop:disable all
class AddDashboardToUsers < ActiveRecord::Migration class AddDashboardToUsers < ActiveRecord::Migration
def up def up
add_column :users, :dashboard, :integer, default: 0 add_column :users, :dashboard, :integer, default: 0
......
# rubocop:disable all
class AddDefaultOtpRequiredForLoginValue < ActiveRecord::Migration class AddDefaultOtpRequiredForLoginValue < ActiveRecord::Migration
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
class AddProjectViewToUsers < ActiveRecord::Migration class AddProjectViewToUsers < ActiveRecord::Migration
def change def change
add_column :users, :project_view, :integer, default: 0 add_column :users, :project_view, :integer, default: 0
......
# rubocop:disable all
class AddCommitsCountToProject < ActiveRecord::Migration class AddCommitsCountToProject < ActiveRecord::Migration
def change def change
add_column :projects, :commit_count, :integer, default: 0 add_column :projects, :commit_count, :integer, default: 0
......
# rubocop:disable all
class AddUpdatedByToIssuablesAndNotes < ActiveRecord::Migration class AddUpdatedByToIssuablesAndNotes < ActiveRecord::Migration
def change def change
add_column :notes, :updated_by_id, :integer add_column :notes, :updated_by_id, :integer
......
# rubocop:disable all
class CreateAbuseReports < ActiveRecord::Migration class CreateAbuseReports < ActiveRecord::Migration
def change def change
create_table :abuse_reports do |t| create_table :abuse_reports do |t|
......
# rubocop:disable all
require 'yaml' require 'yaml'
class AddSettingsImportSources < ActiveRecord::Migration class AddSettingsImportSources < ActiveRecord::Migration
......
# rubocop:disable all
class RemoveOauthTokensFromUsers < ActiveRecord::Migration class RemoveOauthTokensFromUsers < ActiveRecord::Migration
def change def change
remove_column :users, :github_access_token, :string remove_column :users, :github_access_token, :string
......
# rubocop:disable all
class DeduplicateUserIdentities < ActiveRecord::Migration class DeduplicateUserIdentities < ActiveRecord::Migration
def change def change
execute 'DROP TABLE IF EXISTS tt_migration_DeduplicateUserIdentities;' execute 'DROP TABLE IF EXISTS tt_migration_DeduplicateUserIdentities;'
......
# rubocop:disable all
class AddSentNotifications < ActiveRecord::Migration class AddSentNotifications < ActiveRecord::Migration
def change def change
create_table :sent_notifications do |t| create_table :sent_notifications do |t|
......
# rubocop:disable all
class AddEnableSslVerification < ActiveRecord::Migration class AddEnableSslVerification < ActiveRecord::Migration
def change def change
add_column :web_hooks, :enable_ssl_verification, :boolean, default: false add_column :web_hooks, :enable_ssl_verification, :boolean, default: false
......
# rubocop:disable all
class AddCiTables < ActiveRecord::Migration class AddCiTables < ActiveRecord::Migration
def change def change
create_table "ci_application_settings", force: true do |t| create_table "ci_application_settings", force: true do |t|
......
# rubocop:disable all
class AddTemplateToLabel < ActiveRecord::Migration class AddTemplateToLabel < ActiveRecord::Migration
def change def change
add_column :labels, :template, :boolean, default: false add_column :labels, :template, :boolean, default: false
......
# rubocop:disable all
class AddCiTags < ActiveRecord::Migration class AddCiTags < ActiveRecord::Migration
def change def change
create_table "ci_taggings", force: true do |t| create_table "ci_taggings", force: true do |t|
......
# rubocop:disable all
class EnableSslVerificationByDefault < ActiveRecord::Migration class EnableSslVerificationByDefault < ActiveRecord::Migration
def change def change
change_column :web_hooks, :enable_ssl_verification, :boolean, default: true change_column :web_hooks, :enable_ssl_verification, :boolean, default: true
......
# rubocop:disable all
class EnableSslVerificationForWebHooks < ActiveRecord::Migration class EnableSslVerificationForWebHooks < ActiveRecord::Migration
def up def up
execute("UPDATE web_hooks SET enable_ssl_verification = true") execute("UPDATE web_hooks SET enable_ssl_verification = true")
......
# rubocop:disable all
class AddHelpPageTextToApplicationSettings < ActiveRecord::Migration class AddHelpPageTextToApplicationSettings < ActiveRecord::Migration
def change def change
add_column :application_settings, :help_page_text, :text add_column :application_settings, :help_page_text, :text
......
# rubocop:disable all
class AddIndexForCommittedAtAndId < ActiveRecord::Migration class AddIndexForCommittedAtAndId < ActiveRecord::Migration
def change def change
add_index :ci_commits, [:project_id, :committed_at, :id] add_index :ci_commits, [:project_id, :committed_at, :id]
......
# rubocop:disable all
class AddCiEnabledToApplicationSettings < ActiveRecord::Migration class AddCiEnabledToApplicationSettings < ActiveRecord::Migration
def change def change
add_column :application_settings, :ci_enabled, :boolean, null: false, default: true add_column :application_settings, :ci_enabled, :boolean, null: false, default: true
......
# rubocop:disable all
class RemoveInvalidMilestonesFromMergeRequests < ActiveRecord::Migration class RemoveInvalidMilestonesFromMergeRequests < ActiveRecord::Migration
def up def up
execute("UPDATE merge_requests SET milestone_id = NULL where milestone_id NOT IN (SELECT id FROM milestones)") execute("UPDATE merge_requests SET milestone_id = NULL where milestone_id NOT IN (SELECT id FROM milestones)")
......
# rubocop:disable all
class AddConsumedTimestepToUsers < ActiveRecord::Migration class AddConsumedTimestepToUsers < ActiveRecord::Migration
def change def change
add_column :users, :consumed_timestep, :integer add_column :users, :consumed_timestep, :integer
......
# rubocop:disable all
class AddLineCodeToSentNotification < ActiveRecord::Migration class AddLineCodeToSentNotification < ActiveRecord::Migration
def change def change
add_column :sent_notifications, :line_code, :string add_column :sent_notifications, :line_code, :string
......
# rubocop:disable all
class AddProjectIdToCiCommit < ActiveRecord::Migration class AddProjectIdToCiCommit < ActiveRecord::Migration
def up def up
add_column :ci_commits, :gl_project_id, :integer add_column :ci_commits, :gl_project_id, :integer
......
# rubocop:disable all
class MigrateProjectIdForCiCommits < ActiveRecord::Migration class MigrateProjectIdForCiCommits < ActiveRecord::Migration
def up def up
subquery = 'SELECT gitlab_id FROM ci_projects WHERE ci_projects.id = ci_commits.project_id' subquery = 'SELECT gitlab_id FROM ci_projects WHERE ci_projects.id = ci_commits.project_id'
......
# rubocop:disable all
class MergeRequestErrorField < ActiveRecord::Migration class MergeRequestErrorField < ActiveRecord::Migration
def up def up
add_column :merge_requests, :merge_error, :string add_column :merge_requests, :merge_error, :string
......
# rubocop:disable all
class AddNullToNameForCiProjects < ActiveRecord::Migration class AddNullToNameForCiProjects < ActiveRecord::Migration
def up def up
change_column_null :ci_projects, :name, true change_column_null :ci_projects, :name, true
......
# rubocop:disable all
class AddGroupShareLock < ActiveRecord::Migration class AddGroupShareLock < ActiveRecord::Migration
def change def change
add_column :namespaces, :share_with_group_lock, :boolean, default: false add_column :namespaces, :share_with_group_lock, :boolean, default: false
......
# rubocop:disable all
class AddStageIdxToBuilds < ActiveRecord::Migration class AddStageIdxToBuilds < ActiveRecord::Migration
def change def change
add_column :ci_builds, :stage_idx, :integer add_column :ci_builds, :stage_idx, :integer
......
# rubocop:disable all
class AddIndexForBuilds < ActiveRecord::Migration class AddIndexForBuilds < ActiveRecord::Migration
def up def up
add_index :ci_builds, [:commit_id, :stage_idx, :created_at] add_index :ci_builds, [:commit_id, :stage_idx, :created_at]
......
# rubocop:disable all
class AddRefAndTagToBuilds < ActiveRecord::Migration class AddRefAndTagToBuilds < ActiveRecord::Migration
def change def change
add_column :ci_builds, :tag, :boolean add_column :ci_builds, :tag, :boolean
......
# rubocop:disable all
class MigrateRefAndTagToBuild < ActiveRecord::Migration class MigrateRefAndTagToBuild < ActiveRecord::Migration
def change def change
execute('UPDATE ci_builds SET ref=(SELECT ref FROM ci_commits WHERE ci_commits.id = ci_builds.commit_id) WHERE ref IS NULL') execute('UPDATE ci_builds SET ref=(SELECT ref FROM ci_commits WHERE ci_commits.id = ci_builds.commit_id) WHERE ref IS NULL')
......
# rubocop:disable all
class AddUserIdToBuild < ActiveRecord::Migration class AddUserIdToBuild < ActiveRecord::Migration
def change def change
add_column :ci_builds, :user_id, :integer add_column :ci_builds, :user_id, :integer
......
# rubocop:disable all
class AddLayoutOptionForUsers < ActiveRecord::Migration class AddLayoutOptionForUsers < ActiveRecord::Migration
def change def change
add_column :users, :layout, :integer, default: 0 add_column :users, :layout, :integer, default: 0
......
# rubocop:disable all
class RemoveCiEnabledFromApplicationSettings < ActiveRecord::Migration class RemoveCiEnabledFromApplicationSettings < ActiveRecord::Migration
def change def change
remove_column :application_settings, :ci_enabled, :boolean, null: false, default: true remove_column :application_settings, :ci_enabled, :boolean, null: false, default: true
......
# rubocop:disable all
class NamespacesProjectsPathLowerIndexes < ActiveRecord::Migration class NamespacesProjectsPathLowerIndexes < ActiveRecord::Migration
disable_ddl_transaction! disable_ddl_transaction!
......
# rubocop:disable all
class AddUsersLowerUsernameEmailIndexes < ActiveRecord::Migration class AddUsersLowerUsernameEmailIndexes < ActiveRecord::Migration
disable_ddl_transaction! disable_ddl_transaction!
......
# rubocop:disable all
class AddTypeAndDescriptionToBuilds < ActiveRecord::Migration class AddTypeAndDescriptionToBuilds < ActiveRecord::Migration
def change def change
add_column :ci_builds, :type, :string add_column :ci_builds, :type, :string
......
# rubocop:disable all
class MigrateNameToDescriptionForBuilds < ActiveRecord::Migration class MigrateNameToDescriptionForBuilds < ActiveRecord::Migration
def change def change
execute("UPDATE ci_builds SET type='Ci::Build' WHERE type IS NULL") execute("UPDATE ci_builds SET type='Ci::Build' WHERE type IS NULL")
......
# rubocop:disable all
class AddAdminNotificationEmailSetting < ActiveRecord::Migration class AddAdminNotificationEmailSetting < ActiveRecord::Migration
def change def change
add_column :application_settings, :admin_notification_email, :string add_column :application_settings, :admin_notification_email, :string
......
# rubocop:disable all
class SetJiraServiceApiUrl < ActiveRecord::Migration class SetJiraServiceApiUrl < ActiveRecord::Migration
# This migration can be performed online without errors, but some Jira API calls may be missed # This migration can be performed online without errors, but some Jira API calls may be missed
# when doing so because api_url is not yet available. # when doing so because api_url is not yet available.
......
# rubocop:disable all
class AddArtifactsFileToBuilds < ActiveRecord::Migration class AddArtifactsFileToBuilds < ActiveRecord::Migration
def change def change
add_column :ci_builds, :artifacts_file, :text add_column :ci_builds, :artifacts_file, :text
......
# rubocop:disable all
class AddCiProjectsGlProjectIdIndex < ActiveRecord::Migration class AddCiProjectsGlProjectIdIndex < ActiveRecord::Migration
def change def change
add_index :ci_commits, :gl_project_id add_index :ci_commits, :gl_project_id
......
# rubocop:disable all
class AddCiBuildsAndProjectsIndexes < ActiveRecord::Migration class AddCiBuildsAndProjectsIndexes < ActiveRecord::Migration
def change def change
add_index :ci_projects, :gitlab_id add_index :ci_projects, :gitlab_id
......
# rubocop:disable all
class AddNotesLineCodeIndex < ActiveRecord::Migration class AddNotesLineCodeIndex < ActiveRecord::Migration
def change def change
add_index :notes, :line_code add_index :notes, :line_code
......
# rubocop:disable all
class FixBuildTags < ActiveRecord::Migration class FixBuildTags < ActiveRecord::Migration
def up def up
execute("UPDATE taggings SET taggable_type='CommitStatus' WHERE taggable_type='Ci::Build'") execute("UPDATE taggings SET taggable_type='CommitStatus' WHERE taggable_type='Ci::Build'")
......
# rubocop:disable all
class FailBuildWithoutNames < ActiveRecord::Migration class FailBuildWithoutNames < ActiveRecord::Migration
def up def up
execute("UPDATE ci_builds SET status='failed' WHERE name IS NULL AND status='pending'") execute("UPDATE ci_builds SET status='failed' WHERE name IS NULL AND status='pending'")
......
# rubocop:disable all
class AddServicesTemplateIndex < ActiveRecord::Migration class AddServicesTemplateIndex < ActiveRecord::Migration
def change def change
add_index :services, :template add_index :services, :template
......
# rubocop:disable all
class CiLimitsToMysql < ActiveRecord::Migration class CiLimitsToMysql < ActiveRecord::Migration
def change def change
return unless ActiveRecord::Base.configurations[Rails.env]['adapter'] =~ /^mysql/ return unless ActiveRecord::Base.configurations[Rails.env]['adapter'] =~ /^mysql/
......
# rubocop:disable all
class AddCiBuildsIndexForStatus < ActiveRecord::Migration class AddCiBuildsIndexForStatus < ActiveRecord::Migration
def change def change
add_index :ci_builds, [:commit_id, :status, :type] add_index :ci_builds, [:commit_id, :status, :type]
......
# rubocop:disable all
class FailBuildWithEmptyName < ActiveRecord::Migration class FailBuildWithEmptyName < ActiveRecord::Migration
def up def up
execute("UPDATE ci_builds SET status='failed' WHERE (name IS NULL OR name='') AND status='pending'") execute("UPDATE ci_builds SET status='failed' WHERE (name IS NULL OR name='') AND status='pending'")
......
# rubocop:disable all
require 'fileutils' require 'fileutils'
class RemoveSatellites < ActiveRecord::Migration class RemoveSatellites < ActiveRecord::Migration
......
# rubocop:disable all
class AddProjectPathIndex < ActiveRecord::Migration class AddProjectPathIndex < ActiveRecord::Migration
def up def up
add_index :projects, :path add_index :projects, :path
......
# rubocop:disable all
class AddMergeWhenBuildSucceedsToMergeRequest < ActiveRecord::Migration class AddMergeWhenBuildSucceedsToMergeRequest < ActiveRecord::Migration
def change def change
add_column :merge_requests, :merge_params, :text add_column :merge_requests, :merge_params, :text
......
# rubocop:disable all
class AddPublicToGroup < ActiveRecord::Migration class AddPublicToGroup < ActiveRecord::Migration
def change def change
add_column :namespaces, :public, :boolean, default: false add_column :namespaces, :public, :boolean, default: false
......
# rubocop:disable all
class AddSharedRunnersSetting < ActiveRecord::Migration class AddSharedRunnersSetting < ActiveRecord::Migration
def up def up
add_column :application_settings, :shared_runners_enabled, :boolean, default: true, null: false add_column :application_settings, :shared_runners_enabled, :boolean, default: true, null: false
......
# rubocop:disable all
class CreateLfsObjects < ActiveRecord::Migration class CreateLfsObjects < ActiveRecord::Migration
def change def change
create_table :lfs_objects do |t| create_table :lfs_objects do |t|
......
# rubocop:disable all
class CreateLfsObjectsProjects < ActiveRecord::Migration class CreateLfsObjectsProjects < ActiveRecord::Migration
def change def change
create_table :lfs_objects_projects do |t| create_table :lfs_objects_projects do |t|
......
# rubocop:disable all
class AddFileToLfsObjects < ActiveRecord::Migration class AddFileToLfsObjects < ActiveRecord::Migration
def change def change
add_column :lfs_objects, :file, :string add_column :lfs_objects, :file, :string
......
# rubocop:disable all
class CreateReleases < ActiveRecord::Migration class CreateReleases < ActiveRecord::Migration
def change def change
create_table :releases do |t| create_table :releases do |t|
......
# rubocop:disable all
class AddIsAwardToNotes < ActiveRecord::Migration class AddIsAwardToNotes < ActiveRecord::Migration
def change def change
add_column :notes, :is_award, :boolean, default: false, null: false add_column :notes, :is_award, :boolean, default: false, null: false
......
# rubocop:disable all
class AddMaxArtifactsSizeToApplicationSettings < ActiveRecord::Migration class AddMaxArtifactsSizeToApplicationSettings < ActiveRecord::Migration
def change def change
add_column :application_settings, :max_artifacts_size, :integer, default: 100, null: false add_column :application_settings, :max_artifacts_size, :integer, default: 100, null: false
......
# rubocop:disable all
class AddIssuesStateIndex < ActiveRecord::Migration class AddIssuesStateIndex < ActiveRecord::Migration
def change def change
add_index :issues, :state add_index :issues, :state
......
# rubocop:disable all
class AddProjectsVisibilityLevelIndex < ActiveRecord::Migration class AddProjectsVisibilityLevelIndex < ActiveRecord::Migration
def change def change
add_index :projects, :visibility_level add_index :projects, :visibility_level
......
# rubocop:disable all
class AddImportErrorToProject < ActiveRecord::Migration class AddImportErrorToProject < ActiveRecord::Migration
def change def change
add_column :projects, :import_error, :text add_column :projects, :import_error, :text
......
# rubocop:disable all
class AddIndexForLfsOidAndSize < ActiveRecord::Migration class AddIndexForLfsOidAndSize < ActiveRecord::Migration
def change def change
add_index :lfs_objects, :oid add_index :lfs_objects, :oid
......
# rubocop:disable all
class AddUniqueForLfsOidIndex < ActiveRecord::Migration class AddUniqueForLfsOidIndex < ActiveRecord::Migration
def change def change
remove_index :lfs_objects, :oid remove_index :lfs_objects, :oid
......
# rubocop:disable all
class AddProjectsPublicIndex < ActiveRecord::Migration class AddProjectsPublicIndex < ActiveRecord::Migration
def change def change
add_index :namespaces, :public add_index :namespaces, :public
......
# rubocop:disable all
class RaiseHookUrlLimit < ActiveRecord::Migration class RaiseHookUrlLimit < ActiveRecord::Migration
def change def change
change_column :web_hooks, :url, :string, limit: 2000 change_column :web_hooks, :url, :string, limit: 2000
......
# rubocop:disable all
class AddHideProjectLimitToUsers < ActiveRecord::Migration class AddHideProjectLimitToUsers < ActiveRecord::Migration
def change def change
add_column :users, :hide_project_limit, :boolean, default: false add_column :users, :hide_project_limit, :boolean, default: false
......
# rubocop:disable all
class AddBuildEventsToServices < ActiveRecord::Migration class AddBuildEventsToServices < ActiveRecord::Migration
def change def change
add_column :services, :build_events, :boolean, default: false, null: false add_column :services, :build_events, :boolean, default: false, null: false
......
# rubocop:disable all
class MigrateCiWebHooks < ActiveRecord::Migration class MigrateCiWebHooks < ActiveRecord::Migration
include Gitlab::Database include Gitlab::Database
......
# rubocop:disable all
class MigrateCiEmails < ActiveRecord::Migration class MigrateCiEmails < ActiveRecord::Migration
include Gitlab::Database include Gitlab::Database
......
# rubocop:disable all
class AddUnlockTokenToUser < ActiveRecord::Migration class AddUnlockTokenToUser < ActiveRecord::Migration
def change def change
add_column :users, :unlock_token, :string add_column :users, :unlock_token, :string
......
# rubocop:disable all
class AddRunnersRegistrationTokenToApplicationSettings < ActiveRecord::Migration class AddRunnersRegistrationTokenToApplicationSettings < ActiveRecord::Migration
def change def change
add_column :application_settings, :runners_registration_token, :string add_column :application_settings, :runners_registration_token, :string
......
# rubocop:disable all
class MigrateCiSlackService < ActiveRecord::Migration class MigrateCiSlackService < ActiveRecord::Migration
include Gitlab::Database include Gitlab::Database
......
# rubocop:disable all
class MigrateCiHipChatService < ActiveRecord::Migration class MigrateCiHipChatService < ActiveRecord::Migration
include Gitlab::Database include Gitlab::Database
......
# rubocop:disable all
class AddCiToProject < ActiveRecord::Migration class AddCiToProject < ActiveRecord::Migration
def change def change
add_column :projects, :ci_id, :integer add_column :projects, :ci_id, :integer
......
# rubocop:disable all
class AddProjectIdToCi < ActiveRecord::Migration class AddProjectIdToCi < ActiveRecord::Migration
def change def change
add_column :ci_builds, :gl_project_id, :integer add_column :ci_builds, :gl_project_id, :integer
......
# rubocop:disable all
class MigrateCiToProject < ActiveRecord::Migration class MigrateCiToProject < ActiveRecord::Migration
def up def up
migrate_project_id_for_table('ci_runner_projects') migrate_project_id_for_table('ci_runner_projects')
......
# rubocop:disable all
class AddIndexToCiTables < ActiveRecord::Migration class AddIndexToCiTables < ActiveRecord::Migration
def change def change
add_index :ci_builds, :gl_project_id add_index :ci_builds, :gl_project_id
......
# rubocop:disable all
class DropNullForCiTables < ActiveRecord::Migration class DropNullForCiTables < ActiveRecord::Migration
def change def change
remove_index :ci_variables, :project_id remove_index :ci_variables, :project_id
......
# rubocop:disable all
class AddTfaToApplicationSettings < ActiveRecord::Migration class AddTfaToApplicationSettings < ActiveRecord::Migration
def change def change
change_table :application_settings do |t| change_table :application_settings do |t|
......
# rubocop:disable all
class AddTfaAdditionalFields < ActiveRecord::Migration class AddTfaAdditionalFields < ActiveRecord::Migration
def change def change
change_table :users do |t| change_table :users do |t|
......
# rubocop:disable all
# Migration type: online without errors (works on previous version and new one) # Migration type: online without errors (works on previous version and new one)
class RenameEmojis < ActiveRecord::Migration class RenameEmojis < ActiveRecord::Migration
def up def up
......
# rubocop:disable all
# Migration type: online # Migration type: online
class RemovePublicFromNamespace < ActiveRecord::Migration class RemovePublicFromNamespace < ActiveRecord::Migration
def change def change
......
# rubocop:disable all
class InfluxdbSettings < ActiveRecord::Migration class InfluxdbSettings < ActiveRecord::Migration
def change def change
add_column :application_settings, :metrics_enabled, :boolean, default: false add_column :application_settings, :metrics_enabled, :boolean, default: false
......
# rubocop:disable all
class AddRecaptchaToApplicationSettings < ActiveRecord::Migration class AddRecaptchaToApplicationSettings < ActiveRecord::Migration
def change def change
change_table :application_settings do |t| change_table :application_settings do |t|
......
# rubocop:disable all
class InfluxdbUdpPortSetting < ActiveRecord::Migration class InfluxdbUdpPortSetting < ActiveRecord::Migration
def change def change
add_column :application_settings, :metrics_port, :integer, default: 8089 add_column :application_settings, :metrics_port, :integer, default: 8089
......
# rubocop:disable all
class InfluxdbRemoteDatabaseSetting < ActiveRecord::Migration class InfluxdbRemoteDatabaseSetting < ActiveRecord::Migration
def change def change
remove_column :application_settings, :metrics_database remove_column :application_settings, :metrics_database
......
# rubocop:disable all
class AddArtifactsMetadataToCiBuild < ActiveRecord::Migration class AddArtifactsMetadataToCiBuild < ActiveRecord::Migration
def change def change
add_column :ci_builds, :artifacts_metadata, :text add_column :ci_builds, :artifacts_metadata, :text
......
# rubocop:disable all
class AddAkismetToApplicationSettings < ActiveRecord::Migration class AddAkismetToApplicationSettings < ActiveRecord::Migration
def change def change
change_table :application_settings do |t| change_table :application_settings do |t|
......
# rubocop:disable all
class RemoveAlertTypeFromBroadcastMessages < ActiveRecord::Migration class RemoveAlertTypeFromBroadcastMessages < ActiveRecord::Migration
def change def change
remove_column :broadcast_messages, :alert_type, :integer remove_column :broadcast_messages, :alert_type, :integer
......
# rubocop:disable all
class AddIndexMilestonesTitle < ActiveRecord::Migration class AddIndexMilestonesTitle < ActiveRecord::Migration
def change def change
add_index :milestones, :title add_index :milestones, :title
......
# rubocop:disable all
class RemoveInfluxdbCredentials < ActiveRecord::Migration class RemoveInfluxdbCredentials < ActiveRecord::Migration
def change def change
remove_column :application_settings, :metrics_username, :string remove_column :application_settings, :metrics_username, :string
......
# rubocop:disable all
class CreateSpamLogs < ActiveRecord::Migration class CreateSpamLogs < ActiveRecord::Migration
def change def change
create_table :spam_logs do |t| create_table :spam_logs do |t|
......
# rubocop:disable all
class AddMetricsSampleInterval < ActiveRecord::Migration class AddMetricsSampleInterval < ActiveRecord::Migration
def change def change
add_column :application_settings, :metrics_sample_interval, :integer, add_column :application_settings, :metrics_sample_interval, :integer,
......
# rubocop:disable all
class AddSentryToApplicationSettings < ActiveRecord::Migration class AddSentryToApplicationSettings < ActiveRecord::Migration
def change def change
change_table :application_settings do |t| change_table :application_settings do |t|
......
# rubocop:disable all
class AddIpBlockingSettingsToApplicationSettings < ActiveRecord::Migration class AddIpBlockingSettingsToApplicationSettings < ActiveRecord::Migration
def change def change
add_column :application_settings, :ip_blocking_enabled, :boolean, default: false add_column :application_settings, :ip_blocking_enabled, :boolean, default: false
......
# rubocop:disable all
class AddServicesCategory < ActiveRecord::Migration class AddServicesCategory < ActiveRecord::Migration
def up def up
add_column :services, :category, :string, default: 'common', null: false add_column :services, :category, :string, default: 'common', null: false
......
# rubocop:disable all
class AddServicesDefault < ActiveRecord::Migration class AddServicesDefault < ActiveRecord::Migration
def up def up
add_column :services, :default, :boolean, default: false add_column :services, :default, :boolean, default: false
......
# rubocop:disable all
class AddLdapEmailToUsers < ActiveRecord::Migration class AddLdapEmailToUsers < ActiveRecord::Migration
def up def up
add_column :users, :ldap_email, :boolean, default: false, null: false add_column :users, :ldap_email, :boolean, default: false, null: false
......
# rubocop:disable all
class AddBaseCommitShaToMergeRequestDiffs < ActiveRecord::Migration class AddBaseCommitShaToMergeRequestDiffs < ActiveRecord::Migration
def change def change
add_column :merge_request_diffs, :base_commit_sha, :string add_column :merge_request_diffs, :base_commit_sha, :string
......
# rubocop:disable all
class AddEmailAuthorInBodyToApplicationSettings < ActiveRecord::Migration class AddEmailAuthorInBodyToApplicationSettings < ActiveRecord::Migration
def change def change
add_column :application_settings, :email_author_in_body, :boolean, default: false add_column :application_settings, :email_author_in_body, :boolean, default: false
......
# rubocop:disable all
class AddPendingDeleteToProject < ActiveRecord::Migration class AddPendingDeleteToProject < ActiveRecord::Migration
def change def change
add_column :projects, :pending_delete, :boolean, default: false add_column :projects, :pending_delete, :boolean, default: false
......
# rubocop:disable all
class RemoveIpBlockingSettingsFromApplicationSettings < ActiveRecord::Migration class RemoveIpBlockingSettingsFromApplicationSettings < ActiveRecord::Migration
def change def change
remove_column :application_settings, :ip_blocking_enabled, :boolean, default: false remove_column :application_settings, :ip_blocking_enabled, :boolean, default: false
......
# rubocop:disable all
class ChangeLfsObjectsSizeColumn < ActiveRecord::Migration class ChangeLfsObjectsSizeColumn < ActiveRecord::Migration
def change def change
change_column :lfs_objects, :size, :integer, limit: 8 change_column :lfs_objects, :size, :integer, limit: 8
......
# rubocop:disable all
class RemoveDotAtomPathEndingOfProjects < ActiveRecord::Migration class RemoveDotAtomPathEndingOfProjects < ActiveRecord::Migration
include Gitlab::ShellAdapter include Gitlab::ShellAdapter
......
# rubocop:disable all
class AddMergeCommitShaToMergeRequests < ActiveRecord::Migration class AddMergeCommitShaToMergeRequests < ActiveRecord::Migration
def change def change
add_column :merge_requests, :merge_commit_sha, :string add_column :merge_requests, :merge_commit_sha, :string
......
# rubocop:disable all
class AddErasableToCiBuild < ActiveRecord::Migration class AddErasableToCiBuild < ActiveRecord::Migration
def change def change
add_reference :ci_builds, :erased_by, references: :users, index: true add_reference :ci_builds, :erased_by, references: :users, index: true
......
# rubocop:disable all
class AddAllowGuestToAccessBuildsProject < ActiveRecord::Migration class AddAllowGuestToAccessBuildsProject < ActiveRecord::Migration
def change def change
add_column :projects, :public_builds, :boolean, default: true, null: false add_column :projects, :public_builds, :boolean, default: true, null: false
......
# rubocop:disable all
class AddRealSizeToMergeRequestDiffs < ActiveRecord::Migration class AddRealSizeToMergeRequestDiffs < ActiveRecord::Migration
def change def change
add_column :merge_request_diffs, :real_size, :string add_column :merge_request_diffs, :real_size, :string
......
# rubocop:disable all
class AddIndexToSnippet < ActiveRecord::Migration class AddIndexToSnippet < ActiveRecord::Migration
def change def change
add_index :snippets, :updated_at add_index :snippets, :updated_at
......
# rubocop:disable all
class CreateTasks < ActiveRecord::Migration class CreateTasks < ActiveRecord::Migration
def change def change
create_table :tasks do |t| create_table :tasks do |t|
......
# rubocop:disable all
class AddDescriptionToLabel < ActiveRecord::Migration class AddDescriptionToLabel < ActiveRecord::Migration
def change def change
add_column :labels, :description, :string add_column :labels, :description, :string
......
# rubocop:disable all
class AddNoteToTasks < ActiveRecord::Migration class AddNoteToTasks < ActiveRecord::Migration
def change def change
add_reference :tasks, :note, index: true add_reference :tasks, :note, index: true
......
# rubocop:disable all
class RenameTasksToTodos < ActiveRecord::Migration class RenameTasksToTodos < ActiveRecord::Migration
def change def change
rename_table :tasks, :todos rename_table :tasks, :todos
......
# rubocop:disable all
class CreateAppearancesCe < ActiveRecord::Migration class CreateAppearancesCe < ActiveRecord::Migration
def change def change
unless table_exists?(:appearances) unless table_exists?(:appearances)
......
# rubocop:disable all
class AddConfidentialToIssues < ActiveRecord::Migration class AddConfidentialToIssues < ActiveRecord::Migration
def change def change
add_column :issues, :confidential, :boolean, default: false add_column :issues, :confidential, :boolean, default: false
......
# rubocop:disable all
class AddDeleteAtToIssues < ActiveRecord::Migration class AddDeleteAtToIssues < ActiveRecord::Migration
def change def change
add_column :issues, :deleted_at, :datetime add_column :issues, :deleted_at, :datetime
......
# rubocop:disable all
class AddDeleteAtToMergeRequests < ActiveRecord::Migration class AddDeleteAtToMergeRequests < ActiveRecord::Migration
def change def change
add_column :merge_requests, :deleted_at, :datetime add_column :merge_requests, :deleted_at, :datetime
......
# rubocop:disable all
class AddTrigramIndexesForSearching < ActiveRecord::Migration class AddTrigramIndexesForSearching < ActiveRecord::Migration
disable_ddl_transaction! disable_ddl_transaction!
......
# rubocop:disable all
class AddEventFieldForWebHook < ActiveRecord::Migration class AddEventFieldForWebHook < ActiveRecord::Migration
def change def change
add_column :web_hooks, :wiki_page_events, :boolean, default: false, null: false add_column :web_hooks, :wiki_page_events, :boolean, default: false, null: false
......
# rubocop:disable all
class AddEventToServices < ActiveRecord::Migration class AddEventToServices < ActiveRecord::Migration
def change def change
add_column :services, :wiki_page_events, :boolean, default: true add_column :services, :wiki_page_events, :boolean, default: true
......
# rubocop:disable all
class AddMainLanguageToRepository < ActiveRecord::Migration class AddMainLanguageToRepository < ActiveRecord::Migration
def change def change
add_column :projects, :main_language, :string add_column :projects, :main_language, :string
......
# rubocop:disable all
class AddVisibilityLevelToGroups < ActiveRecord::Migration class AddVisibilityLevelToGroups < ActiveRecord::Migration
def up def up
add_column :namespaces, :visibility_level, :integer, null: false, default: Gitlab::VisibilityLevel::PUBLIC add_column :namespaces, :visibility_level, :integer, null: false, default: Gitlab::VisibilityLevel::PUBLIC
......
# rubocop:disable all
class AddImportCredentialsToProjectImportData < ActiveRecord::Migration class AddImportCredentialsToProjectImportData < ActiveRecord::Migration
def change def change
add_column :project_import_data, :encrypted_credentials, :text add_column :project_import_data, :encrypted_credentials, :text
......
# rubocop:disable all
# Loops through old importer projects that kept a token/password in the import URL # Loops through old importer projects that kept a token/password in the import URL
# and encrypts the credentials into a separate field in project#import_data # and encrypts the credentials into a separate field in project#import_data
# #down method not supported # #down method not supported
......
# rubocop:disable all
class RemoveExpiresAtFromSnippets < ActiveRecord::Migration class RemoveExpiresAtFromSnippets < ActiveRecord::Migration
def change def change
remove_column :snippets, :expires_at, :datetime remove_column :snippets, :expires_at, :datetime
......
# rubocop:disable all
class DisallowBlankLineCodeOnNote < ActiveRecord::Migration class DisallowBlankLineCodeOnNote < ActiveRecord::Migration
def up def up
execute("UPDATE notes SET line_code = NULL WHERE line_code = ''") execute("UPDATE notes SET line_code = NULL WHERE line_code = ''")
......
# rubocop:disable all
# Create visibility level field on DB # Create visibility level field on DB
# Sets default_visibility_level to value on settings if not restricted # Sets default_visibility_level to value on settings if not restricted
# If value is restricted takes higher visibility level allowed # If value is restricted takes higher visibility level allowed
......
# rubocop:disable all
class FixTodos < ActiveRecord::Migration class FixTodos < ActiveRecord::Migration
def up def up
execute <<-SQL execute <<-SQL
......
# rubocop:disable all
class AddDueDateToIssues < ActiveRecord::Migration class AddDueDateToIssues < ActiveRecord::Migration
def change def change
add_column :issues, :due_date, :date add_column :issues, :due_date, :date
......
# rubocop:disable all
class AddExternalFlagToUsers < ActiveRecord::Migration class AddExternalFlagToUsers < ActiveRecord::Migration
def change def change
add_column :users, :external, :boolean, default: false add_column :users, :external, :boolean, default: false
......
# rubocop:disable all
class AddPriorityToLabel < ActiveRecord::Migration class AddPriorityToLabel < ActiveRecord::Migration
def change def change
add_column :labels, :priority, :integer add_column :labels, :priority, :integer
......
# rubocop:disable all
class ProjectsAddPushesSinceGc < ActiveRecord::Migration class ProjectsAddPushesSinceGc < ActiveRecord::Migration
def change def change
add_column :projects, :pushes_since_gc, :integer, default: 0 add_column :projects, :pushes_since_gc, :integer, default: 0
......
# rubocop:disable all
class ProjectAddRepositoryCheck < ActiveRecord::Migration class ProjectAddRepositoryCheck < ActiveRecord::Migration
def change def change
add_column :projects, :last_repository_check_failed, :boolean add_column :projects, :last_repository_check_failed, :boolean
......
# rubocop:disable all
class CiRunnersTokenIndex < ActiveRecord::Migration class CiRunnersTokenIndex < ActiveRecord::Migration
disable_ddl_transaction! disable_ddl_transaction!
......
# rubocop:disable all
class ChangeTargetIdToNullOnTodos < ActiveRecord::Migration class ChangeTargetIdToNullOnTodos < ActiveRecord::Migration
def change def change
change_column_null :todos, :target_id, true change_column_null :todos, :target_id, true
......
# rubocop:disable all
class AddCommitIdToTodos < ActiveRecord::Migration class AddCommitIdToTodos < ActiveRecord::Migration
def change def change
add_column :todos, :commit_id, :string add_column :todos, :commit_id, :string
......
# rubocop:disable all
class AddMovedToToIssue < ActiveRecord::Migration class AddMovedToToIssue < ActiveRecord::Migration
def change def change
add_reference :issues, :moved_to, references: :issues add_reference :issues, :moved_to, references: :issues
......
# rubocop:disable all
class IndexNamespacesOnVisibilityLevel < ActiveRecord::Migration class IndexNamespacesOnVisibilityLevel < ActiveRecord::Migration
def change def change
unless index_exists?(:namespaces, :visibility_level) unless index_exists?(:namespaces, :visibility_level)
......
# rubocop:disable all
class RemoveTodosForDeletedIssues < ActiveRecord::Migration class RemoveTodosForDeletedIssues < ActiveRecord::Migration
def up def up
execute <<-SQL execute <<-SQL
......
# rubocop:disable all
class CreateNotificationSettings < ActiveRecord::Migration class CreateNotificationSettings < ActiveRecord::Migration
def change def change
create_table :notification_settings do |t| create_table :notification_settings do |t|
......
# rubocop:disable all
# This migration will create one row of NotificationSetting for each Member row # This migration will create one row of NotificationSetting for each Member row
# It can take long time on big instances. # It can take long time on big instances.
# #
......
# rubocop:disable all
class AddNotificationSettingIndex < ActiveRecord::Migration class AddNotificationSettingIndex < ActiveRecord::Migration
def change def change
add_index :notification_settings, :user_id add_index :notification_settings, :user_id
......
# rubocop:disable all
class AddIndexOnPendingDeleteProjects < ActiveRecord::Migration class AddIndexOnPendingDeleteProjects < ActiveRecord::Migration
def change def change
add_index :projects, :pending_delete add_index :projects, :pending_delete
......
# rubocop:disable all
class RemoveTodosForDeletedMergeRequests < ActiveRecord::Migration class RemoveTodosForDeletedMergeRequests < ActiveRecord::Migration
def up def up
execute <<-SQL execute <<-SQL
......
# rubocop:disable all
class RemoveTwitterSharingEnabledFromApplicationSettings < ActiveRecord::Migration class RemoveTwitterSharingEnabledFromApplicationSettings < ActiveRecord::Migration
def change def change
remove_column :application_settings, :twitter_sharing_enabled, :boolean remove_column :application_settings, :twitter_sharing_enabled, :boolean
......
# rubocop:disable all
class AddImagesEnabledForProject < ActiveRecord::Migration class AddImagesEnabledForProject < ActiveRecord::Migration
def change def change
add_column :projects, :container_registry_enabled, :boolean add_column :projects, :container_registry_enabled, :boolean
......
# rubocop:disable all
class AddRepositoryChecksEnabledSetting < ActiveRecord::Migration class AddRepositoryChecksEnabledSetting < ActiveRecord::Migration
def change def change
add_column :application_settings, :repository_checks_enabled, :boolean, default: true add_column :application_settings, :repository_checks_enabled, :boolean, default: true
......
# rubocop:disable all
class AddFieldsToCiCommit < ActiveRecord::Migration class AddFieldsToCiCommit < ActiveRecord::Migration
def change def change
add_column :ci_commits, :status, :string add_column :ci_commits, :status, :string
......
# rubocop:disable all
class UpdateCiCommit < ActiveRecord::Migration class UpdateCiCommit < ActiveRecord::Migration
# This migration can be run online, but needs to be executed for the second time after restarting Unicorn workers # This migration can be run online, but needs to be executed for the second time after restarting Unicorn workers
# Otherwise Offline migration should be used. # Otherwise Offline migration should be used.
......
# rubocop:disable all
class AddCiCommitIndexes < ActiveRecord::Migration class AddCiCommitIndexes < ActiveRecord::Migration
disable_ddl_transaction! disable_ddl_transaction!
......
# rubocop:disable all
class AddTokenToWebHooks < ActiveRecord::Migration class AddTokenToWebHooks < ActiveRecord::Migration
def change def change
add_column :web_hooks, :token, :string add_column :web_hooks, :token, :string
......
# rubocop:disable all
class AddSharedRunnersTextToApplicationSettings < ActiveRecord::Migration class AddSharedRunnersTextToApplicationSettings < ActiveRecord::Migration
def change def change
add_column :application_settings, :shared_runners_text, :text add_column :application_settings, :shared_runners_text, :text
......
# rubocop:disable all
class AddAwardEmoji < ActiveRecord::Migration class AddAwardEmoji < ActiveRecord::Migration
def change def change
create_table :award_emoji do |t| create_table :award_emoji do |t|
......
# rubocop:disable all
class ConvertAwardNoteToEmojiAward < ActiveRecord::Migration class ConvertAwardNoteToEmojiAward < ActiveRecord::Migration
def change def change
def up def up
......
# rubocop:disable all
class RemoveNoteIsAward < ActiveRecord::Migration class RemoveNoteIsAward < ActiveRecord::Migration
def change def change
remove_column :notes, :is_award, :boolean remove_column :notes, :is_award, :boolean
......
# rubocop:disable all
class AddMetricsPacketSize < ActiveRecord::Migration class AddMetricsPacketSize < ActiveRecord::Migration
def change def change
add_column :application_settings, :metrics_packet_size, :integer, default: 1 add_column :application_settings, :metrics_packet_size, :integer, default: 1
......
# rubocop:disable all
class DisableRepositoryChecks < ActiveRecord::Migration class DisableRepositoryChecks < ActiveRecord::Migration
def up def up
change_column_default :application_settings, :repository_checks_enabled, false change_column_default :application_settings, :repository_checks_enabled, false
......
# rubocop:disable all
class CreateU2fRegistrations < ActiveRecord::Migration class CreateU2fRegistrations < ActiveRecord::Migration
def change def change
create_table :u2f_registrations do |t| create_table :u2f_registrations do |t|
......
# rubocop:disable all
class AddDisabledOauthSignInSourcesToApplicationSettings < ActiveRecord::Migration class AddDisabledOauthSignInSourcesToApplicationSettings < ActiveRecord::Migration
def change def change
add_column :application_settings, :disabled_oauth_sign_in_sources, :text add_column :application_settings, :disabled_oauth_sign_in_sources, :text
......
# rubocop:disable all
class AddRunUntaggedToCiRunner < ActiveRecord::Migration class AddRunUntaggedToCiRunner < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers include Gitlab::Database::MigrationHelpers
disable_ddl_transaction! disable_ddl_transaction!
......
# rubocop:disable all
class RemoveWallEnabledFromProjects < ActiveRecord::Migration class RemoveWallEnabledFromProjects < ActiveRecord::Migration
def change def change
remove_column :projects, :wall_enabled, :boolean, default: true, null: false remove_column :projects, :wall_enabled, :boolean, default: true, null: false
......
# rubocop:disable all
class AddTypeToNotes < ActiveRecord::Migration class AddTypeToNotes < ActiveRecord::Migration
def change def change
add_column :notes, :type, :string add_column :notes, :type, :string
......
# rubocop:disable all
class SetTypeOnLegacyDiffNotes < ActiveRecord::Migration class SetTypeOnLegacyDiffNotes < ActiveRecord::Migration
def change def change
execute "UPDATE notes SET type = 'LegacyDiffNote' WHERE line_code IS NOT NULL" execute "UPDATE notes SET type = 'LegacyDiffNote' WHERE line_code IS NOT NULL"
......
# rubocop:disable all
class AddHealthCheckAccessTokenToApplicationSettings < ActiveRecord::Migration class AddHealthCheckAccessTokenToApplicationSettings < ActiveRecord::Migration
def change def change
add_column :application_settings, :health_check_access_token, :string add_column :application_settings, :health_check_access_token, :string
......
# rubocop:disable all
class AddSendUserConfirmationEmailToApplicationSettings < ActiveRecord::Migration class AddSendUserConfirmationEmailToApplicationSettings < ActiveRecord::Migration
def up def up
add_column :application_settings, :send_user_confirmation_email, :boolean, default: false add_column :application_settings, :send_user_confirmation_email, :boolean, default: false
......
# rubocop:disable all
# See http://doc.gitlab.com/ce/development/migration_style_guide.html # See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab. # for more information on how to write migrations for GitLab.
......
# rubocop:disable all
class RemoveNotificationSettingsForDeletedProjects < ActiveRecord::Migration class RemoveNotificationSettingsForDeletedProjects < ActiveRecord::Migration
def up def up
execute <<-SQL execute <<-SQL
......
# rubocop:disable all
class AddUsersStateIndex < ActiveRecord::Migration class AddUsersStateIndex < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers include Gitlab::Database::MigrationHelpers
......
# rubocop:disable all
# This is ONLINE migration # This is ONLINE migration
class AddContainerRegistryTokenExpireDelayToApplicationSettings < ActiveRecord::Migration class AddContainerRegistryTokenExpireDelayToApplicationSettings < ActiveRecord::Migration
......
# rubocop:disable all
class RemoveDuplicatedNotificationSettings < ActiveRecord::Migration class RemoveDuplicatedNotificationSettings < ActiveRecord::Migration
def up def up
duplicates = exec_query(%Q{ duplicates = exec_query(%Q{
......
# rubocop:disable all
class AddIndexToNotificationSettings < ActiveRecord::Migration class AddIndexToNotificationSettings < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers include Gitlab::Database::MigrationHelpers
......
# rubocop:disable all
class AddAfterSignUpTextToApplicationSettings < ActiveRecord::Migration class AddAfterSignUpTextToApplicationSettings < ActiveRecord::Migration
def change def change
add_column :application_settings, :after_sign_up_text, :text add_column :application_settings, :after_sign_up_text, :text
......
# rubocop:disable all
class LimitsToMysql < ActiveRecord::Migration class LimitsToMysql < ActiveRecord::Migration
def up def up
return unless ActiveRecord::Base.configurations[Rails.env]['adapter'] =~ /^mysql/ return unless ActiveRecord::Base.configurations[Rails.env]['adapter'] =~ /^mysql/
......
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