migration and updating database

Hi, I have an application using ruby on rails 3 (rubystack). I'm on windows vista I want to update the database and here is what I get after typing rake db:seed --trace

(in C:/Users/dell/BitNami RubyStack Development projects/server) ** Invoke db:seed (first_time) ** Invoke db:abort_if_pending_migrations (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute db:abort_if_pending_migrations You have 10 pending migrations:   20110204225837 CreateApps   20110205005643 CreateRatings   20110205154017 CreateVestalVersions   20110205165712 CreateVisuals   20110205165923 AddAttachmentImageToVisual   20110206210830 CreateTargets   20110206210905 CreateAppTargets   20110209223713 CreatePermissions   20110209223746 CreateAppPermissions   20110209224341 CreateComments Run "rake db:migrate" to update your database then try again.

so as it seems that I have to migrate I type rake db:migrate --trace and this is what I get : (in C:/Users/dell/BitNami RubyStack Development projects/server) ** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute db:migrate == CreateApps: migrating

These are fairly old migrations (Feb 2011).

Maybe they had been run before in your database (and created the

table apps). Could you confirm that ?

You can check that the table ‘apps’ is there with going into your mysql

database and executing

show tables;

At the time (Feb 2011 ?) that will have left entries in the table “schema_migrations”.

You can check the current status with going into your

database (with $ mysql command) and executing:

SELECT * FROM schema_migrations;

I presume those older migrations 201102… are currently not in the schema_migrations list.

Maybe (??) someone has executed rake db:migration:down or

reverted the migrations in some other way and maybe that

step did not properly drop the table.

Could you print the content of the migration

$ cat db/migrate/20110204225837_create_apps.rb

In that case you could end-up with an inconsistency. The

table (apps) is still in the database, but the database thinks

the migration was never executed or was reverted.

This is only a possible scenario, not sure this is the actual

case in your system.

As a reference, this is how it should work if successful:

peterv@ASUS:~/data/temp/fancy$ cat db/migrate/20111025163743_create_apps.rb

class CreateApps < ActiveRecord::Migration

def change

create_table :apps do |t|

t.timestamps

end

end

end

peterv@ASUS:~/data/temp/fancy$ rake db:migrate

== CreateApps: migrating =====================================================

– create_table(:apps)

NOTICE: CREATE TABLE will create implicit sequence “apps_id_seq” for serial column “apps.id

NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index “apps_pkey” for table “apps”

→ 0.0099s

== CreateApps: migrated (0.0100s) ============================================

peterv@ASUS:~/data/temp/fancy$ psql fancy_development

psql (8.4.9)

Type “help” for help.

fancy_development=# select * from schema_migrations;

version