module Pon::Migrator

Overview

DB migration tool that prepares a table for the class

class User < Pon::Model
  adapter mysql
  field name : String
end

User.migrator.migrate!
# => "DROP TABLE IF EXISTS `users`;"
# => "CREATE TABLE `users` (id BIGSERIAL PRIMARY KEY, name VARCHAR(255));"

User.migrator(table_options: "ENGINE=InnoDB DEFAULT CHARSET=utf8").create
# => "CREATE TABLE ... ENGINE=InnoDB DEFAULT CHARSET=utf8;"

Defined in:

pon/migrator.cr