Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Extract PrimaryKeyQueryable from Queryable #455

Merged

Conversation

matthewmcgarvey
Copy link
Member

@matthewmcgarvey matthewmcgarvey commented Sep 7, 2020

Related to #453

If we want to support database views in the future, one step in getting there is removing the requirement of the database table having a primary key.

When the time comes to allow not setting a primary key, the BaseQueryTemplate not include PrimaryKeyQueryable which will remove any ability to query by the primary key for that model.

Copy link
Member

@paulcsmith paulcsmith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Smart! I like this approach

@paulcsmith
Copy link
Member

Looks like there are some conflicts. Ping me when you're ready and I'll take another look + merge

@matthewmcgarvey
Copy link
Member Author

@paulcsmith This is ready to be reviewed again. I did tweak it so that PrimaryKeyQueryable does not include Queryable. Seemed like the wrong choice to do that inheritance type structure.

Copy link
Member

@paulcsmith paulcsmith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this new approach of having them implement just the methods they own and including both modules 👍

Just one thought about removing the abstract def

src/avram/primary_key_queryable.cr Outdated Show resolved Hide resolved
@jwoertink
Copy link
Member

@matthewmcgarvey is there anything else you need to do on this? If not, I think it's ready to merge in.

@matthewmcgarvey
Copy link
Member Author

@jwoertink it's ready, thanks

@jwoertink jwoertink merged commit 9a2c69a into luckyframework:master Sep 18, 2020
@matthewmcgarvey matthewmcgarvey deleted the primary-key-queryable branch September 18, 2020 17:03
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants