Generate Table Config File at First Run
Hello,
I noticed that currently we have to create a Table Config File before launching the App and we have to update it everytime a change is made in the tables, as explained in the ORMLite Documentation.
The process isn't very programmer-friendly because is tedious and programmers love everything that works out of the box, so I thought of a way to get rid of the process by doing it automatically the first time the App is run.
Why? Because:
- No need to re-run another program everytime a change is made to the model (process the developer may forget)
- As the writeConfigFile() is run at the first run, it will process the tables currently in code, so the developer(s) can change the model without problems
- The process at startup may be slow, but it will run once, so it won't disturb the user the next times the App is run
This could be an additional option, maybe something like:
private DBHelper getHelper() {
if (databaseHelper == null) {
boolean shouldWriteConfigFileAtStartup = true;
databaseHelper =
OpenHelperManager.getHelper(this, DatabaseHelper.class, shouldWriteConfigFileAtStartup);
}
return databaseHelper;
}
I hope this helps to make ORMLite even better :smiley:
Good idea. Not sure if or why it never occurred to me before. Thanks. I'll see if I can get it into the next release.
@j256: status on this?