lundi 30 novembre 2015

Multiple ALTER column queries in SQLite with SQLAlchemy

I need to make some of the columns NOT NULL in the tables in my database. I only then discovered that SQLite has limited ALTER support, and the common workaround is to create a duplicate table and copy the data over.

However this would be a very time consuming task due to the large number of tables I need to change. Since all I'm changing in my SQLAlchemy models is adding nullable=False to the column definitions, is there a simple way to apply the change to the current database? I'm working under the assumption that there are no null values in the columns.

Aucun commentaire:

Enregistrer un commentaire