mardi 26 janvier 2016

Peewee adding columns on demand

I have an sqlite database which I use as a data storage file for an application I develop in python.

Now the development of new features requires me to define new fields in the database. Is there a way, with peewee, of loading a database file, which used the old table definition (without new field) without getting an SQLError: no such column error?

Like an automatic insertion of the new field with a default value in the database. This would make life a lot easier for having backwards compatibility with opening database files from previous versions.

Aucun commentaire:

Enregistrer un commentaire