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
f20cb3cb
Commit
f20cb3cb
authored
Jan 22, 2020
by
Valery Sizov
Committed by
Marcel Amirault
Jan 22, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Document that EE-only background migrations are forbidden
parent
f838b79c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
0 deletions
+56
-0
doc/development/background_migrations.md
doc/development/background_migrations.md
+7
-0
doc/development/ee_features.md
doc/development/ee_features.md
+49
-0
No files found.
doc/development/background_migrations.md
View file @
f20cb3cb
...
@@ -56,6 +56,13 @@ for more details.
...
@@ -56,6 +56,13 @@ for more details.
Make sure that in case that your migration job is going to be retried data
Make sure that in case that your migration job is going to be retried data
integrity is guaranteed.
integrity is guaranteed.
## Background migrations for EE-only features
All the background migration classes for EE-only features should be present in GitLab CE.
For this purpose, an empty class can be created for GitLab CE and for GitLab EE it can be extended
For this purpose, an empty class can be created for GitLab CE, and it can be extended for GitLab EE
as explained in the
[
guidelines for implementing Enterprise Edition features
](
ee_features.md#code-in-libgitlabbackground_migration
)
.
## How It Works
## How It Works
Background migrations are simple classes that define a
`perform`
method. A
Background migrations are simple classes that define a
`perform`
method. A
...
...
doc/development/ee_features.md
View file @
f20cb3cb
...
@@ -350,6 +350,55 @@ resolve when you add the indentation to the equation.
...
@@ -350,6 +350,55 @@ resolve when you add the indentation to the equation.
EE-specific views should be placed in
`ee/app/views/`
, using extra
EE-specific views should be placed in
`ee/app/views/`
, using extra
sub-directories if appropriate.
sub-directories if appropriate.
### Code in `lib/gitlab/background_migration/`
When you create EE-only background migrations, you have to plan for users that
downgrade GitLab EE to CE. In other words, every EE-only migration has to be present in
CE code but with no implementation, instead you need to extend it on EE side.
GitLab CE:
```
ruby
# lib/gitlab/background_migration/prune_orphaned_geo_events.rb
module
Gitlab
module
BackgroundMigration
class
PruneOrphanedGeoEvents
def
perform
(
table_name
)
end
end
end
end
Gitlab
::
BackgroundMigration
::
PruneOrphanedGeoEvents
.
prepend_if_ee
(
'EE::Gitlab::BackgroundMigration::PruneOrphanedGeoEvents'
)
```
GitLab EE:
```
ruby
# ee/lib/ee/gitlab/background_migration/prune_orphaned_geo_events.rb
module
EE
module
Gitlab
module
BackgroundMigration
module
PruneOrphanedGeoEvents
extend
::
Gitlab
::
Utils
::
Override
override
:perform
def
perform
(
table_name
=
EVENT_TABLES
.
first
)
return
if
::
Gitlab
::
Database
.
read_only?
deleted_rows
=
prune_orphaned_rows
(
table_name
)
table_name
=
next_table
(
table_name
)
if
deleted_rows
.
zero?
::
BackgroundMigrationWorker
.
perform_in
(
RESCHEDULE_DELAY
,
self
.
class
.
name
.
demodulize
,
table_name
)
if
table_name
end
end
end
end
end
```
#### Using `render_if_exists`
#### Using `render_if_exists`
Instead of using regular
`render`
, we should use
`render_if_exists`
, which
Instead of using regular
`render`
, we should use
`render_if_exists`
, which
...
...
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