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

11 lines
348 B
Ruby
Raw Permalink Normal View History

class PostsAddParentId < ActiveRecord::Migration[5.1]
def self.up
execute "alter table posts add column parent_id integer references posts on delete set null"
execute "create index idx_posts_parent_id on posts (parent_id) where parent_id is not null"
end
def self.down
execute "alter table posts drop column parent_id"
end
end