# How to update table column?

**URL:** <https://www.ruby-forum.com/t/how-to-update-table-column/156634>\
**Category:** Rails\
**Created:** [December 31, 2008, 6:21am UTC](https://www.ruby-forum.com/t/how-to-update-table-column/156634 "2008-12-31T06:21:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![youhaodeyi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/b9bd4f/32.png) [@youhaodeyi](https://www.ruby-forum.com/u/youhaodeyi)\
**Post date:** [December 31, 2008, 6:21am UTC](https://www.ruby-forum.com/t/how-to-update-table-column/156634/1 "2008-12-31T06:21:04Z")

</div>

There is a table existed in sqlite3 database. I want to change a column  
type in this table. I modified the file  
db/migrate/20081229XXXX\_create\_project.rb and run “rake db:migrate”. But  
it doesn’t update the table. How can I update the table with the new  
definition.

---

<div class="post-metadata">

**Author:** ![youhaodeyi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/b9bd4f/32.png) [@youhaodeyi](https://www.ruby-forum.com/u/youhaodeyi)\
**Post date:** [December 31, 2008, 6:32am UTC](https://www.ruby-forum.com/t/how-to-update-table-column/156634/2 "2008-12-31T06:32:47Z")

</div>

Generally, don’t edit migrations. Instead, write a new one. See  
[rails.info](http://guides.rails.info/migrations.html) for more details.

Regards,  
Craig

On Wed, Dec 31, 2008 at 12:21 AM, Zhao Yi

---

<div class="post-metadata">

**Author:** ![youhaodeyi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/b9bd4f/32.png) [@youhaodeyi](https://www.ruby-forum.com/u/youhaodeyi)\
**Post date:** [December 31, 2008, 6:35am UTC](https://www.ruby-forum.com/t/how-to-update-table-column/156634/3 "2008-12-31T06:35:08Z")

</div>

Here’s a more specific URL:  
[rails.info](http://guides.rails.info/migrations.html#_changing_migrations) .

Craig

On Wed, Dec 31, 2008 at 12:31 AM, Craig D.

---

<div class="post-metadata">

**Author:** ![youhaodeyi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/b9bd4f/32.png) [@youhaodeyi](https://www.ruby-forum.com/u/youhaodeyi)\
**Post date:** [January 1, 2009, 2:41pm UTC](https://www.ruby-forum.com/t/how-to-update-table-column/156634/4 "2009-01-01T14:41:26Z")

</div>

Ramu wrote:

> Write a migration file with current version + 1  
> ex:
> 
> say your version number in database 1024
> 
> then create migrate file 1025\_job\_name.rb  
> run migrate  
> On Wed, Dec 31, 2008 at 11:04 AM, Craig D.  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)wrote:

Haven’t you switched to UTC timestamps migrations? That’s so easy to  
handle.

And avoid editing manually your migrations, the only exception is if you  
edit the last migration (if no data was added) and rollback then  
remigrate, but in mot cases avoid it.

---

<div class="post-metadata">

**Author:** ![youhaodeyi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/b9bd4f/32.png) [@youhaodeyi](https://www.ruby-forum.com/u/youhaodeyi)\
**Post date:** [January 1, 2009, 2:02pm UTC](https://www.ruby-forum.com/t/how-to-update-table-column/156634/5 "2009-01-01T14:02:34Z")

</div>

Write a migration file with current version + 1  
ex:

say your version number in database 1024

then create migrate file 1025\_job\_name.rb  
run migrate  
On Wed, Dec 31, 2008 at 11:04 AM, Craig D.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)wrote:

> > [rails.info](http://guides.rails.info/migrations.html) for more details.
> > 
> > > type in this table. I modified the file

–  
Ramu
