Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGabriel Mazetto <brodock@gmail.com>2018-08-09 21:41:39 +0300
committerGabriel Mazetto <brodock@gmail.com>2018-08-16 20:58:17 +0300
commit85e83813379bb7be86e266c67dedcfee2cd6d738 (patch)
tree9f65b66850428e7eb917d813571db97d58e9d96d /db
parentfd9377fa1a4e1eaef280200430c47036d0e58d71 (diff)
Add WikiAccessLevel migration from `NULL` to `20`
Diffstat (limited to 'db')
-rw-r--r--db/post_migrate/20180809195358_migrate_null_wiki_access_levels.rb23
-rw-r--r--db/schema.rb2
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"