problem with decimal columns
Reported by Deleted User | July 23rd, 2008 @ 03:00 AM
I have the following in schema.rb:
t.decimal "balance", :precision => 8, :scale => 2, :default => 0.0
Strangely auto_migrations created the column in mysql as decimal(10,0).
Also, whenever I type rake db:auto:migrate auto migrations reports: "change_column("accounts", :balance, :decimal)" even though I have not changed schema.rb.
BTW I think auto_migrations is my favorite plugin ever... it's saved me tremendous amounts of time.
I'm using ubuntu hardy and mysql 5.1.
Comments and changes to this ticket
-
mileszs November 14th, 2008 @ 06:22 AM
I can confirm this issue. I am using SQLite3 (on Ubuntu Hardy, also, actually).
It appears that line 121 in lib/auto_migrations.rb is always evaluating to true on decimal fields for the attributes 'precision' and 'scale'. The expression 'fields_in_db[field].send(att)' is nil for precision and scale, every time.
I'm sorry to take it this far and then drop the ball. I will try to dig in further as soon as I can.
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป