SQLite Modify Column

Posted by Nathan on Stack Overflow See other posts from Stack Overflow or by Nathan
Published on 2010-04-21T19:17:22Z Indexed on 2010/04/21 19:23 UTC
Read the original article Hit count: 381

Filed under:
|

I need to modify a column in a SQLite database but I have to do it programatically due to the database already being in production. From my research I have found that in order to do this I must do the following.

  • Create a new table with new schema
  • Copy data from old table to new table
  • Drop old table
  • Rename new table to old tables name

That seems like a ridiculous amount of work for something that should be relatively easy. Is there not an easier way? All I need to do is change a constraint on a existing column and give it a default value.

© Stack Overflow or respective owner

Related posts about sqlite

Related posts about alter-table