Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
425 views
in Technique[技术] by (71.8m points)

Rails schema.rb gets corrupt after heroku g:pull

Every once in a while I pull down my production database if I need to debug an issue that I think is data related. Or, if I just need local access to new production data. To do this, I drop my local database and then pull in the db from heroku using

heroku pg:pull

This has always been reliable...until now. As of recently, this has been causing issue with schema.rb. Indexes (t.index) are being removed, and add_foreign_key are being removed...it seems to always be the same lines that are affected. Also, a specific table in schema is always modified...

# from
create_table "things", id: :serial, force: :cascade do |t|
...

# to
create_table "things", id: false, force: :cascade do |t|
  t.serial "id", null: false

There doesn't seem to be any such attribute "t.serial". I was trying to figure out if Rails 6.1 is doing this intentionally, but it just seems to be that my schema.rb is getting corrupted.

I'm wondering if anyone else has experienced this, or knows why this might be happening.

PS: A few years ago I changed this app from schema to structure, but for some reason (can't remember why) I needed to go back to schema.

Rails -v 6.1.0 Ruby -v 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-darwin19]


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...