2
0
mirror of https://github.com/moebooru/moebooru synced 2025-08-22 09:57:31 +00:00
moebooru/db/migrate/008_upgrade_forums.rb

16 lines
758 B
Ruby
Raw Normal View History

class UpgradeForums < ActiveRecord::Migration[5.1]
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"
end
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
end