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

refactor: migrate activity repo to kysely #15203

Merged
merged 1 commit into from
Jan 9, 2025
Merged

Conversation

danieldietzler
Copy link
Member

No description provided.

@jrasm91 jrasm91 merged commit 1fb2b3f into main Jan 9, 2025
38 checks passed
@jrasm91 jrasm91 deleted the refactor/kysely-activity branch January 9, 2025 19:31
const { count } = await this.db
.selectFrom('activity')
.select((eb) => eb.fn.countAll().as('count'))
.leftJoin('users', 'users.id', 'activity.userId')
Copy link
Contributor

Choose a reason for hiding this comment

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

The user relation should be an inner join.

.where('activity.albumId', '=', albumId)
.where('activity.isLiked', '=', false)
.where('users.deletedAt', 'is', null)
.where('assets.deletedAt', 'is', null)
Copy link
Contributor

Choose a reason for hiding this comment

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

If you do this check, then wouldn't the left join effectively work like an inner join because it requires an asset with a null deletedAt to exist?

Copy link
Contributor

Choose a reason for hiding this comment

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

You might be right. You are saying you could rewrite this as an inner join with the condition of joining on id and where deleted at is null?

aminesebastian pushed a commit to suburban-digital/immich-sd that referenced this pull request Jan 12, 2025
yosit pushed a commit to yosit/immich that referenced this pull request Jan 13, 2025
arctic-foxtato pushed a commit to arctic-foxtato/immich that referenced this pull request Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants