Never ever forget the importance of details.
Here's an example of why.
I wanted to drop the "default" setting for a column of type string. Rails' typical migrations do not have a convenient way of doing this, so I had to run an SQL command.
I admit that I at the time was not experienced with SQL. Nonetheless I went to http://api.rubyonrails.org/classes/ActiveRecord/Migration.html to find the answer. I found this:
Instead of copying and pasting and then editing appropriately, I typed it out... and failed to notice the appearance of the single-quotes. It's really better to just copy and paste so the tiniest details are taken care of... in this case, typing in ' does not work; you have to use `.
I really wish I had scrutinized every single character - particularly any quotes. It would have saved me quite some time.
The end result:
execute "ALTER TABLE `free_spaces` ALTER COLUMN `content` DROP DEFAULT"
No comments:
Post a Comment
Please be considerate in what you say.