pkgs/bot/src/database/schema/guild.ts (view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
import { defineRelations } from "drizzle-orm";
import { sqliteTable, text } from "drizzle-orm/sqlite-core";
export const manager = sqliteTable("manager", {
roleId: text("role_id").primaryKey(),
guildId: text("guild_id").notNull(),
});
export const guild = sqliteTable("guild", {
guildId: text("guild_id").notNull().primaryKey(),
suggestion_forum_id: text("suggestion_forum_id"),
bug_channel_id: text("bug_channel_id"),
highlights_channel_id: text("highlights_channel_id"),
commands_channel_id: text("commands_channel_id"),
ticket_channel_id: text("ticket_channel_id"),
ticket_category_id: text("ticket_category_id"),
ticket_message: text("ticket_message"),
});
export const GuildRelations = defineRelations({ manager, guild }, (r) => ({
manager: {
guild: r.one.guild({
from: r.manager.guildId,
to: r.guild.guildId,
}),
},
guild: {
managers: r.many.manager(),
},
}));
export type Guild = typeof guild.$inferSelect;
export type Manager = typeof manager.$inferSelect;
|