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
19f36a34
Commit
19f36a34
authored
Aug 06, 2019
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Migration Style Guide
parent
4aa824e7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
8 deletions
+3
-8
doc/development/migration_style_guide.md
doc/development/migration_style_guide.md
+3
-8
No files found.
doc/development/migration_style_guide.md
View file @
19f36a34
...
@@ -10,9 +10,7 @@ migrations are written carefully, can be applied online and adhere to the style
...
@@ -10,9 +10,7 @@ migrations are written carefully, can be applied online and adhere to the style
guide below.
guide below.
Migrations are
**not**
allowed to require GitLab installations to be taken
Migrations are
**not**
allowed to require GitLab installations to be taken
offline unless _absolutely necessary_. Downtime assumptions should be based on
offline unless _absolutely necessary_.
the behaviour of a migration when performed using PostgreSQL, as various
operations in MySQL may require downtime without there being alternatives.
When downtime is necessary the migration has to be approved by:
When downtime is necessary the migration has to be approved by:
...
@@ -343,10 +341,7 @@ class AddOptionsToBuildMetadata < ActiveRecord::Migration[5.0]
...
@@ -343,10 +341,7 @@ class AddOptionsToBuildMetadata < ActiveRecord::Migration[5.0]
end
end
```
```
On MySQL the
`JSON`
and
`JSONB`
is translated to
`TEXT 1MB`
, as
`JSONB`
is PostgreSQL only feature.
You have to use a serializer to provide a translation layer:
For above reason you have to use a serializer to provide a translation layer
in order to support PostgreSQL and MySQL seamlessly:
```
ruby
```
ruby
class
BuildMetadata
class
BuildMetadata
...
@@ -356,7 +351,7 @@ end
...
@@ -356,7 +351,7 @@ end
## Testing
## Testing
Make sure that your migration works
with MySQL and PostgreSQL
with data. An
Make sure that your migration works
for databases
with data. An
empty database does not guarantee that your migration is correct.
empty database does not guarantee that your migration is correct.
Make sure your migration can be reversed.
Make sure your migration can be reversed.
...
...
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