-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Foreign Key relationships #10
Comments
I've written a hacky workaround for the problem in this gist. |
Hi @sburba, Thank you for the interest in ProviGen. About foreign key support, I'm not sure an annotation would fit. SQLite doesn't support applying constrains on an already created column (http://stackoverflow.com/questions/1884818/how-do-i-add-a-foreign-key-to-an-existing-sqlite-3-6-21-table). If we had a I feel like it makes more sense to have @Override
public void onUpgrade(SQLiteDatabase database, int oldVersion, int newVersion) {
new TableBuilder(MyContract.class)
.addForeignKey(...)
.createTable(database);
// Move the data from the old table to the new table while handling conflicting cases.
// Let the developer handle conflicts according to his logic.
database.execSQL("DROP TABLE old_table")
} I'm open to suggestions and ready to change my point of view if you have a better idea in mind. Again, thank you for your support, having foreign key support would be great. :) Tim |
Very good point. I'll send over a pull request when I get a chance. |
No description provided.
The text was updated successfully, but these errors were encountered: