Open
Description
When running bin/rake db:schema:load
in a project using activerecord-sqlserver-adapter, the process mostly works, with all the tables, indices, and so on being created. However, it fails at the last second with the following error:
rake aborted!
TypeError: can't cast ActiveRecord::ConnectionAdapters::SQLServer::Type::Data
/Users/rpowell/Code/REDACTED/db/schema.rb:13:in `<main>'
-e:1:in `<main>'
Caused by:
TypeError: TypeError
/Users/rpowell/Code/REDACTED/db/schema.rb:13:in `<main>'
-e:1:in `<main>'
Tasks: TOP => db:schema:load
(See full trace by running task with --trace)
where line 13 of schema.rb
is the outermost call to Schema.define
:
ActiveRecord::Schema.define(version: 2019_11_22_023524) do
Currently I work around this by running db:migrate
every time I need to set up a database from scratch, but the Rails team advises against this for a variety of sensible reasons, and I'd prefer to be able to use the Rails-endorsed approach of loading the schema directly.