make migrations reversible

This commit is contained in:
Valery Sizov 2015-11-05 16:41:03 +02:00
parent 4f574388fc
commit aecc4376e2
3 changed files with 13 additions and 3 deletions

View file

@ -1,5 +1,9 @@
class FixBuildTags < ActiveRecord::Migration
def change
def up
execute("UPDATE taggings SET taggable_type='CommitStatus' WHERE taggable_type='Ci::Build'")
end
def down
execute("UPDATE taggings SET taggable_type='Ci::Build' WHERE taggable_type='CommitStatus'")
end
end

View file

@ -1,5 +1,8 @@
class FailBuildWithoutNames < ActiveRecord::Migration
def change
def up
execute("UPDATE ci_builds SET status='failed' WHERE name IS NULL AND status='pending'")
end
def down
end
end

View file

@ -1,5 +1,8 @@
class FailBuildWithEmptyName < ActiveRecord::Migration
def change
def up
execute("UPDATE ci_builds SET status='failed' WHERE (name IS NULL OR name='') AND status='pending'")
end
def down
end
end