Slide 16
Slide 16 text
ENUM
の
migration
が使いやすくなる
before
execute <<-SQL
CREATE TYPE status AS ENUM ('draft', 'published', 'archived', 'trashed');
SQL
create_table :articles do |t|
t.column :current_status, :status
end
after
change_table :articles do |t|
t.enum :current_status, enum_type: "status", default: "draft", null: false
end
create_enum :status, %w[draft published archived trashed]
@nyo_taro