# Updating sqLite records through migrations

**URL:** <https://www.ruby-forum.com/t/updating-sqlite-records-through-migrations/160215>\
**Category:** Rails\
**Created:** [February 13, 2009, 3:08am UTC](https://www.ruby-forum.com/t/updating-sqlite-records-through-migrations/160215 "2009-02-13T03:08:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![yachtman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/d07c76/32.png) [@yachtman](https://www.ruby-forum.com/u/yachtman)\
**Post date:** [February 13, 2009, 3:08am UTC](https://www.ruby-forum.com/t/updating-sqlite-records-through-migrations/160215/1 "2009-02-13T03:08:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![yachtman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/d07c76/32.png) [@yachtman](https://www.ruby-forum.com/u/yachtman)\
**Post date:** [February 13, 2009, 3:32am UTC](https://www.ruby-forum.com/t/updating-sqlite-records-through-migrations/160215/2 "2009-02-13T03:32:55Z")

</div>

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.
