Updating sqLite records through migrations


#1

Here is probably a simple question for most of you, where I can’t seem
to update records in sqlite3 through a migration. Any suggestions
would be most appreciated…

With this code, nothing happens:

class AlterDataInDesigns < ActiveRecord::Migration
def self.up
execute “UPDATE designs SET name = ‘Liquid’ and file_name =
‘liquid’ WHERE id = ‘3’”
end

end

With this code, it changes the name to ‘0’??? (the difference is the
‘;’ added to the end)

class AlterDataInDesigns < ActiveRecord::Migration
def self.up
execute “UPDATE designs SET name = ‘Liquid’ and file_name =
‘liquid’ WHERE id = ‘3’;”
end

end


#2

SOLVED.

Due to my tunnel vision on the statement and missing the incorrect
‘and’, I see now the answer is.

execute “UPDATE designs SET name = ‘Liquid’, file_name =‘liquid’ WHERE
id = ‘3’”

It seems that I would have gotten an error on any of my incorrect
statements, but none were returned. Oh well.