Merge branch 'fix_migration' into 'master'

Make migrations reversible

/cc @jacobvosmaer @marin

See merge request !622
This commit is contained in:
Valery Sizov 2015-05-12 09:51:14 +00:00
commit 071f07b673
2 changed files with 9 additions and 2 deletions

View file

@ -1,7 +1,11 @@
class AddDefaultProjectVisibililtyToApplicationSettings < ActiveRecord::Migration class AddDefaultProjectVisibililtyToApplicationSettings < ActiveRecord::Migration
def change def up
add_column :application_settings, :default_project_visibility, :integer add_column :application_settings, :default_project_visibility, :integer
visibility = Settings.gitlab.default_projects_features['visibility_level'] visibility = Settings.gitlab.default_projects_features['visibility_level']
execute("update application_settings set default_project_visibility = #{visibility}") execute("update application_settings set default_project_visibility = #{visibility}")
end end
def down
remove_column :application_settings, :default_project_visibility
end
end end

View file

@ -1,6 +1,9 @@
class RemoveAbandonedGroupMembersRecords < ActiveRecord::Migration class RemoveAbandonedGroupMembersRecords < ActiveRecord::Migration
def change def up
execute("DELETE FROM members WHERE type = 'GroupMember' AND source_id NOT IN(\ execute("DELETE FROM members WHERE type = 'GroupMember' AND source_id NOT IN(\
SELECT id FROM namespaces WHERE type='Group')") SELECT id FROM namespaces WHERE type='Group')")
end end
def down
end
end end