Refactor database handling to exclusively support PostgreSQL
- Removed SQLite support from the configuration and database initialization logic. - Updated database migration scripts to focus solely on PostgreSQL migrations. - Simplified logging messages to reflect PostgreSQL usage. - Adjusted database schema definitions to remove SQLite-specific types and structures. - Modified tests to ensure compatibility with PostgreSQL, including changes to table creation and data types. - Cleaned up unused imports and code related to SQLite.
This commit is contained in:
@@ -4,7 +4,6 @@ import { afterAll, beforeAll, describe, expect, it, vi } from "vitest";
|
||||
const originalEnv = process.env;
|
||||
|
||||
describe("Drizzle ORM Database", () => {
|
||||
let config: typeof import("../src/config").config;
|
||||
let drizzle: typeof import("../src/database/drizzle");
|
||||
let logger: ReturnType<typeof import("../src/logger").createChildLogger>;
|
||||
|
||||
@@ -14,22 +13,20 @@ describe("Drizzle ORM Database", () => {
|
||||
...originalEnv,
|
||||
DISCORD_TOKEN: "test-token",
|
||||
NODE_ENV: "test",
|
||||
DATABASE_TYPE: originalEnv.DATABASE_TYPE || "sqlite",
|
||||
};
|
||||
|
||||
// Reset modules to pick up new environment
|
||||
vi.resetModules();
|
||||
|
||||
// Import after environment is set
|
||||
const configModule = await import("../src/config");
|
||||
await import("../src/config");
|
||||
const drizzleModule = await import("../src/database/drizzle");
|
||||
const loggerModule = await import("../src/logger");
|
||||
|
||||
config = configModule.config;
|
||||
drizzle = drizzleModule;
|
||||
logger = loggerModule.createChildLogger("database.test");
|
||||
|
||||
logger.info(`Testing with DATABASE_TYPE: ${config.DATABASE_TYPE}`);
|
||||
logger.info("Testing PostgreSQL database initialization");
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
|
||||
Reference in New Issue
Block a user