通过 ruby Rails 迁移添加 MySQL 枚举列时出现问题

Problem when adding a MySQL enum column via ruby Rails migration

我正在尝试添加一个 MySQL 枚举列:

# frozen_string_literal: true
class AddStatusToTasks < ActiveRecord::Migration[6.0]
  def up
    execute <<-SQL
        ALTER TABLE tasks ADD status enum('to_do', 'doing', 'done');
    SQL
  end
  def down
    remove_column :tasks, :status
  end
end

但我收到错误消息:

AddStatusToTasks: migrating =================================
-- execute("        ALTER TABLE tasks ADD status enum('to_do', 'doing', 'done');\n")
rails aborted!
StandardError: An error has occurred, this and all later migrations canceled:

SQLite3::SQLException: near "'to_do'": syntax error

我喜欢的模特是这样的:

class Task < ApplicationRecord
  belongs_to :user
  enum status: { to_do: 'to_do', doing: 'doing', done: 'done' }
end

我实际上是按照指南here,但我找不到问题。

在此先感谢大家的帮助!

SQLite3::SQLException -- 您正在 SQLite 数据库上执行此查询,而不是 MySQL。您使用的环境是否正确?