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;