2
0
mirror of https://github.com/moebooru/moebooru synced 2025-08-22 01:47:48 +00:00
moebooru/db/migrate/005_create_forum_post.rb
2018-03-10 18:15:56 +09:00

20 lines
512 B
Ruby

class CreateForumPost < ActiveRecord::Migration[5.1]
def self.up
execute(<<-EOS)
CREATE TABLE forum_posts (
id SERIAL PRIMARY KEY,
created_at TIMESTAMP NOT NULL,
updated_at TIMESTAMP NOT NULL,
title TEXT NOT NULL,
body TEXT NOT NULL,
creator_id INTEGER NOT NULL REFERENCES users ON DELETE CASCADE,
parent_id INTEGER REFERENCES forum_posts ON DELETE CASCADE
)
EOS
end
def self.down
execute("DROP TABLE forum_posts")
end
end