Rake db: refuse to clean up old tables

My user migration looked like this:

class CreateUsers < ActiveRecord::Migration
  def change
    create_table :users do |t|
      t.string :login
      etc

      

It now looks like this:

class CreateUsers < ActiveRecord::Migration
  def change
    create_table :users do |t|
      t.string :username
      etc

      

Why am I seeing this?

rake db:drop
rake db:create
rake db:migrate
rails console
> User.new
+----+-------+------------------+---------------+-------------------+------------+------------+
| id | login | crypted_password | password_salt | persistence_token | created_at | updated_at |
+----+-------+------------------+---------------+-------------------+------------+------------+
|    |       |                  |               |                   |            |            |
+----+-------+------------------+---------------+-------------------+------------+------------+
1 row in set

      

I am using PostgreSQL.

0


source to share


1 answer


Increasing the user migration file name resolved the issue. My guess is that Rails was caching the content of the migration when I tried to change its content without changing the filename.



0


source







All Articles