When I try to run the following code in Rails using Mysql2 as database manager:
rake db:migrate
I obtain the following error:
rake aborted!
"Mysql2::Error: All parts of a PRIMARY KEY must be NOT NULL:"
Why do I get this error, if the primary key in a table by default is NOT "null"?
Migration code, however :
class CreateUsers < ActiveRecord::Migration
def change
create_table :users do |t|
t.string "first_name"
t.timestamps
end
end
end
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…