Skip to content
This repository has been archived by the owner on Jul 15, 2024. It is now read-only.

Commit

Permalink
fix(member): primaryKey should be guildId + id
Browse files Browse the repository at this point in the history
  • Loading branch information
Hazmi35 authored May 5, 2024
1 parent 8ed69d9 commit 0abad23
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions packages/kanao-schema/src/Schema/member.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { pgTable, integer, text, boolean, index } from "drizzle-orm/pg-core";
import { pgTable, integer, text, boolean, primaryKey } from "drizzle-orm/pg-core";

export const members = pgTable("members", {
id: text("id").primaryKey(),
id: text("id"),
guildId: text("guild_id"),

nick: text("nick"),
Expand All @@ -13,4 +13,4 @@ export const members = pgTable("members", {
mute: boolean("mute"),
pending: boolean("pending"),
communicationDisabledUntil: text("communication_disabled_until")
}, table => ({ guildIdIdx: index("members_guildId_idx").on(table.guildId) }));
}, table => ({ primaryKey: primaryKey({ columns: [table.guildId, table.id] }) }));
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ export class GuildCreateListener extends Listener {
suppress: voiceState.suppress
})
.onConflictDoUpdate({
target: [voiceStates.memberId, voiceStates.guildId],
target: [voiceStates.guildId, voiceStates.memberId],
set: {
channelId: sql`EXCLUDED.channel_id`,
sessionId: sql`EXCLUDED.session_id`,
Expand Down

0 comments on commit 0abad23

Please sign in to comment.