我正在运行bundle exec rake db:create,然后绑定exec :migrate`‘,然后在迁移时遇到这个错误:
bundle exec rake db:migrate
== 20110125192211 InitialDigitizationWork: migrating ==========================
-- create_table(:digitizations)
-> 0.0170s
-- add_index(:digitizations, :submission_code, {:unique=>true})
-> 0.0156s
-- create_table(:digitized_pieces)
-> 0.0180s
-- add_index(:digitized_pieces, :digitization_id)
-> 0.0113s
-- create_table(:digitized_views)
-> 0.0235s
-- add_index(:digitized_views, :digitized_piece_id, {:null=>false})
rake aborted!
StandardError: An error has occurred, all later migrations canceled:
Unknown key: :null. Valid keys are: :unique, :order, :name, :where, :length, :internal, :using, :algorithm,这是我第一次使用Mysql (我习惯了Postgresql),我似乎有Mysql:
mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 31
Server version: 5.7.20 Homebrew这是我的database.yml文件:
development:
adapter: mysql2
database: arthouse_dev
username: root
password:
host: localhost
port: 3306
#socket: /tmp/mysql.sock
legacy_development:
adapter: mysql2
database: arthouse_leg_development
username: root
password:
host: localhost
port: 3306发布于 2019-02-05 22:52:25
我相信这只是一个错误,您不能让null: false作为索引。
发布于 2017-11-01 23:19:16
不能将default: null约束添加到索引中,所看到的错误显式地说明如下:
未知键::null。有效的密钥是::唯一的,:order,:name,:where,:length,:unique,:using,:algorithm
删除这些索引上的默认null,您应该会没事的。
https://stackoverflow.com/questions/47064783
复制相似问题