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

Ella Vishnevsky ellav at checkpoint.com
Tue Jun 7 07:27:55 EDT 2016


Can you please explain again the second option?

-----Original Message-----
From: Boris Kolpackov [mailto:boris at codesynthesis.com] 
Sent: Thursday, April 21, 2016 6:54 PM
To: Ella Vishnevsky
Cc: odb-users at codesynthesis.com
Subject: Re: [odb-users] Creating schema and adding tables without dropping data

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,
   etc).

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
   table).

Boris

Email secured by Check Point.



More information about the odb-users mailing list