RushOrm icon indicating copy to clipboard operation
RushOrm copied to clipboard

Change/remove the prefix of the default tables

Open JoniDS opened this issue 9 years ago • 5 comments

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"

JoniDS avatar Aug 18 '15 15:08 JoniDS

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

Stuart-campbell avatar Aug 18 '15 15:08 Stuart-campbell

But wouldn't the tables RushTextFile, RushJSONFile and RushBitmapFile with the prefix also be created (alongside with my extended classes)?

JoniDS avatar Aug 18 '15 16:08 JoniDS

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

Stuart-campbell avatar Aug 18 '15 16:08 Stuart-campbell

On a side note, why are the prefixes an issue for you?

Stuart-campbell avatar Aug 18 '15 17:08 Stuart-campbell

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).

JoniDS avatar Aug 18 '15 17:08 JoniDS