summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorValery Sizov <valery@gitlab.com>2015-05-12 09:51:14 +0000
committerValery Sizov <valery@gitlab.com>2015-05-12 09:51:14 +0000
commit071f07b6739beb405e32433504a46f33d209212e (patch)
treeb8ff23c2b71f8ec73aed8499b55db837fffde932 /db
parent4a373be8617814f74fa1bfa99740daecc4fe8278 (diff)
parent3e6181db143e62c471da98d6474730c512a591c3 (diff)
downloadgitlab-ce-071f07b6739beb405e32433504a46f33d209212e.tar.gz
Merge branch 'fix_migration' into 'master'
Make migrations reversible /cc @jacobvosmaer @marin See merge request !622
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20150423033240_add_default_project_visibililty_to_application_settings.rb6
-rw-r--r--db/migrate/20150429002313_remove_abandoned_group_members_records.rb5
2 files changed, 9 insertions, 2 deletions
diff --git a/db/migrate/20150423033240_add_default_project_visibililty_to_application_settings.rb b/db/migrate/20150423033240_add_default_project_visibililty_to_application_settings.rb
index 9b0f13f3fa7..50a9b2439e0 100644
--- a/db/migrate/20150423033240_add_default_project_visibililty_to_application_settings.rb
+++ b/db/migrate/20150423033240_add_default_project_visibililty_to_application_settings.rb
@@ -1,7 +1,11 @@
class AddDefaultProjectVisibililtyToApplicationSettings < ActiveRecord::Migration
- def change
+ def up
add_column :application_settings, :default_project_visibility, :integer
visibility = Settings.gitlab.default_projects_features['visibility_level']
execute("update application_settings set default_project_visibility = #{visibility}")
end
+
+ def down
+ remove_column :application_settings, :default_project_visibility
+ end
end
diff --git a/db/migrate/20150429002313_remove_abandoned_group_members_records.rb b/db/migrate/20150429002313_remove_abandoned_group_members_records.rb
index 6013605bb35..244637e1c4a 100644
--- a/db/migrate/20150429002313_remove_abandoned_group_members_records.rb
+++ b/db/migrate/20150429002313_remove_abandoned_group_members_records.rb
@@ -1,6 +1,9 @@
class RemoveAbandonedGroupMembersRecords < ActiveRecord::Migration
- def change
+ def up
execute("DELETE FROM members WHERE type = 'GroupMember' AND source_id NOT IN(\
SELECT id FROM namespaces WHERE type='Group')")
end
+
+ def down
+ end
end