[odb-users] Startup processes
Boris Kolpackov
boris at codesynthesis.com
Wed Dec 17 07:04:52 EST 2014
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
More information about the odb-users
mailing list