diff options
author | Gabriel Mazetto <brodock@gmail.com> | 2018-08-09 20:41:39 +0200 |
---|---|---|
committer | Gabriel Mazetto <brodock@gmail.com> | 2018-08-16 19:58:17 +0200 |
commit | 85e83813379bb7be86e266c67dedcfee2cd6d738 (patch) | |
tree | 9f65b66850428e7eb917d813571db97d58e9d96d /db | |
parent | fd9377fa1a4e1eaef280200430c47036d0e58d71 (diff) | |
download | gitlab-ce-85e83813379bb7be86e266c67dedcfee2cd6d738.tar.gz |
Add WikiAccessLevel migration from `NULL` to `20`
Diffstat (limited to 'db')
-rw-r--r-- | db/post_migrate/20180809195358_migrate_null_wiki_access_levels.rb | 23 | ||||
-rw-r--r-- | db/schema.rb | 2 |
2 files changed, 24 insertions, 1 deletions
diff --git a/db/post_migrate/20180809195358_migrate_null_wiki_access_levels.rb b/db/post_migrate/20180809195358_migrate_null_wiki_access_levels.rb new file mode 100644 index 00000000000..d3557efecbd --- /dev/null +++ b/db/post_migrate/20180809195358_migrate_null_wiki_access_levels.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +class MigrateNullWikiAccessLevels < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + class ProjectFeature < ActiveRecord::Base + include EachBatch + + self.table_name = 'project_features' + end + + def up + ProjectFeature.where(wiki_access_level: nil).each_batch do |relation| + relation.update_all(wiki_access_level: 20) + end + end + + def down + # there is no way to rollback this change, there are no downsides in keeping migrated data. + end +end diff --git a/db/schema.rb b/db/schema.rb index 1288a98745c..9dc122b54b3 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20180808162000) do +ActiveRecord::Schema.define(version: 20180809195358) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" |