TimGoulain / tim_app

ruby on rails tutorial
0 stars 0 forks source link

Problème pour le déploiement sur Heroku (erreur dans le rake db:migrate) #24

Closed TimGoulain closed 9 years ago

TimGoulain commented 9 years ago

Yo! j'ai un vrai problème cette fois (pas comme le http d'hier...) : quand je veux lancer un heroku run db:migrate, il me dit :

Migrating to DropTableMicroposts (20150912072128)
== 20150912072128 DropTableMicroposts: migrating ==============================
-- drop_table(:microposts)
PG::UndefinedTable: ERROR:  table "microposts" does not exist
: DROP TABLE "microposts"
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

PG::UndefinedTable: ERROR:  table "microposts" does not exist

Or, c'est vrai que je n'avais pas de migration "CreateMicroposts", mais je l'avais dans mon schema.rb ...

J'ai la migration suivante :

class DropTableMicroposts < ActiveRecord::Migration
  def up
    drop_table :microposts
  end

  def down
    create_table "microposts", force: true do |t|
      t.text     "content"
      t.integer  "user_id"
      t.datetime "created_at"
      t.datetime "updated_at"
    end
  end
end

Est-ce que tu vois ce qui merde?

TimGoulain commented 9 years ago

En fait, solution donnée ici par Rakibul Islam: http://stackoverflow.com/questions/32168182/pgundefinedtable-error-table-table-name-does-not-exist

Try: heroku run rake db:schema:load and then try running the migration again: heroku run rake db:migrate – K M Rakibul Islam Aug 23 at 16:01

ça a l'air de marcher!