I've been trying to do a schema dump with a new Rails project using an existing MySQL database. Here's my setup in my database.yml file:
default: &default
adapter: mysql2
encoding: utf8
pool: 5
username: username_example
password: password_example
host: localhost
socket: /tmp/mysql.sock
development:
<<: *default
database: databasename
I added the following gems to my Gemfile and bundled:
gem 'mysql2'
gem 'activerecord-mysql2-adapter'
After using the command rake db:schema:dump
I get the following error in my schema file:
ActiveRecord::Schema.define(version: 0) do
# Could not dump table "tablename" because of following NoMethodError
# undefined method `type' for "text":String
end
Any ideas on how I could fix this would be much appreciated, thanks!
I discovered it was the MySql version that was messing up the dump. I also removed the activerecord mysql adaptor I changed my gemfile and the dump worked perfectly:
gem 'mysql2', '~> 0.3.13'
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.