[odb-users] Startup processes
Bourke-Martin, Brian
bbourke-martin at darkfield.com
Fri Dec 19 08:43:38 EST 2014
Hi Boris,
Thanks for the feedback, it's working great now! I have one followup
question which I do not seem to be able to divine from the documentation.
When I add the pragma line "#pragma db model version(1, 1)" to one of my
data models it seems to work ok, but the documentation seems to imply that
this line should be on *each* of my data models. When I try adding it to
another one, I get a error stating the "schema_version" relationship
already exists. So should the model version line be stated once per data
table or once per schema?
Thanks again!
Brian
On Wed, Dec 17, 2014 at 7:04 AM, Boris Kolpackov <boris at codesynthesis.com>
wrote:
>
> Hi Brian,
>
> Bourke-Martin, Brian <bbourke-martin at darkfield.com> writes:
>
> > 1) When my app first start and runs for the first time, is there a way we
> > can detect if the system is a virgin system?
>
> If you turn on schema evolution support (Chapter 13, "Database Schema
> Evolution") then ODB will indicate this situation as schema version 0.
>
>
> > 2) I would like to use the answer from 1) to conditionally run the
> > create_schema command. Is this a "good" way of doing this?
>
> Yes, that's the recommended way to do this. In fact, there is some
> sample code in Section 13.2, "Schema Migration" that does exactly
> that.
>
>
> > 3) When I do create the schema, is there a way of setting up the
> > permissions on tables (I am using sqlite and postgresql so this
> > questions is mostly just for postgresql).
>
> You can execute any additional SQL statements before and/or after
> creating the tables with the create_schema() call using the
> database::execute() function (Section 3.12, "Executing Native SQL
> Statements").
>
> Boris
>
--
Brian Bourke-Martin
Manager of Operations and Software
Dark Field Technologies
70 Robinson Boulevard
Orange, CT. 06477
www.darkfield.com
203.298.0731 ext. 212
More information about the odb-users
mailing list