[odb-users] Creating schema and adding tables without dropping data

Boris Kolpackov boris at codesynthesis.com
Thu Apr 21 11:53:41 EDT 2016

Hi Ella,

Ella Vishnevsky <ellav at checkpoint.com> writes:

> I wanted to implement the following scenario:
> 1. Check if sqlite db file exists:
> a.   Does not exist :
> i.     Create new file with all tables that have the "db object" pragma.
> b.   Exists:
> i.     Add the new tables without erasing data from old tables

The tricky part is to distinguish between "old" and "new" tables. There
are two ways you can do this:

1. Use ODB schema evolution support (Chapter 13). This way ODB will keep
   track of what's new/old (and more; like making changes to old tables,

2. Keep track of new tables manually by partitioning them into separate
   entries in the schema catalog (with the --schema-name option). You
   will then have to figure out "where" on the timeline your database
   is and apply the missing entries from the catalog (to achieve this
   in #1 ODB keeps track of the database schema version in a special


More information about the odb-users mailing list