class AddEndTimeToChangesets < ActiveRecord::Migration
def self.up
# swap the boolean closed-or-not for a time when the changeset will
# close or has closed.
add_column(:changesets, :closed_at, :datetime, :null => false)
class AddEndTimeToChangesets < ActiveRecord::Migration
def self.up
# swap the boolean closed-or-not for a time when the changeset will
# close or has closed.
add_column(:changesets, :closed_at, :datetime, :null => false)
# it appears that execute will only accept string arguments, so
# this is an ugly, ugly hack to get some sort of mysql/postgres
# independence. now i have to go wash my brain with bleach.
execute("update changesets set closed_at=(now()-'1 hour'::interval) where open=(1=0)")
execute("update changesets set closed_at=(now()+'1 hour'::interval) where open=(1=1)")
# it appears that execute will only accept string arguments, so
# this is an ugly, ugly hack to get some sort of mysql/postgres
# independence. now i have to go wash my brain with bleach.
execute("update changesets set closed_at=(now()-'1 hour'::interval) where open=(1=0)")
execute("update changesets set closed_at=(now()+'1 hour'::interval) where open=(1=1)")
# the table.
remove_column :changesets, :open
# add a column to keep track of the number of changes in a changeset.
# could probably work out how many changes there are here, but i'm not
# sure its actually important.
# the table.
remove_column :changesets, :open
# add a column to keep track of the number of changes in a changeset.
# could probably work out how many changes there are here, but i'm not
# sure its actually important.
- add_column(:changesets, :num_changes, :integer,
+ add_column(:changesets, :num_changes, :integer,