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

Auto-generated primary key not returned by the Model #37

Closed
seapagan opened this issue Sep 28, 2024 · 1 comment
Closed

Auto-generated primary key not returned by the Model #37

seapagan opened this issue Sep 28, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@seapagan
Copy link
Owner

seapagan commented Sep 28, 2024

If create_pk is True, an autogenerated PK (defaults to id) is created. However this is not exposed on the return model from a query, so methods like update() or delete() that require a primary key cant be called in this case (if the Model has a custom named PK then that works).

After a lot of thought, this will be fixed by making the auto-generated pk compulsory and removing the option to rename it. The ability to rename or remove the auto-increment field may be added again in future releases once the code is cleaned up a bit.

Work on this is in #39 which will close this when complete

@seapagan seapagan added the bug Something isn't working label Sep 28, 2024
@seapagan seapagan self-assigned this Sep 28, 2024
@seapagan
Copy link
Owner Author

fixed by #39. This makes the 'pk' field NON OPTIONAL

@seapagan seapagan reopened this Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant