Make migrations reversible

This commit is contained in:
Valery Sizov 2015-05-07 17:29:15 +03:00
parent 93a2cc095b
commit 3e6181db14
2 changed files with 9 additions and 2 deletions

View file

@ -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

View file

@ -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