feat: migrate from SQLite to PostgreSQL and update database handling

This commit is contained in:
MythEclipse
2026-05-21 15:11:32 +07:00
parent 4a47855ad4
commit bfa91063ff
24 changed files with 252 additions and 181 deletions
+4 -5
View File
@@ -1,16 +1,15 @@
import { Database } from "bun:sqlite";
import type { Client } from "discord.js";
import type { AppConfig } from "../config";
import { prepareSqlitePath } from "../db/sqlitePath";
import { createDb } from "../db";
import { BoosterRoleService } from "../services/boosterRoleService";
import { BunSqliteBoosterRoleStore } from "../services/bunSqliteBoosterRoleStore";
import { DrizzleBoosterRoleStore } from "../services/drizzleBoosterRoleStore";
import { DiscordRoleRepository } from "../services/discordRoleRepository";
import { handleGuildMemberUpdate } from "./events/guildMemberUpdate";
import { handleInteraction } from "./interactionHandler";
export function attachBotHandlers(client: Client, config: AppConfig): void {
const db = new Database(prepareSqlitePath(config.databaseUrl));
const store = new BunSqliteBoosterRoleStore(db);
const db = createDb(config.databaseUrl);
const store = new DrizzleBoosterRoleStore(db);
client.on("interactionCreate", async (interaction) => {
if (!interaction.isChatInputCommand() || !interaction.guild) return;