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

Commit

Permalink
fix: members uniqueness
Browse files Browse the repository at this point in the history
  • Loading branch information
KagChi committed Mar 2, 2024
1 parent 1d4d276 commit 44fa8d8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions packages/kanao-schema/src/Schema/guild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { pgTable, text, boolean, integer } from "drizzle-orm/pg-core";

export const guilds = pgTable("guilds", {
id: text("id").primaryKey(),

unavailable: boolean("unavailable"),
name: text("name"),
icon: text("icon"),
Expand Down
10 changes: 6 additions & 4 deletions packages/kanao-schema/src/Schema/member.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { pgTable, integer, text, boolean } 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(),
guildId: text("guild_id").notNull(),
id: text("id"),
guildId: text("guild_id"),

nick: text("nick"),
avatar: text("avatar"),
Expand All @@ -13,4 +13,6 @@ export const members = pgTable("members", {
mute: boolean("mute"),
pending: boolean("pending"),
communicationDisabledUntil: text("communication_disabled_until")
});
}, table => ({
pkWithCustomName: primaryKey({ name: "members_id_guild_id", columns: [table.id, table.guildId] })
}));

0 comments on commit 44fa8d8

Please sign in to comment.