Welcome Guest | Login

DB not migrating

Hi,

After my latest version deployment I need to re-migrate my database down to 0 and back up to current.
But my migration rakes are not doing anything. This may be an obvious newbie issue but here is what happens:

xxx@xxx [~/apps/{appname}/current]$ RAILS_ENV=production rake db:migrate version=0 --trace
(in /{path to current release})
** 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
xxx@xxx [~/apps/{appname}/current]$ RAILS_ENV=production rake db:migrate --trace
(in /{path to current release})
** 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
xxx@xxx [~/apps/{appname}/current]$

2008-07-05 03:06 PM

Hi Adeel,

It seems like that there is no further changes need to be migrated from rake commands. Could you please give a try by
setting the version in db migrate command as  

===
rake environment RAILS_ENV=production db:migrate VERSION=0
===

Also verify the version set in the file railsapp/db/schema.rb after executing the command.

The following wiki link will guide you to know more about the re-migrating and changing the version of mysql migration.
http://wiki.rubyonrails.org/rails/pages/UsingMigrations.

2008-07-05 03:49 PM

Thanks, it must have been the capitalized 'VERSION'.

Can you recommend the safest way to drop my entire database?
I know the best way is to just go down to VERSION=0 but since my latest code rev has some differences in the migrations, it fails at some point.

I'm on Rails 1.2.5. I know the latest Rails has a rake db:drop but I would imaging there is a way to do this through MYSQL.

After my database is dropped I want to run a fresh migration to get back to the latest migration.

2008-07-05 04:01 PM

Hi Adeel

>Can you recommend the safest way to drop my entire database?

You can drop the mysql database through your webmin --> MySQL Database Server --> Drop Selected Databases and create a new database from webmin --> MySQL Database Server --> Create a new database. I hope that you have necessary dump file or migrate scripts to populate a freshly created database.

2008-07-05 04:28 PM

Yes I have migrate scripts ready to deploy so that won't be a problem.

I'm in Webmin->Servers->MySQP Database Server but it does not show my app's database.

"Edit Database  
{my login name}
This database has no tables."

Then it shows buttons for "Create new table", "Create view", "Backup Database", "Execute SQL".

2008-07-05 04:56 PM

Hi Adeel,

Please verify if you can find your database in the path: Webmin->Servers->MySQL Database.

1) Select the check box of the required database which has to be deleted.

2) Click the button "Drop Selected Databases".

3) It will show a confirmation for deleting the database "Are you sure you want to drop the 1 selected databases?". Click the "DROP DATABASES" option.

In the location Webmin->Servers->MySQL Database there will be options like  { Select all. | Invert selection. | Create a new database. }

The databases will be displayed in green icons.

====
information_schema

mysql

etc..

=====

Under the databases icons there is a button called " Drop Selected Databases ".

2008-07-05 05:20 PM


Hello Guest! In order to post you must be an active client with us, please log in or sign up.