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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
0b022b50
Commit
0b022b50
authored
Sep 14, 2017
by
Felipe Artur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix migrations
parent
7733e8c3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
17 deletions
+6
-17
db/post_migrate/20170913150359_change_project_id_to_not_null_in_project_features.rb
...0359_change_project_id_to_not_null_in_project_features.rb
+0
-15
db/post_migrate/20170913180600_fix_projects_without_project_feature.rb
...te/20170913180600_fix_projects_without_project_feature.rb
+5
-1
db/schema.rb
db/schema.rb
+1
-1
No files found.
db/post_migrate/20170913150359_change_project_id_to_not_null_in_project_features.rb
deleted
100644 → 0
View file @
7733e8c3
class
ChangeProjectIdToNotNullInProjectFeatures
<
ActiveRecord
::
Migration
DOWNTIME
=
false
def
up
# Deletes corrupted project features
delete_project_features_sql
=
"DELETE FROM project_features WHERE project_id IS NULL"
execute
(
delete_project_features_sql
)
change_column_null
:project_features
,
:project_id
,
false
end
def
down
change_column_null
:project_features
,
:project_id
,
true
end
end
db/post_migrate/20170913180600_fix_projects_without_project_feature.rb
View file @
0b022b50
...
...
@@ -2,6 +2,10 @@ class FixProjectsWithoutProjectFeature < ActiveRecord::Migration
DOWNTIME
=
false
def
up
# Deletes corrupted project features
sql
=
"DELETE FROM project_features WHERE project_id IS NULL"
execute
(
sql
)
# Creates missing project features with private visibility
sql
=
%Q{
...
...
@@ -16,7 +20,7 @@ class FixProjectsWithoutProjectFeature < ActiveRecord::Migration
10 as snippets_access_level,
projects.created_at,
projects.updated_at
FROM
"projects"
FROM
projects
LEFT OUTER JOIN project_features ON project_features.project_id = projects.id
WHERE (project_features.id IS NULL)
}
...
...
db/schema.rb
View file @
0b022b50
...
...
@@ -1113,7 +1113,7 @@ ActiveRecord::Schema.define(version: 20170913180600) do
add_index
"project_authorizations"
,
[
"user_id"
,
"project_id"
,
"access_level"
],
name:
"index_project_authorizations_on_user_id_project_id_access_level"
,
unique:
true
,
using: :btree
create_table
"project_features"
,
force: :cascade
do
|
t
|
t
.
integer
"project_id"
,
null:
false
t
.
integer
"project_id"
t
.
integer
"merge_requests_access_level"
t
.
integer
"issues_access_level"
t
.
integer
"wiki_access_level"
...
...
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