具有预先存在的MySQL数据库的模式转储会导致NoMethodError



我一直在尝试使用现有的MySQL数据库对新的Rails项目进行模式转储。这是我在我的数据库.yml文件中的设置:

default: &default
  adapter: mysql2
  encoding: utf8
  pool: 5
  username: username_example
  password: password_example
  host: localhost
  socket: /tmp/mysql.sock
development:
  <<: *default
  database: databasename

我将以下宝石添加到我的宝石文件中并捆绑在一起:

gem 'mysql2'
gem 'activerecord-mysql2-adapter'

使用命令rake db:schema:dump后,我在架构文件中收到以下错误:

ActiveRecord::Schema.define(version: 0) do
# Could not dump table "tablename" because of following NoMethodError
#   undefined method `type' for "text":String
end

关于我如何解决此问题的任何想法将不胜感激,谢谢!

我发现是MySql版本弄乱了转储。我还删除了活动记录 mysql 适配器我更改了我的宝石文件,转储工作得很好:

gem 'mysql2', '~> 0.3.13'

最新更新