Archive for the ‘Rails’ Category

Rails: reset devel db migrations

January 16, 2007

Doh! I figured this should be easy to do, now I finally found the right method – these two steps completely reload the migrations from scratch in the development environment:

% rake db:migrate VERSION=0 && rake db:migrate

Advertisements

Upgrading to MySQL 4.1 with Rails

November 29, 2006

In a Rails app, I’m using ActiveRecord::Extensions to get faster load times of a large set of records. This requires a new feature in MySQL 4.1, supporting the ‘ON DUPLICATE KEY UPDATE …’ statement. I previously had MySQL 4.0 installed (ubuntu breezy badger). Here’s what I did to update:

sudo apt-get install mysql-server-4.1 mysql-client-4.1

After that, tried to do some operation in rails, and it failed:

Mysql::Error: Lost connection to MySQL server during query: ....

That problem had a simple fix:

 sudo gem install mysql

The ruby mysql gem had to be rebuilt with the new mysql libs, then everything was peachy!