Shane T
Shane T

Reputation: 212

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

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 uses 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.

Upvotes: 0

Views: 222

Answers (2)

Shane T
Shane T

Reputation: 212

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.)

Upvotes: 1

Kalendae
Kalendae

Reputation: 2244

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?

Upvotes: 1

Related Questions