ormlite-android icon indicating copy to clipboard operation
ormlite-android copied to clipboard

Generate Table Config File at First Run

Open jahd2602 opened this issue 12 years ago • 2 comments

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:

jahd2602 avatar Jul 12 '13 06:07 jahd2602

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 avatar Jul 12 '13 19:07 j256

@j256: status on this?

Macarse avatar Feb 21 '14 23:02 Macarse