luckybooru/db/migrations/00000000000001_create_users.cr

17 lines
473 B
Crystal

class CreateUsers::V00000000000001 < Avram::Migrator::Migration::V1
def migrate
create table_for(User) do
primary_key id : Int64
add name : String, unique: true
add encrypted_password : String # NOTE: Should really be called 'password_hash'
add email : String, unique: true # NOTE: Should be nilable, but Carbon::Emailable doesn't really support it
add created_at : Time
end
end
def rollback
drop table_for(User)
end
end