Can i do an sql update in a rails migration?

To answer your original question, you can use exec to run arbitrary
sql statements. SQLite does not allow the modification of a column
once it's added to a table, so if you must change the definition of a
column (like change it from a varchar to a text), you have to do all
of the raw sql of creating a temp table, copying the data, dropping
the table, recreating the table, copying the data back, and then
dropping the temp table. I do all of that with exec.