8, :default => #" />
开发者

Porting a Rails 1.2 app, schema.rb generation messed up

开发者 https://www.devze.com 2023-02-08 12:15 出处:网络
rake db:schema:dump rake db:test:prepare All use the following generated schema.rb: t.column \"cost_per_license\", :decimal, :limit => 8, :default => #

rake db:schema:dump rake db:test:prepare

All use the following generated schema.rb:

t.column "cost_per_license", :decimal, :limit => 8, :default => #

Running rake db:migrate does not cause this problem as it only us开发者_如何学Goes the migration files (and not the resulting schema.rb)

Has anyone seen this in Rails 1.2? The following lines are generating this schema:

126_create_accounts.rb: t.column :cost_per_license, :decimal, :precision => 8, :scale => 2, :default => 0

I have tried Ruby 1.8.6, 1.8.7, and Rails 1.2.1, and 1.2.6 -- all schema.rb's generated have this same syntax error.


If you have a problem with the schema.rb produced, one hack is you can override module ActiveRecord class SchemaDumper and the method that is producing the particular line and just replace ':default => #' with ':default => 0'

for the root cause can you do a show create table on the particular table (if you are using mysql)? and is it dong that for all columns with a default value or just that cost_per_license one?


Figured it out:

There was a vendor/plugin (specifically spatial_adapter) that was monkey patching the SchemaDumper's table() function with a terribly old version of ActiveRecord's table() (either really old, or just really awful.)

0

精彩评论

暂无评论...
验证码 换一张
取 消