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
7336bd48
Commit
7336bd48
authored
Aug 15, 2018
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add site statistics recount to the post migiration
parent
1a54986c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
0 deletions
+9
-0
db/post_migrate/20180809195358_migrate_null_wiki_access_levels.rb
...migrate/20180809195358_migrate_null_wiki_access_levels.rb
+9
-0
No files found.
db/post_migrate/20180809195358_migrate_null_wiki_access_levels.rb
View file @
7336bd48
...
@@ -5,6 +5,8 @@ class MigrateNullWikiAccessLevels < ActiveRecord::Migration
...
@@ -5,6 +5,8 @@ class MigrateNullWikiAccessLevels < ActiveRecord::Migration
DOWNTIME
=
false
DOWNTIME
=
false
disable_ddl_transaction!
class
ProjectFeature
<
ActiveRecord
::
Base
class
ProjectFeature
<
ActiveRecord
::
Base
include
EachBatch
include
EachBatch
...
@@ -15,6 +17,13 @@ class MigrateNullWikiAccessLevels < ActiveRecord::Migration
...
@@ -15,6 +17,13 @@ class MigrateNullWikiAccessLevels < ActiveRecord::Migration
ProjectFeature
.
where
(
wiki_access_level:
nil
).
each_batch
do
|
relation
|
ProjectFeature
.
where
(
wiki_access_level:
nil
).
each_batch
do
|
relation
|
relation
.
update_all
(
wiki_access_level:
20
)
relation
.
update_all
(
wiki_access_level:
20
)
end
end
# We need to re-count wikis as previous attempt was not considering the NULLs.
transaction
do
execute
(
'SET LOCAL statement_timeout TO 0'
)
if
Gitlab
::
Database
.
postgresql?
# see https://gitlab.com/gitlab-org/gitlab-ce/issues/48967
execute
(
"UPDATE site_statistics SET wikis_count = (SELECT COUNT(*) FROM project_features WHERE wiki_access_level != 0)"
)
end
end
end
def
down
def
down
...
...
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