Brian Palmer <br...@mozy.com> wrote: > Hey all, we've painted ourselves into a bit of a corner and we're > trying to find the best way out. Through an oversight during initial > development, we defined a column as not null in our schema and we > need to drop that not null constraint. > > Since sqlite3 doesn't support altering columns, I know the typical > way this is done is to create a new table and copy the data. However, > we have hundreds of thousands of sqlite databases on our servers > using this schema with large data sets, and it'd be a super expensive > operation to do. Logically, dropping a not null constraint shouldn't > be expensive at all, it's just a limitation of the current sqlite3 > language. So we're looking for alternatives.
There is an undocumented pragma pragma writable_schema=ON http://www.mail-archive.com/sqlite-users@sqlite.org/msg26998.html Once you set this, you can update sqlite3_master table, in particular its sql column. It should be safe to remove NOT NULL constraint this way. But be very careful: incorrect update would render the database unreadable. Igor Tandetnik _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users