简体   繁体   中英

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM