Background
I have been working with a couple mobile applications that are based on the same sqlite database structure, but run in different languages. You guessed it, ObjC(iOS) and Java(Android) are involved. In the interest of data sharing and interoperability, I want to standardize this schema (there are casing differences, table naming differences, structural differences, etc). As a bonus, I want to be able to check some sort of schema representation into source control and control distinct releases of the schema.
The Problem
While I understand that a created instance of a sqlite database contains schema information, I am not convinced that the distribution of a blank sqlite database is the best way to share that schema. Android, for example, advocates the use of a helper that programmatically creates and/or upgrades the sqlite database.
But if I have code building/upgrading the database, then it seems to force the maintenance of a programmatic schema for every language.
The Question
Are there other options or approaches (beyond a pre-built, metadata-including, blank sqlite database) that would share and standardardize a schema between multiple languages? What might those be? Are these options storable in source control? automatable between multiple platforms?
Any insight is greatly appreciated. We can limp along with one-off versions, but there must be a better way…
As is often the case when I ask questions, I then scour the web for further leads. It appears that there may be a way to execute multi-line sqlite “scripts”: SQLite – Run multi-line SQL script from file?
Just need to verify that i can have static “create” script, and “update” scripts, distribute the script, and have the various platforms use this for initialization…
I will update this answer with my findings.
Update
So yeah…with a bit of management, i can have batch scripts that run
sqlite3_execorexecSqlfor each line of a file. Thus i have my scripts in source control as valid sqlite statements. Should be a viable solution…and pretty obvious now that i think about it more.