greenrobot / greenDAO

greenDAO is a light & fast ORM solution for Android that maps objects to SQLite databases.
http://greenrobot.org/greendao/
12.63k stars 2.89k forks source link

Multiple Schemas with Annotations #356

Open terily opened 8 years ago

terily commented 8 years ago

1,Entity

image

2, Error image

What is the right steps to define schemas ?

greenrobot-team commented 8 years ago

This error message is a little cryptic @greenrobot. But what I can gather from the migration documentation you have to add the schema version number to your build.gradle file (where your android config is as well):

greendao {
    schemaVersion 1
}

-ut

yzhiwen commented 8 years ago

I still have this problem when I change the schemaVersion.

greenrobot commented 8 years ago

If you only have a single schema, do not define schema in @Entity.

Multiple schemas is not yet official for annotations.

sixgodIT commented 8 years ago

Greendao3.0 does not support multiple schema definition? I was in the generator used in the project _The new Schema (" user ", 1, "com. Example. Test. Greendao");_ After updated to 3.0

Error:Execution failed for task ':app:greendao'.
 Undefined schema \"user\" (referenced in entities: UserDb).
  Please, define non-default schemas explicitly inside build.gradle
moneyDragon commented 8 years ago

i have the same problem,an existing project has four db,so i can't use one schema,please develope this feature asap~

fortuneFelix commented 7 years ago

Same here - i have two sqllite databases. So far extremely happy with GreenDao! I hope you support multiple DBs going forward!

PittyXu commented 7 years ago

Same, keep 2.x until this issue

tatianasolonets commented 7 years ago

Oh no, I need it ASAP. When this feature will be ready?

greenrobot-team commented 7 years ago

To all above: you can continue using greenDAO 2 without any issues. The documentation for the generator also remains available. -ut

RiccardoM commented 7 years ago

@greenrobot-team Any update on this so far?

yunfeng1213 commented 7 years ago

@greenrobot-team Any update on this so far? support more than one sqllite databases

kapaseker commented 7 years ago

support more than one sqllite databases,please。。。

dongcl commented 6 years ago

support more than one sqllite databases,please。。。+1

TrueKage commented 6 years ago

@greenrobot-team Any update on this feature so far?

xwangly commented 6 years ago

Any update on this feature so far?

titanseason commented 6 years ago

If you want to use multiple schemas: Do delete classpath 'org.greenrobot:greendao-gradle-plugin:3.2.2' in your root project's build.gradle and delete apply plugin: 'org.greenrobot.greendao' in your app project's build.gradle

Just keep compile 'org.greenrobot:greendao:3.2.2' in your app project's build.gradle

And use dao-generator to generate entities and DAOs

songliao-branch commented 3 years ago

what would happen if one uses multiple schemas?? I ran into some weird migration issues.