Skip to content
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

Forbid optional Primary Keys #4046

Closed
sync-by-unito bot opened this issue Nov 6, 2020 · 2 comments
Closed

Forbid optional Primary Keys #4046

sync-by-unito bot opened this issue Nov 6, 2020 · 2 comments
Assignees

Comments

@sync-by-unito
Copy link

sync-by-unito bot commented Nov 6, 2020

currently, core allows for nullable primary keys which is a divergence from how mobile developers normally think about primary keys. Generally, primary keys are assumed to be implicitly required, SQLite has this requirement, along with just about every other database ever. I am not sure what the reasoning was behind allowing this in Core but we should aim to align with mobile developers expectations 

This artifact has created downstream effects in Sync

@cmelchior
Copy link
Contributor

The reason being is primarily that we are trying to expose our supported types as native types, and in many languages, these are nullable, like String in Java.

We can turn it non-nullable by a @Required annotation, but nothing in the type system will prevent you from doing the wrong thing and assign it null, which wouldn't be caught until at runtime.

@sync-by-unito sync-by-unito bot closed this as completed Nov 6, 2020
@sync-by-unito
Copy link
Author

sync-by-unito bot commented Nov 6, 2020

➤ Ian Ward commented:

So MongoDB allows nullable primary keys and I guess we should align with that.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants