Joaquin Llaneza
Joaquin Llaneza

Reputation: 451

I screw up the database and schema of my rails app, what should I do to rebuild database from my migration files?

My code is all OK, and it has all and only the migrations from which I want my database to be create, as I re-run them one bye one..

How should I do this.

my schema file is also screwed up.

thanks

Upvotes: 0

Views: 187

Answers (2)

Slobodan Kovacevic
Slobodan Kovacevic

Reputation: 6898

If your schema file is wrong you can drop your database with rake db:drop, then recreate it with rake db:create and finally run simple rake db:migrate to run all migrations you have (assuming that you have only migrations you want to run, i.e. you deleted others).

Upvotes: 1

Lazarus Lazaridis
Lazarus Lazaridis

Reputation: 6029

Run rake db:reset inside your rails root directory.

Upvotes: 0

Related Questions