使用database.yml链接外部mysql数据库后,还安装了mysql2和activerecord-mysql2-adapter gems。
当我运行rails db:schema:dump
Schema看起来像这样。
Schema.rb
# This file is auto-generated from the current state of the database. Instead of editing this file, please use the migrations feature of Active Record to incrementally modify your database, and then regenerate this schema definition. Note that this schema.rb definition is the authoritative source for your database schema. If you need to create the application database on another system, you should be using db:schema:load, not running all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations you'll amass, the slower it'll run and the greater likelihood for issues).
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 0) do
# Could not dump table "employees" because of following NoMethodError
# undefined method `sql_type' for "int(11)":String
end
当我运行rails db:schema:dump
:
/home/admin/.rvm/gems/ruby-2.4.2/gems/activerecord-mysql2-adapter-0.0.3/lib/active_record/connection_adapters/mysql2_adapter.rb:606: warning: constant ::Fixnum is deprecated
的database.yml
development: &default
adapter: mysql2
encoding: utf8
pool: 5
host: localhost
username: Ruby
password: *****
port: 3306
socket: /var/lib/mysql/mysql.sock
database: rubyappdb
答案 0 :(得分:0)
问题在于activerecord-mysql2-adapter gem。 在Gemfile中注释并运行bundle install解决了这个问题。 我希望将来不会出现任何问题。