wikicr/db/migrations/20211014213500_create_pages.cr
Arthur Poulet e9bb1cbdc0
Some checks failed
continuous-integration/drone/push Build is failing
spike: try to install & migrate to lucky
2021-10-15 18:44:23 +02:00

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