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:
MythEclipse
2026-05-31 15:46:18 +07:00
parent d1ef036358
commit 8a712cff9b
15 changed files with 175 additions and 659 deletions
+4 -17
View File
@@ -1,21 +1,8 @@
import { mkdtempSync, rmSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { describe, expect, it } from "vitest";
import { initializeMigrationSqliteDatabase } from "../../src/database/migrate";
import { runMigrations } from "../../src/database/migrate";
describe("initializeMigrationSqliteDatabase", () => {
it("creates a SQLite DB with WAL journal mode", () => {
const dir = mkdtempSync(join(tmpdir(), "bete-migrate-"));
const dbPath = join(dir, "test.db");
const { sqlite, db } = initializeMigrationSqliteDatabase(dbPath);
try {
expect(db).toBeDefined();
expect(sqlite.pragma("journal_mode", { simple: true })).toBe("wal");
} finally {
sqlite.close();
rmSync(dir, { recursive: true, force: true });
}
describe("runMigrations", () => {
it("exports the PostgreSQL migration runner", () => {
expect(runMigrations).toBeTypeOf("function");
});
});