Hi,
I accidentally created a model with “rails generate model Category”
(also
creating migrate file) where I didn’t specify any fields. Then I run
rake
db:migrate to create the new table. Upon realising what I’d done, I run
“rails destroy model Category”. Then I run “rails generate model
Category
name:string user_id:integer” which created all the new files. Ofcourse
now
db:migrate wouldn’t work coz I forgot I’d created the category table
prior.
So, I thought I’d remove the old table and run rake db:reset. This
appeared
to create all the tales again, but it keeps creating the OLD category
table
- the one without any fields. I’ve tried dropping the database,
destroying
the model/ migrate files, rolling back the migration, db:shema:load/
db:create:all/ . But every time, even if there is no “create category
table” migrate file - it still creates the category table with no
fields.
Is this normal? I don’t know where it’s getting the schema from but it
can’t be reading only from my db:migrate files. Does it get them from
log
files when recreating the db, or does it look directly at the db and
rebuild. I want my database build purely from the files I’m looking at
in
my db/migrate folder. How do I do this?