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
d6fcc60d
Commit
d6fcc60d
authored
Apr 26, 2021
by
Andreas Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use rollback helpers for pk migration
parent
52921fb3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
12 deletions
+6
-12
db/migrate/20210426094524_initialize_conversion_of_ci_builds_to_bigint.rb
...426094524_initialize_conversion_of_ci_builds_to_bigint.rb
+1
-6
db/post_migrate/20210426094549_backfill_ci_builds_for_bigint_conversion.rb
...0210426094549_backfill_ci_builds_for_bigint_conversion.rb
+5
-6
No files found.
db/migrate/20210426094524_initialize_conversion_of_ci_builds_to_bigint.rb
View file @
d6fcc60d
...
...
@@ -12,11 +12,6 @@ class InitializeConversionOfCiBuildsToBigint < ActiveRecord::Migration[6.0]
end
def
down
trigger_name
=
rename_trigger_name
(
TABLE
,
COLUMNS
,
TARGET_COLUMNS
)
remove_rename_triggers_for_postgresql
TABLE
,
trigger_name
TARGET_COLUMNS
.
each
do
|
column
|
remove_column
TABLE
,
column
end
revert_initialize_conversion_of_integer_to_bigint
(
TABLE
,
COLUMNS
)
end
end
db/post_migrate/20210426094549_backfill_ci_builds_for_bigint_conversion.rb
View file @
d6fcc60d
...
...
@@ -5,20 +5,19 @@ class BackfillCiBuildsForBigintConversion < ActiveRecord::Migration[6.0]
DOWNTIME
=
false
TABLE
=
:ci_builds
COLUMNS
=
%i(id stage_id)
.
freeze
def
up
return
unless
should_run?
backfill_conversion_of_integer_to_bigint
:ci_builds
,
%i(id stage_id)
,
batch_size:
15000
,
sub_batch_size:
100
backfill_conversion_of_integer_to_bigint
TABLE
,
COLUMNS
,
batch_size:
15000
,
sub_batch_size:
100
end
def
down
return
unless
should_run?
Gitlab
::
Database
::
BackgroundMigration
::
BatchedMigration
.
where
(
job_class_name:
'CopyColumnUsingBackgroundMigrationJob'
)
.
where
(
table_name:
'ci_builds'
,
column_name:
'id'
)
.
where
(
'job_arguments = ?'
,
[
%w[id stage_id]
,
%w[id_convert_to_bigint stage_id_convert_to_bigint]
].
to_json
)
.
delete_all
revert_backfill_conversion_of_integer_to_bigint
TABLE
,
COLUMNS
end
private
...
...
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