After updating my gems, I'm not being able to run rails db:schema:load
. The error reported is:
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)`.
This has to do with some default int type for primary key change from rails 5.2 (or rails 5.1, I don't know). My question is: how should I "migrate" the db/schema? Or, can I set the primary key to be 32bit integer? Because I already tried in application.rb
:
config.generators do |generator|
generator.orm :active_record, primary_key_type: :integer
end
but it didn't do anything when running the aforementioned task.
移动旧的方案文件并创建一个新的方案文件:
$ rails db:schema:dump
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.