简体   繁体   中英

Error trying to migrate PG database hosted on Heroku -Rails

Im getting this error when running heroku run rake db:migrate -> ERROR: column "frequency" cannot be cast automatically to type integer I'm not sure what I'm supposed to do in order to fix this error. Here is my schema local that works fine when I migrated:

schema:

create_table "assignments", force: :cascade do |t|
    t.string   "name"
    t.string   "description"
    t.integer  "account_id"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string   "attachment"
    t.integer  "finished_count"
    t.datetime "start_at"
    t.datetime "end_at"
    t.integer  "frequency"
    t.integer  "status",         default: 0
    t.index ["status"], name: "index_assignments_on_status"
  end

Cannot I not use integer as a type with PG? if not, what should I do instead?

Without seeing your migration, which you should post. A likely cause is that the frequency column already has data in it. Therefore PG cannot blindly convert that data into a integer if it is not something that is like a number.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM