OK, Collin,
Thanks to that migrations link you posted last time, I saw another
format, the old C-style coding as opposed to the new Rails-DSL-
style. Below is the migration code, the db:migration script
execution and the results in the database. You don't need to look at
all that stuff. I just added to show that the old style does work and
pique your curiosity that the new styles don't seem to.
Again, Colin, thanks for all your help on this and other programming
"hardships".
== execution results ===
• This format works:
class ChangeExpenseTblAmountCol < ActiveRecord::Migration
def self.up
change_column( "expenses", "amount", "decimal(10, 2)" )
end
def self.down
end
end
• Apply the migration
K:\_Projects\Ruby\_Rails_Apps\_EIMS\RTS>rake db:migrate
(in K:/_Projects/Ruby/_Rails_Apps/_EIMS/RTS)
== ChangeExpenseTblAmountCol: migrating
======================================
-- change_column("expenses", "amount", "decimal(10, 2)")
-> 0.7030s
== ChangeExpenseTblAmountCol: migrated (0.7190s)
=============================
K:\_Projects\Ruby\_Rails_Apps\_EIMS\RTS>
• Testing the database confirms it:
mysql> describe expenses;
+------------+---------------
| Field | Type
+------------+---------------
| id | int(11)
| purpose | varchar(255)
| vendor | varchar(255)
| type | varchar(255)
| date | date
| amount | decimal(10,2) [snip]
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No comments:
Post a Comment