I’ve decided to jump into Migrations before I get too far along on the
DB side of things.
I already have some tables built, and I went ahead and built the
migration that would have created them from scratch, and I made sure
that there was a self.down section to drop them. I wanted to verify
that I could roll back so I figured I would use rake to drop these
pre-existing tables before I recreated them.
Sure enough, if I run rake migrate, I get the error that says the tables
already exist. Great - that means rake can find my migration and the
“up” section is probably valid.
However, if I do
rake migrate VERSION=0
which I am understanding should undo the first migration, nothing
Here is the output of a trace:
C:\eclipse\workspace\eSimplyOnlineRails>rake -t migrate VERSION=0
** Invoke migrate (first_time)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
** Invoke db:schema:dump (first_time)
** Invoke environment
** Execute db:schema:dump
** Execute migrate
but my tables aren’t dropped.
Here’s my migration:
class CreateInitialSchema < ActiveRecord::Migration
…creates a bunch of tables
Does rake migrate VERSION=0 rollback the very FIRST migration?
What am I doing wrong?