Commit f6616247 authored by Adam Hegyi's avatar Adam Hegyi

Merge branch 'improve-migration-style-guide' into 'master'

Improve migration style guide

See merge request gitlab-org/gitlab!25607
parents a45d3835 3c9b21b0
...@@ -424,16 +424,10 @@ Take the following migration as an example: ...@@ -424,16 +424,10 @@ Take the following migration as an example:
```ruby ```ruby
class DefaultRequestAccessGroups < ActiveRecord::Migration[5.2] class DefaultRequestAccessGroups < ActiveRecord::Migration[5.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false DOWNTIME = false
def up def change
change_column_default :namespaces, :request_access_enabled, true change_column_default(:namespaces, :request_access_enabled, from: false, to: true)
end
def down
change_column_default :namespaces, :request_access_enabled, false
end end
end end
``` ```
......
# frozen_string_literal: true # frozen_string_literal: true
# See http://doc.gitlab.com/ce/development/migration_style_guide.html # See https://docs.gitlab.com/ee/development/migration_style_guide.html
# for more information on how to write migrations for GitLab. # for more information on how to write migrations for GitLab.
class <%= migration_class_name %> < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>] class <%= migration_class_name %> < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>]
......
# frozen_string_literal: true # frozen_string_literal: true
# See http://doc.gitlab.com/ce/development/migration_style_guide.html # See https://docs.gitlab.com/ee/development/migration_style_guide.html
# for more information on how to write migrations for GitLab. # for more information on how to write migrations for GitLab.
class <%= migration_class_name %> < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>] class <%= migration_class_name %> < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>]
......
# frozen_string_literal: true # frozen_string_literal: true
# See http://doc.gitlab.com/ce/development/migration_style_guide.html # See https://docs.gitlab.com/ee/development/migration_style_guide.html
# for more information on how to write migrations for GitLab. # for more information on how to write migrations for GitLab.
class <%= migration_class_name %> < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>] class <%= migration_class_name %> < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment