zas*_*man 3 ruby postgresql ruby-on-rails heroku database-migration
我的应用程序在生产中运行良好,但是当我转移到生产并运行“heroku run rake db:migrate”时,出现以下错误:
PG::UndefinedTable: ERROR: table "applications" does not exist
Migrating to DropApplications (20160509013805)
(0.8ms) BEGIN
== 20160509013805 DropApplications: migrating =================================
-- drop_table(:applications)
(1.1ms) DROP TABLE "applications"
(0.5ms) ROLLBACK
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
PG::UndefinedTable: ERROR: table "applications" does not exist
: DROP TABLE "applications"
Run Code Online (Sandbox Code Playgroud)
但是,我的数据库中有一个“应用程序”表。这次下降可能与我前几天下降然后重新制作应用程序脚手架有关。我该如何解决?
create_table "applications", force: :cascade do |t|
t.string "name"
t.string "gender"
t.date "date_of_birth"
t.string "gpa"
t.text "essay"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
Run Code Online (Sandbox Code Playgroud)
因此,当我运行 run rake:db setup 时,我看到以下结果:
Status Migration ID Migration Name
--------------------------------------------------
up 20160505200754 ********** NO FILE **********
up 20160508234634 Create users
up 20160508234945 Add devise to users
up 20160509013805 ********** NO FILE **********
up 20160509014328 ********** NO FILE **********
20160509014911 Create applications
Run Code Online (Sandbox Code Playgroud)
我试图删除“创建应用程序”之前的两个。因此,我尝试像这样 rake heroku db: $ heroku run rake --trace db:migrate VERSION=20151127134901 但我仍然收到“删除表”的错误 - 它试图执行 20160509013805 迁移。如何完全删除那些没有文件的迁移,这样它就不会尝试抓取这些迁移?先感谢您。
| 归档时间: |
|
| 查看次数: |
3022 次 |
| 最近记录: |