15 lines
362 B
Crystal
15 lines
362 B
Crystal
|
class CreatePostTags::V00000000000006 < Avram::Migrator::Migration::V1
|
||
|
def migrate
|
||
|
create table_for(PostTag) do
|
||
|
primary_key id : Int64 # NOTE: Should not have a primary key
|
||
|
|
||
|
add_belongs_to post : Post, on_delete: :restrict
|
||
|
add_belongs_to tag : Tag, on_delete: :restrict
|
||
|
end
|
||
|
end
|
||
|
|
||
|
def rollback
|
||
|
drop table_for(PostTag)
|
||
|
end
|
||
|
end
|