Re: rake db:migrate does nothing

Ambrose
Wed, 04 Jul 2007 20:00:25 -0000

Thanks Niels

I tried creating a new migration but once again it didn''t fail but
also did not create the table.

The schema says I am on version 3 though I have tried 2 more
migrations that have not happened. If I roll back now I will roll back
to version 2 and lose a table with some test data. No big deal I
guess.

Is it your expectation that I will then be able to successfully
perform migrations once again? I''ll try and see.

Thanks

Ambrose

On Jul 4, 12:53 pm, Niels Meersschaert
<nmeersscha...-ee4meeAH724@public.gmane.org>
wrote:
> You need to either create a new migration or roll back to the
> migration before the one you are editing. If you look in your db you
> will see a table called schema info. This has a single row with a
> column showing the version of your migration.
>
> If you are still developing it is fine to edit the migration, bit if
> you are in production the rollback could remove data so the safest
> approach is to generate a new migration.
>
> Niels
>
> Sent from my iPhone
>
> On Jul 4, 2007, at 3:21 PM, Ambrose
<ambrose.merr...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
> wrote:
>
>
>
> > Very strange.
>
> > I have created a couple of models, edited the migration files and run
> > rake db:migrate and voila, the new table is created.
>
> > Now I come to create a 3rd model, edit the migration file:
>
> > class CreateResumes < ActiveRecord::Migration
> >  def self.up
> >    create_table :resumes do |t|
> >      # t.column :name, :string
> >      t.column :institution, :string
> >      t.column :user_id, :integer
>
> >    end
> >  end
>
> >  def self.down
> >    drop_table :resumes
> >  end
> > end
>
> > and run rake db:migrate and it doesn''t fail it just does
nothing, it
> > creates no new table.
>
> > C:\work\1hh-b>rake db:migrate -t
> > (in C:/work/1hh-b)
> > ** 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
>
> > C:\work\1hh-b>
>
> > Other rake commands work fine such as rake annotate_models.
>
> > This isn''t the first time this has happened. It usually
happens after
> > I have done a few migrations. Because I am a noob and building simple
> > test apps I just start a new project, copying over what I have done to
> > date and rake db:migrate works fine. But it isn''t a
satisfactory
> > solution.
>
> > Any suggestions would be great.
>
> > Thanks
>
> > Ambrose