Charles Murray
Charles Murray

Reputation: 383

RoR migration mysql2 gem

I'm going through a RoR tutorial, but when I try to run a migration it returns

...
*** About to add an index ***
--add_index("admin_users", "username")
rake aborted!
An error has occurred, all later migrations canceled:

invalid date

Looking around online it seems the problem is with the mysql2 gem and "add_index". How should I fix it? I tried uninstalling the mysql2 gem and changing the database.yml file to use mysql but it returned

"Please install the mysql adapter: 'gem install activerecord-mysql-adapter'" 

which it then couldn't find.

I'm using Windows Vista, Rails 3.2.1 and the mysql2 gem is 0.3.11 x86-mingw32 and the mysql gem is 2.8.1 x86-mingw32.

Upvotes: 0

Views: 224

Answers (1)

sameera207
sameera207

Reputation: 16629

We use mysql, just check if this setup works

in GEM file

gem 'rails', '2.3.2'
gem 'mysql', '2.7'

in database.yml

development:
  adapter: mysql
  encoding: utf8
  reconnect: false
  database: <database name>
  pool: 5
  username: <user name>
  password: <password>
  host: localhost

Upvotes: 1

Related Questions