Search code examples
ruby-on-railsrakedbmigrate

Take a backup of rake db migration. and command denied for rake db:migrate rake aborted


I have db version 11. I want to move back to version 10 and add another version. But before that I want to take backup of version 11. How can I do that? I am using ruby 1.8.7 and rails 1.2.6.

rake db:migrate version=10

output: rake aborted! ActiveREcord::StatementInvalid: Mysql::Error SELECT command denied to user ''@'%' for column slot in table 'users'

Any help ?


Solution

  • That's a mighty old version of Rails you're using there!

    You want to run a down migration to go back to a previous version:

    rake db:migrate:down version=10
    

    To make a backup first, use the client utility for your database. For example, with MySQL:

    mysqldump -u username -p databasename > dumpfile.sql