更新我的宝石后,我无法运行rails db:schema:load
.报告的错误是:
ActiveRecord::MismatchedForeignKey: Column `user_id` on table
`user_applications` has a type of `int(11)`.
This does not match column `id` on `users`, which has type
`bigint(20)`.
这与从 rails 5.2(或 rails 5.1,我不知道(更改主键的一些默认 int 类型有关。我的问题是:我应该如何"迁移"数据库/模式?或者,我可以将主键设置为 32 位整数吗?因为我已经在application.rb
尝试过:
config.generators do |generator|
generator.orm :active_record, primary_key_type: :integer
end
但是在运行上述任务时它没有做任何事情。
移动旧方案文件并创建一个新方案文件:
$ rails db:schema:dump