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
c3a8d277
Commit
c3a8d277
authored
May 07, 2018
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure we use the same migration versions in CE and EE, and that CE can be upgraded to EE
parent
108e83ce
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
72 additions
and
25 deletions
+72
-25
db/migrate/20180502122856_create_project_mirror_data.rb
db/migrate/20180502122856_create_project_mirror_data.rb
+1
-1
db/migrate/20180503175054_add_indexes_to_project_mirror_data.rb
...rate/20180503175054_add_indexes_to_project_mirror_data.rb
+1
-1
ee/db/migrate/20170509153720_create_project_mirror_data_ee.rb
...b/migrate/20170509153720_create_project_mirror_data_ee.rb
+5
-1
ee/db/migrate/20180430134556_migrate_import_attributes_from_project_to_project_mirror_data.rb
..._import_attributes_from_project_to_project_mirror_data.rb
+0
-19
ee/db/migrate/20180502124117_add_missing_columns_to_project_mirror_data.rb
...80502124117_add_missing_columns_to_project_mirror_data.rb
+47
-0
ee/db/migrate/20180503154922_add_indexes_to_project_mirror_data_ee.rb
...e/20180503154922_add_indexes_to_project_mirror_data_ee.rb
+15
-0
spec/lib/gitlab/background_migration/populate_import_state_spec.rb
...gitlab/background_migration/populate_import_state_spec.rb
+1
-1
spec/lib/gitlab/background_migration/rollback_import_state_data_spec.rb
...b/background_migration/rollback_import_state_data_spec.rb
+1
-1
spec/migrations/migrate_import_attributes_data_from_projects_to_project_mirror_data_spec.rb
...ributes_data_from_projects_to_project_mirror_data_spec.rb
+1
-1
No files found.
db/migrate/20180502122856_create_project_mirror_data
_ce
.rb
→
db/migrate/20180502122856_create_project_mirror_data.rb
View file @
c3a8d277
class
CreateProjectMirrorData
Ce
<
ActiveRecord
::
Migration
class
CreateProjectMirrorData
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
...
...
db/migrate/20180503175054_add_indexes_to_project_mirror_data
_ce
.rb
→
db/migrate/20180503175054_add_indexes_to_project_mirror_data.rb
View file @
c3a8d277
class
AddIndexesToProjectMirrorData
Ce
<
ActiveRecord
::
Migration
class
AddIndexesToProjectMirrorData
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
...
...
ee/db/migrate/20170509153720_create_project_mirror_data.rb
→
ee/db/migrate/20170509153720_create_project_mirror_data
_ee
.rb
View file @
c3a8d277
class
CreateProjectMirrorData
<
ActiveRecord
::
Migration
class
CreateProjectMirrorData
EE
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
...
...
@@ -6,6 +6,10 @@ class CreateProjectMirrorData < ActiveRecord::Migration
disable_ddl_transaction!
def
up
# When moving from CE to EE, project_mirror_data may already exist, but will
# not have all the required columns. These are added in AddMissingColumnsToProjectMirrorData.
return
if
table_exists?
(
:project_mirror_data
)
execute
<<-
SQL
CREATE TABLE project_mirror_data
AS (
...
...
ee/db/migrate/20180430134556_migrate_import_attributes_from_project_to_project_mirror_data.rb
deleted
100644 → 0
View file @
108e83ce
class
MigrateImportAttributesFromProjectToProjectMirrorData
<
ActiveRecord
::
Migration
DOWNTIME
=
false
def
up
add_column
:project_mirror_data
,
:status
,
:string
add_column
:project_mirror_data
,
:jid
,
:string
add_column
:project_mirror_data
,
:last_update_at
,
:datetime_with_timezone
add_column
:project_mirror_data
,
:last_successful_update_at
,
:datetime_with_timezone
add_column
:project_mirror_data
,
:last_error
,
:text
end
def
down
remove_column
:project_mirror_data
,
:status
remove_column
:project_mirror_data
,
:jid
remove_column
:project_mirror_data
,
:last_update_at
remove_column
:project_mirror_data
,
:last_successful_update_at
remove_column
:project_mirror_data
,
:last_error
end
end
ee/db/migrate/20180502124117_add_missing_columns_to_project_mirror_data.rb
0 → 100644
View file @
c3a8d277
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class
AddMissingColumnsToProjectMirrorData
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
# Set this constant to true if this migration requires downtime.
DOWNTIME
=
false
disable_ddl_transaction!
def
up
# Columns missing when a CE instance is upgraded to EE
unless
column_exists?
:project_mirror_data
,
:retry_count
add_column_with_default
:project_mirror_data
,
:retry_count
,
:integer
,
default:
0
,
allow_null:
false
add_column
:project_mirror_data
,
:last_update_started_at
,
:datetime
add_column
:project_mirror_data
,
:last_update_scheduled_at
,
:datetime
add_column
:project_mirror_data
,
:next_execution_timestamp
,
:datetime
end
# Columns missing on an EE instance
unless
column_exists?
:project_mirror_data
,
:status
add_column
:project_mirror_data
,
:status
,
:string
add_column
:project_mirror_data
,
:jid
,
:string
add_column
:project_mirror_data
,
:last_update_at
,
:datetime_with_timezone
add_column
:project_mirror_data
,
:last_successful_update_at
,
:datetime_with_timezone
add_column
:project_mirror_data
,
:last_error
,
:text
end
end
def
down
if
column_exists?
:project_mirror_data
,
:retry_count
remove_column
:project_mirror_data
,
:retry_count
remove_column
:project_mirror_data
,
:last_update_started_at
remove_column
:project_mirror_data
,
:last_update_scheduled_at
remove_column
:project_mirror_data
,
:next_execution_timestamp
end
if
column_exists?
:project_mirror_data
,
:status
remove_column
:project_mirror_data
,
:status
remove_column
:project_mirror_data
,
:jid
remove_column
:project_mirror_data
,
:last_update_at
remove_column
:project_mirror_data
,
:last_successful_update_at
remove_column
:project_mirror_data
,
:last_error
end
end
end
db/migrate/20180503154922_add_indexes_to_project_mirror_data
.rb
→
ee/db/migrate/20180503154922_add_indexes_to_project_mirror_data_ee
.rb
View file @
c3a8d277
class
AddIndexesToProjectMirrorData
<
ActiveRecord
::
Migration
class
AddIndexesToProjectMirrorData
EE
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
...
...
@@ -7,13 +7,9 @@ class AddIndexesToProjectMirrorData < ActiveRecord::Migration
def
up
add_concurrent_index
:project_mirror_data
,
:last_successful_update_at
add_concurrent_index
:project_mirror_data
,
:jid
add_concurrent_index
:project_mirror_data
,
:status
end
def
down
remove_index
:project_mirror_data
,
:last_successful_update_at
if
index_exists?
:project_mirror_data
,
:last_successful_update_at
remove_index
:project_mirror_data
,
:jid
if
index_exists?
:project_mirror_data
,
:jid
remove_index
:project_mirror_data
,
:status
if
index_exists?
:project_mirror_data
,
:status
end
end
spec/lib/gitlab/background_migration/populate_import_state_spec.rb
View file @
c3a8d277
require
'spec_helper'
describe
Gitlab
::
BackgroundMigration
::
PopulateImportState
,
:migration
,
schema:
20180
430144643
do
describe
Gitlab
::
BackgroundMigration
::
PopulateImportState
,
:migration
,
schema:
20180
502134117
do
let
(
:migration
)
{
described_class
.
new
}
let
(
:namespaces
)
{
table
(
:namespaces
)
}
let
(
:projects
)
{
table
(
:projects
)
}
...
...
spec/lib/gitlab/background_migration/rollback_import_state_data_spec.rb
View file @
c3a8d277
require
'spec_helper'
describe
Gitlab
::
BackgroundMigration
::
RollbackImportStateData
,
:migration
,
schema:
20180
430144643
do
describe
Gitlab
::
BackgroundMigration
::
RollbackImportStateData
,
:migration
,
schema:
20180
502134117
do
let
(
:migration
)
{
described_class
.
new
}
let
(
:namespaces
)
{
table
(
:namespaces
)
}
let
(
:projects
)
{
table
(
:projects
)
}
...
...
spec/migrations/migrate_import_attributes_data_from_projects_to_project_mirror_data_spec.rb
View file @
c3a8d277
require
'spec_helper'
require
Rails
.
root
.
join
(
'db'
,
'post_migrate'
,
'20180
430144643
_migrate_import_attributes_data_from_projects_to_project_mirror_data.rb'
)
require
Rails
.
root
.
join
(
'db'
,
'post_migrate'
,
'20180
502134117
_migrate_import_attributes_data_from_projects_to_project_mirror_data.rb'
)
describe
MigrateImportAttributesDataFromProjectsToProjectMirrorData
,
:sidekiq
,
:migration
do
let
(
:namespaces
)
{
table
(
:namespaces
)
}
...
...
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