Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
0a5b670a
Commit
0a5b670a
authored
Feb 22, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Exclude migrations from Style/MutableConstant
parent
32a70410
Changes
35
Hide whitespace changes
Inline
Side-by-side
Showing
35 changed files
with
47 additions
and
44 deletions
+47
-44
.rubocop.yml
.rubocop.yml
+3
-0
db/migrate/20160705055254_move_from_developers_can_merge_to_protected_branches_merge_access.rb
...evelopers_can_merge_to_protected_branches_merge_access.rb
+1
-1
db/migrate/20160705055308_move_from_developers_can_push_to_protected_branches_push_access.rb
..._developers_can_push_to_protected_branches_push_access.rb
+1
-1
db/migrate/20160729173930_remove_project_id_from_spam_logs.rb
...igrate/20160729173930_remove_project_id_from_spam_logs.rb
+1
-1
db/migrate/20160823081327_change_merge_error_to_text.rb
db/migrate/20160823081327_change_merge_error_to_text.rb
+1
-1
db/migrate/20160824124900_add_table_issue_metrics.rb
db/migrate/20160824124900_add_table_issue_metrics.rb
+1
-1
db/migrate/20160825052008_add_table_merge_request_metrics.rb
db/migrate/20160825052008_add_table_merge_request_metrics.rb
+1
-1
db/migrate/20160831223750_remove_features_enabled_from_projects.rb
...e/20160831223750_remove_features_enabled_from_projects.rb
+1
-1
db/migrate/20160913162434_remove_projects_pushes_since_gc.rb
db/migrate/20160913162434_remove_projects_pushes_since_gc.rb
+1
-1
db/migrate/20160913212128_change_artifacts_size_column.rb
db/migrate/20160913212128_change_artifacts_size_column.rb
+1
-1
db/migrate/20160915042921_create_merge_requests_closing_issues.rb
...te/20160915042921_create_merge_requests_closing_issues.rb
+1
-1
db/migrate/20160919144305_add_type_to_labels.rb
db/migrate/20160919144305_add_type_to_labels.rb
+1
-1
db/migrate/20161014173530_create_label_priorities.rb
db/migrate/20161014173530_create_label_priorities.rb
+1
-1
db/migrate/20161017125927_add_unique_index_to_labels.rb
db/migrate/20161017125927_add_unique_index_to_labels.rb
+1
-1
db/migrate/20161018024215_migrate_labels_priority.rb
db/migrate/20161018024215_migrate_labels_priority.rb
+1
-1
db/migrate/20161018024550_remove_priority_from_labels.rb
db/migrate/20161018024550_remove_priority_from_labels.rb
+1
-1
db/migrate/20161019190736_migrate_sidekiq_queues_from_default.rb
...ate/20161019190736_migrate_sidekiq_queues_from_default.rb
+1
-1
db/migrate/20161019213545_generate_project_feature_for_projects.rb
...e/20161019213545_generate_project_feature_for_projects.rb
+1
-1
db/migrate/20161020083353_add_pipeline_id_to_merge_request_metrics.rb
...0161020083353_add_pipeline_id_to_merge_request_metrics.rb
+1
-1
db/migrate/20161024042317_migrate_mailroom_queue_from_default.rb
...ate/20161024042317_migrate_mailroom_queue_from_default.rb
+1
-1
db/migrate/20161025231710_migrate_jira_to_gem.rb
db/migrate/20161025231710_migrate_jira_to_gem.rb
+1
-1
db/migrate/20161031174110_migrate_subscriptions_project_id.rb
...igrate/20161031174110_migrate_subscriptions_project_id.rb
+1
-1
db/migrate/20161031181638_add_unique_index_to_subscriptions.rb
...grate/20161031181638_add_unique_index_to_subscriptions.rb
+1
-1
db/migrate/20161103171205_rename_repository_storage_column.rb
...igrate/20161103171205_rename_repository_storage_column.rb
+1
-1
db/migrate/20161124141322_migrate_process_commit_worker_jobs.rb
...rate/20161124141322_migrate_process_commit_worker_jobs.rb
+1
-1
db/migrate/20161130095245_fill_routes_table.rb
db/migrate/20161130095245_fill_routes_table.rb
+1
-1
db/migrate/20161130101252_fill_projects_routes_table.rb
db/migrate/20161130101252_fill_projects_routes_table.rb
+1
-1
db/migrate/20161201160452_migrate_project_statistics.rb
db/migrate/20161201160452_migrate_project_statistics.rb
+1
-1
db/migrate/20161207231620_fixup_environment_name_uniqueness.rb
...grate/20161207231620_fixup_environment_name_uniqueness.rb
+5
-5
db/migrate/20161207231621_create_environment_name_unique_index.rb
...te/20161207231621_create_environment_name_unique_index.rb
+1
-1
db/migrate/20161207231626_add_environment_slug.rb
db/migrate/20161207231626_add_environment_slug.rb
+1
-1
db/migrate/20161209153400_add_unique_index_for_environment_slug.rb
...e/20161209153400_add_unique_index_for_environment_slug.rb
+1
-1
db/migrate/20170124174637_add_foreign_keys_to_timelogs.rb
db/migrate/20170124174637_add_foreign_keys_to_timelogs.rb
+1
-1
db/post_migrate/20161011222551_remove_inactive_jira_service_properties.rb
...20161011222551_remove_inactive_jira_service_properties.rb
+1
-1
db/post_migrate/20161109150329_fix_project_records_with_invalid_visibility.rb
...1109150329_fix_project_records_with_invalid_visibility.rb
+7
-7
No files found.
.rubocop.yml
View file @
0a5b670a
...
...
@@ -354,6 +354,9 @@ Style/MultilineTernaryOperator:
# mutable literal (e.g. array or hash).
Style/MutableConstant
:
Enabled
:
true
Exclude
:
-
'
db/migrate/**/*'
-
'
db/post_migrate/**/*'
# Favor unless over if for negative conditions (or control flow or).
Style/NegatedIf
:
...
...
db/migrate/20160705055254_move_from_developers_can_merge_to_protected_branches_merge_access.rb
View file @
0a5b670a
...
...
@@ -3,7 +3,7 @@
class
MoveFromDevelopersCanMergeToProtectedBranchesMergeAccess
<
ActiveRecord
::
Migration
DOWNTIME
=
true
DOWNTIME_REASON
=
<<-
HEREDOC
.
freeze
DOWNTIME_REASON
=
<<-
HEREDOC
We're creating a `merge_access_level` for each `protected_branch`. If a user creates a `protected_branch` while this
is running, we might be left with a `protected_branch` _without_ an associated `merge_access_level`. The `protected_branches`
table must not change while this is running, so downtime is required.
...
...
db/migrate/20160705055308_move_from_developers_can_push_to_protected_branches_push_access.rb
View file @
0a5b670a
...
...
@@ -3,7 +3,7 @@
class
MoveFromDevelopersCanPushToProtectedBranchesPushAccess
<
ActiveRecord
::
Migration
DOWNTIME
=
true
DOWNTIME_REASON
=
<<-
HEREDOC
.
freeze
DOWNTIME_REASON
=
<<-
HEREDOC
We're creating a `push_access_level` for each `protected_branch`. If a user creates a `protected_branch` while this
is running, we might be left with a `protected_branch` _without_ an associated `push_access_level`. The `protected_branches`
table must not change while this is running, so downtime is required.
...
...
db/migrate/20160729173930_remove_project_id_from_spam_logs.rb
View file @
0a5b670a
...
...
@@ -10,7 +10,7 @@ class RemoveProjectIdFromSpamLogs < ActiveRecord::Migration
# When a migration requires downtime you **must** uncomment the following
# constant and define a short and easy to understand explanation as to why the
# migration requires downtime.
DOWNTIME_REASON
=
'Removing a column that contains data that is not used anywhere.'
.
freeze
DOWNTIME_REASON
=
'Removing a column that contains data that is not used anywhere.'
# When using the methods "add_concurrent_index" or "add_column_with_default"
# you must disable the use of transactions as these methods can not run in an
...
...
db/migrate/20160823081327_change_merge_error_to_text.rb
View file @
0a5b670a
...
...
@@ -2,7 +2,7 @@ class ChangeMergeErrorToText < ActiveRecord::Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
true
DOWNTIME_REASON
=
'This migration requires downtime because it alters a column from varchar(255) to text.'
.
freeze
DOWNTIME_REASON
=
'This migration requires downtime because it alters a column from varchar(255) to text.'
def
change
change_column
:merge_requests
,
:merge_error
,
:text
,
limit:
65535
...
...
db/migrate/20160824124900_add_table_issue_metrics.rb
View file @
0a5b670a
...
...
@@ -10,7 +10,7 @@ class AddTableIssueMetrics < ActiveRecord::Migration
# When a migration requires downtime you **must** uncomment the following
# constant and define a short and easy to understand explanation as to why the
# migration requires downtime.
DOWNTIME_REASON
=
'Adding foreign key'
.
freeze
DOWNTIME_REASON
=
'Adding foreign key'
# When using the methods "add_concurrent_index" or "add_column_with_default"
# you must disable the use of transactions as these methods can not run in an
...
...
db/migrate/20160825052008_add_table_merge_request_metrics.rb
View file @
0a5b670a
...
...
@@ -10,7 +10,7 @@ class AddTableMergeRequestMetrics < ActiveRecord::Migration
# When a migration requires downtime you **must** uncomment the following
# constant and define a short and easy to understand explanation as to why the
# migration requires downtime.
DOWNTIME_REASON
=
'Adding foreign key'
.
freeze
DOWNTIME_REASON
=
'Adding foreign key'
# When using the methods "add_concurrent_index" or "add_column_with_default"
# you must disable the use of transactions as these methods can not run in an
...
...
db/migrate/20160831223750_remove_features_enabled_from_projects.rb
View file @
0a5b670a
...
...
@@ -7,7 +7,7 @@ class RemoveFeaturesEnabledFromProjects < ActiveRecord::Migration
# Set this constant to true if this migration requires downtime.
DOWNTIME
=
true
DOWNTIME_REASON
=
"Removing fields from database requires downtine."
.
freeze
DOWNTIME_REASON
=
"Removing fields from database requires downtine."
def
up
remove_column
:projects
,
:issues_enabled
...
...
db/migrate/20160913162434_remove_projects_pushes_since_gc.rb
View file @
0a5b670a
...
...
@@ -5,7 +5,7 @@ class RemoveProjectsPushesSinceGc < ActiveRecord::Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
true
DOWNTIME_REASON
=
'This migration removes an existing column'
.
freeze
DOWNTIME_REASON
=
'This migration removes an existing column'
disable_ddl_transaction!
...
...
db/migrate/20160913212128_change_artifacts_size_column.rb
View file @
0a5b670a
...
...
@@ -3,7 +3,7 @@ class ChangeArtifactsSizeColumn < ActiveRecord::Migration
DOWNTIME
=
true
DOWNTIME_REASON
=
'Changing an integer column size requires a full table rewrite.'
.
freeze
DOWNTIME_REASON
=
'Changing an integer column size requires a full table rewrite.'
def
up
change_column
:ci_builds
,
:artifacts_size
,
:integer
,
limit:
8
...
...
db/migrate/20160915042921_create_merge_requests_closing_issues.rb
View file @
0a5b670a
...
...
@@ -10,7 +10,7 @@ class CreateMergeRequestsClosingIssues < ActiveRecord::Migration
# When a migration requires downtime you **must** uncomment the following
# constant and define a short and easy to understand explanation as to why the
# migration requires downtime.
DOWNTIME_REASON
=
'Adding foreign keys'
.
freeze
DOWNTIME_REASON
=
'Adding foreign keys'
# When using the methods "add_concurrent_index" or "add_column_with_default"
# you must disable the use of transactions as these methods can not run in an
...
...
db/migrate/20160919144305_add_type_to_labels.rb
View file @
0a5b670a
...
...
@@ -2,7 +2,7 @@ class AddTypeToLabels < ActiveRecord::Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
true
DOWNTIME_REASON
=
'Labels will not work as expected until this migration is complete.'
.
freeze
DOWNTIME_REASON
=
'Labels will not work as expected until this migration is complete.'
def
change
add_column
:labels
,
:type
,
:string
...
...
db/migrate/20161014173530_create_label_priorities.rb
View file @
0a5b670a
...
...
@@ -2,7 +2,7 @@ class CreateLabelPriorities < ActiveRecord::Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
true
DOWNTIME_REASON
=
'This migration adds foreign keys'
.
freeze
DOWNTIME_REASON
=
'This migration adds foreign keys'
disable_ddl_transaction!
...
...
db/migrate/20161017125927_add_unique_index_to_labels.rb
View file @
0a5b670a
...
...
@@ -2,7 +2,7 @@ class AddUniqueIndexToLabels < ActiveRecord::Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
true
DOWNTIME_REASON
=
'This migration removes duplicated labels.'
.
freeze
DOWNTIME_REASON
=
'This migration removes duplicated labels.'
disable_ddl_transaction!
...
...
db/migrate/20161018024215_migrate_labels_priority.rb
View file @
0a5b670a
...
...
@@ -2,7 +2,7 @@ class MigrateLabelsPriority < ActiveRecord::Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
true
DOWNTIME_REASON
=
'Prioritized labels will not work as expected until this migration is complete.'
.
freeze
DOWNTIME_REASON
=
'Prioritized labels will not work as expected until this migration is complete.'
disable_ddl_transaction!
...
...
db/migrate/20161018024550_remove_priority_from_labels.rb
View file @
0a5b670a
...
...
@@ -2,7 +2,7 @@ class RemovePriorityFromLabels < ActiveRecord::Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
true
DOWNTIME_REASON
=
'This migration removes an existing column'
.
freeze
DOWNTIME_REASON
=
'This migration removes an existing column'
disable_ddl_transaction!
...
...
db/migrate/20161019190736_migrate_sidekiq_queues_from_default.rb
View file @
0a5b670a
...
...
@@ -8,7 +8,7 @@ class MigrateSidekiqQueuesFromDefault < ActiveRecord::Migration
DOWNTIME
=
true
DOWNTIME_REASON
=
<<-
EOF
.
freeze
DOWNTIME_REASON
=
<<-
EOF
Moving Sidekiq jobs from queues requires Sidekiq to be stopped. Not stopping
Sidekiq will result in the loss of jobs that are scheduled after this
migration completes.
...
...
db/migrate/20161019213545_generate_project_feature_for_projects.rb
View file @
0a5b670a
class
GenerateProjectFeatureForProjects
<
ActiveRecord
::
Migration
DOWNTIME
=
true
DOWNTIME_REASON
=
<<-
HEREDOC
.
freeze
DOWNTIME_REASON
=
<<-
HEREDOC
Application was eager loading project_feature for all projects generating an extra query
everytime a project was fetched. We removed that behavior to avoid the extra query, this migration
makes sure all projects have a project_feature record associated.
...
...
db/migrate/20161020083353_add_pipeline_id_to_merge_request_metrics.rb
View file @
0a5b670a
...
...
@@ -12,7 +12,7 @@ class AddPipelineIdToMergeRequestMetrics < ActiveRecord::Migration
# When a migration requires downtime you **must** uncomment the following
# constant and define a short and easy to understand explanation as to why the
# migration requires downtime.
DOWNTIME_REASON
=
'Adding a foreign key'
.
freeze
DOWNTIME_REASON
=
'Adding a foreign key'
# When using the methods "add_concurrent_index" or "add_column_with_default"
# you must disable the use of transactions as these methods can not run in an
...
...
db/migrate/20161024042317_migrate_mailroom_queue_from_default.rb
View file @
0a5b670a
...
...
@@ -8,7 +8,7 @@ class MigrateMailroomQueueFromDefault < ActiveRecord::Migration
DOWNTIME
=
true
DOWNTIME_REASON
=
<<-
EOF
.
freeze
DOWNTIME_REASON
=
<<-
EOF
Moving Sidekiq jobs from queues requires Sidekiq to be stopped. Not stopping
Sidekiq will result in the loss of jobs that are scheduled after this
migration completes.
...
...
db/migrate/20161025231710_migrate_jira_to_gem.rb
View file @
0a5b670a
class
MigrateJiraToGem
<
ActiveRecord
::
Migration
DOWNTIME
=
true
DOWNTIME_REASON
=
<<-
HEREDOC
.
freeze
DOWNTIME_REASON
=
<<-
HEREDOC
Refactor all Jira services properties(serialized field) to use new jira-ruby gem.
There were properties on old Jira service that are not needed anymore after the
service refactoring: api_url, project_url, new_issue_url, issues_url.
...
...
db/migrate/20161031174110_migrate_subscriptions_project_id.rb
View file @
0a5b670a
...
...
@@ -2,7 +2,7 @@ class MigrateSubscriptionsProjectId < ActiveRecord::Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
true
DOWNTIME_REASON
=
'Subscriptions will not work as expected until this migration is complete.'
.
freeze
DOWNTIME_REASON
=
'Subscriptions will not work as expected until this migration is complete.'
def
up
execute
<<-
EOF
.
strip_heredoc
...
...
db/migrate/20161031181638_add_unique_index_to_subscriptions.rb
View file @
0a5b670a
...
...
@@ -2,7 +2,7 @@ class AddUniqueIndexToSubscriptions < ActiveRecord::Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
true
DOWNTIME_REASON
=
'This migration requires downtime because it changes a column to not accept null values.'
.
freeze
DOWNTIME_REASON
=
'This migration requires downtime because it changes a column to not accept null values.'
disable_ddl_transaction!
...
...
db/migrate/20161103171205_rename_repository_storage_column.rb
View file @
0a5b670a
...
...
@@ -10,7 +10,7 @@ class RenameRepositoryStorageColumn < ActiveRecord::Migration
# When a migration requires downtime you **must** uncomment the following
# constant and define a short and easy to understand explanation as to why the
# migration requires downtime.
DOWNTIME_REASON
=
'Renaming the application_settings.repository_storage column'
.
freeze
DOWNTIME_REASON
=
'Renaming the application_settings.repository_storage column'
# When using the methods "add_concurrent_index" or "add_column_with_default"
# you must disable the use of transactions as these methods can not run in an
...
...
db/migrate/20161124141322_migrate_process_commit_worker_jobs.rb
View file @
0a5b670a
...
...
@@ -25,7 +25,7 @@ class MigrateProcessCommitWorkerJobs < ActiveRecord::Migration
end
DOWNTIME
=
true
DOWNTIME_REASON
=
'Existing workers will error until they are using a newer version of the code'
.
freeze
DOWNTIME_REASON
=
'Existing workers will error until they are using a newer version of the code'
disable_ddl_transaction!
...
...
db/migrate/20161130095245_fill_routes_table.rb
View file @
0a5b670a
...
...
@@ -5,7 +5,7 @@ class FillRoutesTable < ActiveRecord::Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
true
DOWNTIME_REASON
=
'No new namespaces should be created during data copy'
.
freeze
DOWNTIME_REASON
=
'No new namespaces should be created during data copy'
def
up
execute
<<-
EOF
...
...
db/migrate/20161130101252_fill_projects_routes_table.rb
View file @
0a5b670a
...
...
@@ -5,7 +5,7 @@ class FillProjectsRoutesTable < ActiveRecord::Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
true
DOWNTIME_REASON
=
'No new projects should be created during data copy'
.
freeze
DOWNTIME_REASON
=
'No new projects should be created during data copy'
def
up
if
Gitlab
::
Database
.
postgresql?
...
...
db/migrate/20161201160452_migrate_project_statistics.rb
View file @
0a5b670a
...
...
@@ -2,7 +2,7 @@ class MigrateProjectStatistics < ActiveRecord::Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
true
DOWNTIME_REASON
=
'Removes two columns from the projects table'
.
freeze
DOWNTIME_REASON
=
'Removes two columns from the projects table'
def
up
# convert repository_size in float (megabytes) to integer (bytes),
...
...
db/migrate/20161207231620_fixup_environment_name_uniqueness.rb
View file @
0a5b670a
...
...
@@ -2,7 +2,7 @@ class FixupEnvironmentNameUniqueness < ActiveRecord::Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
true
DOWNTIME_REASON
=
'Renaming non-unique environments'
.
freeze
DOWNTIME_REASON
=
'Renaming non-unique environments'
def
up
environments
=
Arel
::
Table
.
new
(
:environments
)
...
...
@@ -42,10 +42,10 @@ class FixupEnvironmentNameUniqueness < ActiveRecord::Migration
conflicts
.
each
do
|
id
,
name
|
update_sql
=
Arel
::
UpdateManager
.
new
(
ActiveRecord
::
Base
)
.
table
(
environments
)
.
set
(
environments
[
:name
]
=>
name
+
"-"
+
id
.
to_s
)
.
where
(
environments
[
:id
].
eq
(
id
))
.
to_sql
.
table
(
environments
)
.
set
(
environments
[
:name
]
=>
name
+
"-"
+
id
.
to_s
)
.
where
(
environments
[
:id
].
eq
(
id
))
.
to_sql
connection
.
exec_update
(
update_sql
,
self
.
class
.
name
,
[])
end
...
...
db/migrate/20161207231621_create_environment_name_unique_index.rb
View file @
0a5b670a
...
...
@@ -4,7 +4,7 @@ class CreateEnvironmentNameUniqueIndex < ActiveRecord::Migration
disable_ddl_transaction!
DOWNTIME
=
true
DOWNTIME_REASON
=
'Making a non-unique index into a unique index'
.
freeze
DOWNTIME_REASON
=
'Making a non-unique index into a unique index'
def
up
remove_index
:environments
,
[
:project_id
,
:name
]
...
...
db/migrate/20161207231626_add_environment_slug.rb
View file @
0a5b670a
...
...
@@ -5,7 +5,7 @@ class AddEnvironmentSlug < ActiveRecord::Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
true
DOWNTIME_REASON
=
'Adding NOT NULL column environments.slug with dependent data'
.
freeze
DOWNTIME_REASON
=
'Adding NOT NULL column environments.slug with dependent data'
# Used to generate random suffixes for the slug
LETTERS
=
'a'
..
'z'
...
...
db/migrate/20161209153400_add_unique_index_for_environment_slug.rb
View file @
0a5b670a
...
...
@@ -5,7 +5,7 @@ class AddUniqueIndexForEnvironmentSlug < ActiveRecord::Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
true
DOWNTIME_REASON
=
'Adding a *unique* index to environments.slug'
.
freeze
DOWNTIME_REASON
=
'Adding a *unique* index to environments.slug'
disable_ddl_transaction!
...
...
db/migrate/20170124174637_add_foreign_keys_to_timelogs.rb
View file @
0a5b670a
...
...
@@ -9,7 +9,7 @@ class AddForeignKeysToTimelogs < ActiveRecord::Migration
# When a migration requires downtime you **must** uncomment the following
# constant and define a short and easy to understand explanation as to why the
# migration requires downtime.
DOWNTIME_REASON
=
''
.
freeze
DOWNTIME_REASON
=
''
# When using the methods "add_concurrent_index" or "add_column_with_default"
# you must disable the use of transactions as these methods can not run in an
...
...
db/post_migrate/20161011222551_remove_inactive_jira_service_properties.rb
View file @
0a5b670a
...
...
@@ -2,7 +2,7 @@ class RemoveInactiveJiraServiceProperties < ActiveRecord::Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
true
DOWNTIME_REASON
=
"Removes all inactive jira_service properties"
.
freeze
DOWNTIME_REASON
=
"Removes all inactive jira_service properties"
def
up
execute
(
"UPDATE services SET properties = '{}' WHERE services.type = 'JiraService' and services.active = false"
)
...
...
db/post_migrate/20161109150329_fix_project_records_with_invalid_visibility.rb
View file @
0a5b670a
...
...
@@ -14,15 +14,15 @@ class FixProjectRecordsWithInvalidVisibility < ActiveRecord::Migration
finder_sql
=
projects
.
join
(
namespaces
,
Arel
::
Nodes
::
InnerJoin
)
.
on
(
projects
[
:namespace_id
].
eq
(
namespaces
[
:id
]))
.
where
(
projects
[
:visibility_level
].
gt
(
namespaces
[
:visibility_level
]))
.
project
(
projects
[
:id
],
namespaces
[
:visibility_level
])
.
take
(
BATCH_SIZE
)
.
to_sql
.
join
(
namespaces
,
Arel
::
Nodes
::
InnerJoin
)
.
on
(
projects
[
:namespace_id
].
eq
(
namespaces
[
:id
]))
.
where
(
projects
[
:visibility_level
].
gt
(
namespaces
[
:visibility_level
]))
.
project
(
projects
[
:id
],
namespaces
[
:visibility_level
])
.
take
(
BATCH_SIZE
)
.
to_sql
# Update matching rows in batches. Each batch can cause up to 3 UPDATE
# statements, in addition to the SELECT: one per visibility_level
# statements, in addition to the SELECT: one per visibility_level
loop
do
to_update
=
connection
.
exec_query
(
finder_sql
)
break
if
to_update
.
rows
.
count
==
0
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment