RushOrm
RushOrm copied to clipboard
Change/remove the prefix of the default tables
Is there a way to change the prefix of the default tables? I'm referring to RushTextFile, RushJSONFile and RushBitmapFile that are always prefixed with "rush_co_uk_rushorm_core_" or "rush_co_uk_rushorm_android"
You could extend them and name your class as you want. No need to implement any code. Then add @RushCustomTableName(name = "TableName") to your new classes.
Would that solve your problem?
Cheers
But wouldn't the tables RushTextFile, RushJSONFile and RushBitmapFile with the prefix also be created (alongside with my extended classes)?
Yes true, but I would suggest that going to to production you would want to set the exact list of classes rather that let them be discovered this will give better performance and solve this issue for you.
Just initialize like this.
List<Class<Rush>> classes = ArrayList<>();
// Add classes
classes.add(Example.class);
...
AndroidInitializeConfig config = new AndroidInitializeConfig(getApplicationContext());
config.setClasses(classes);
RushCore.initialize(config);
Thanks
On a side note, why are the prefixes an issue for you?
Thanks, I'll try that. It's not an issue, but I don't really like the tables to be prefixed with the package name, they can get an awfully long name and only makes it harder to read (I'm using Stetho to debug).