summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Artur <felipefac@gmail.com>2017-09-14 14:27:18 -0300
committerFelipe Artur <felipefac@gmail.com>2017-09-14 14:27:18 -0300
commit0b022b50df48206e8659994881a84bafa5ea00db (patch)
treeb02be94e58294ce22c66425c606421a4dc8d659d
parent7733e8c3784a926e98ca54a4e29339a843af05f2 (diff)
downloadgitlab-ce-issue_37640_9_5_stable.tar.gz
-rw-r--r--db/post_migrate/20170913150359_change_project_id_to_not_null_in_project_features.rb15
-rw-r--r--db/post_migrate/20170913180600_fix_projects_without_project_feature.rb6
-rw-r--r--db/schema.rb2
3 files changed, 6 insertions, 17 deletions
diff --git a/db/post_migrate/20170913150359_change_project_id_to_not_null_in_project_features.rb b/db/post_migrate/20170913150359_change_project_id_to_not_null_in_project_features.rb
deleted file mode 100644
index 20531c3fe29..00000000000
--- a/db/post_migrate/20170913150359_change_project_id_to_not_null_in_project_features.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-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
diff --git a/db/post_migrate/20170913180600_fix_projects_without_project_feature.rb b/db/post_migrate/20170913180600_fix_projects_without_project_feature.rb
index 76e75837304..bfa9ad80c7d 100644
--- a/db/post_migrate/20170913180600_fix_projects_without_project_feature.rb
+++ b/db/post_migrate/20170913180600_fix_projects_without_project_feature.rb
@@ -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)
}
diff --git a/db/schema.rb b/db/schema.rb
index 04680f5ddf6..863a84242e8 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -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"