mirror of
https://github.com/moebooru/moebooru
synced 2025-08-22 01:47:48 +00:00
11 lines
348 B
Ruby
11 lines
348 B
Ruby
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
|