2018-03-10 10:15:56 +01:00
|
|
|
class UpgradeForums < ActiveRecord::Migration[5.1]
|
2014-11-08 23:02:46 +09:00
|
|
|
def self.up
|
|
|
|
execute "ALTER TABLE forum_posts ADD COLUMN reply_count INTEGER NOT NULL DEFAULT 0"
|
|
|
|
execute "ALTER TABLE forum_posts ADD COLUMN last_updated_by INTEGER REFERENCES users ON DELETE SET NULL"
|
|
|
|
execute "ALTER TABLE forum_posts ADD COLUMN is_sticky BOOLEAN NOT NULL DEFAULT FALSE"
|
2014-08-23 20:22:31 +09:00
|
|
|
execute "ALTER TABLE users ADD COLUMN last_seen_forum_post_id INTEGER REFERENCES forum_posts ON DELETE SET NULL"
|
2014-11-08 23:02:46 +09:00
|
|
|
end
|
2010-04-20 23:05:11 +00:00
|
|
|
|
2014-11-08 23:02:46 +09:00
|
|
|
def self.down
|
|
|
|
execute "ALTER TABLE forum_posts DROP COLUMN reply_count"
|
|
|
|
execute "ALTER TABLE forum_posts DROP COLUMN last_updated_by"
|
|
|
|
execute "ALTER TABLE forum_posts DROP COLUMN is_sticky"
|
|
|
|
execute "ALTER TABLE users DROP COLUMN last_seen_forum_post_id"
|
|
|
|
end
|
2010-04-20 23:05:11 +00:00
|
|
|
end
|