On 01 Aug 2018, at 20:40, Warren Young <war...@etr-usa.com> wrote: > On Aug 1, 2018, at 7:34 AM, Simon White <simonwh...@dciphercomputing.com> > wrote: >> >> I would like to suggest the addition of the "If not exists" to the Add >> Column feature of SQLite. > > I maintain an application that’s been through dozens of schema changes over > its nearly quarter century of life, so let me tell you what works for us: a DB > schema serial number. > > Any time the DB schema changes, we bump the schema version number and modify a > small program we include with the software that upgrades the schema. > > Each schema change is contained in a single function within this program, most > of which are just a simple CREATE or ALTER TABLE statement. A few are more > complex, moving data around or transforming it. > > If you upgrade the software on a machine running DB schema 5 to with software > that requires DB schema 8, there are 3 steps that, if performed in order, > always result in you running DB schema 8. This program simply calls those > three functions in sequence based on the old schema number and the current > schema number.
[snip] > Now the neat bit: SQLite already supports doing this with its user_version > feature: > > https://sqlite.org/pragma.html#pragma_user_version Yeah, I already also do all of this, although I don't use the pragma since, officially, they are unsupported. But I'd rather have the IF NOT EXISTS. -- Cheers -- Tim _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users