On Tue, Feb 16, 2016 at 9:51 PM, Roger Binns <rogerb at rogerbinns.com> wrote: > The way I (and many others) do it is to use the user_version. It is > an integer that starts out as zero, and can be read or written with > pragma user_version. Startup code then looks like this: > > if user_version()==0 { > BEGIN; > CREATE TABLE ....; > CREATE INDEX ....; > pragma user_version=1; > COMMIT; > }
Thank you guys for opening my mind on the usage of pragmas. The next question is: do I have a way to conditionally place the pragma test into an sql file to make sqlite apply it? The above syntax does not look familiar to me, and in the meantime I've wrapped the user_version pragma get/set into a shell script. Thanks, Luca