26 lines
801 B
Crystal
26 lines
801 B
Crystal
class CreatePages::V20211014213500 < Avram::Migrator::Migration::V1
|
|
def migrate
|
|
# Learn about migrations at: https://luckyframework.org/guides/database/migrations
|
|
create table_for(Page) do
|
|
primary_key id : UUID
|
|
add_timestamps
|
|
add file_path : String, unique: true
|
|
add web_path : String, unique: true
|
|
add title : String
|
|
add slug : String
|
|
add toc : Array(String)
|
|
add keywords : Array(String)
|
|
add last_touched_at : Time
|
|
add_belongs_to created_by : User, on_delete: :nullify, foreign_key_type: Int64
|
|
add_belongs_to last_edited_by : User, on_delete: :nullify, foreign_key_type: Int64
|
|
end
|
|
|
|
create_index :pages, [:last_touched_at]
|
|
create_index :pages, [:keywords]
|
|
end
|
|
|
|
def rollback
|
|
drop table_for(Page)
|
|
end
|
|
end
|