Rake db: reset is not populated with data

My environment -> Ruby 1.9.2 and Rails v3.0.5

I noticed a strange model in rake db: reset. According to the rails source code, rake db: reset will => db: drop, db: create and db: migrate. https://github.com/rails/rails/blob/v3.0.5/activerecord/lib/active_record/railties/databases.rake#L159

Settings: One of my migration files has Model.create instructions for filling in some data (Forgive me, I'm not the one who put the data filling code in these migrations :) ..)

Case 1: When I do the steps manually, I mean drop, create and migrate, one after another - these statements populate the data in the table.

Case 2: When I just rake db: reset, the circuit is set correctly. but the data is not in db. Does db: reset skip create / update instructions. I tried this several times to make sure that I have no errors in my actions. I am still getting this behavior.

what's wrong here ...?

+4
source share
2 answers

I think you are reading the wrong line in the source. When I read:

db:migrate:reset # => [:drop, :create, :migrate]

db:reset # => [:drop, :setup]

So db:reset just create the tables and set the migration as if they were running, without actually starting them. db:migrate:reset performs each migration.

+13
source

I had the same problem before, but I started 3.0.3, and it turns out that I manage to spoil the migration by changing the migration files and not starting the migration (forgot about it or something like that) ... I'll start with checking these files

0
source

All Articles