Switch main database to Deno SQLite3

This commit is contained in:
Alex Gleason 2023-10-11 15:49:47 -05:00
parent 6c2c9541be
commit 451b77d6c4
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
3 changed files with 9 additions and 8 deletions

View File

@ -2,12 +2,12 @@
"$schema": "https://deno.land/x/deno@v1.32.3/cli/schemas/config-file.v1.json", "$schema": "https://deno.land/x/deno@v1.32.3/cli/schemas/config-file.v1.json",
"lock": false, "lock": false,
"tasks": { "tasks": {
"start": "deno run --allow-read --allow-write=data --allow-env --allow-net --allow-sys src/server.ts", "start": "deno run -A --unstable src/server.ts",
"dev": "deno run --allow-read --allow-write=data --allow-env --allow-net --allow-sys --watch src/server.ts", "dev": "deno run -A --unstable --watch src/server.ts",
"debug": "deno run --allow-read --allow-write=data --allow-env --allow-net --allow-sys --inspect src/server.ts", "debug": "deno run -A --unstable --inspect src/server.ts",
"test": "DB_PATH=\":memory:\" deno test --allow-read --allow-write=data --allow-env src", "test": "DB_PATH=\":memory:\" deno test -A --unstable src",
"check": "deno check src/server.ts", "check": "deno check src/server.ts",
"relays:sync": "deno run -A scripts/relays.ts sync" "relays:sync": "deno run -A --unstable scripts/relays.ts sync"
}, },
"imports": { "imports": {
"@/": "./src/", "@/": "./src/",

View File

@ -1,7 +1,7 @@
import fs from 'node:fs/promises'; import fs from 'node:fs/promises';
import path from 'node:path'; import path from 'node:path';
import { DenoSqliteDialect, FileMigrationProvider, Kysely, Migrator, Sqlite } from '@/deps.ts'; import { DenoSqlite3, DenoSqliteDialect, FileMigrationProvider, Kysely, Migrator } from '@/deps.ts';
import { Conf } from '@/config.ts'; import { Conf } from '@/config.ts';
interface DittoDB { interface DittoDB {
@ -57,7 +57,7 @@ interface UnattachedMediaRow {
const db = new Kysely<DittoDB>({ const db = new Kysely<DittoDB>({
dialect: new DenoSqliteDialect({ dialect: new DenoSqliteDialect({
database: new Sqlite(Conf.dbPath), database: new DenoSqlite3(Conf.dbPath),
}), }),
}); });

View File

@ -56,6 +56,7 @@ export {
DB as Sqlite, DB as Sqlite,
SqliteError, SqliteError,
} from 'https://raw.githubusercontent.com/alexgleason/deno-sqlite/325f66d8c395e7f6f5ee78ebfa42a0eeea4a942b/mod.ts'; } from 'https://raw.githubusercontent.com/alexgleason/deno-sqlite/325f66d8c395e7f6f5ee78ebfa42a0eeea4a942b/mod.ts';
export { Database as DenoSqlite3 } from 'https://deno.land/x/sqlite3@0.9.1/mod.ts';
export * as dotenv from 'https://deno.land/std@0.198.0/dotenv/mod.ts'; export * as dotenv from 'https://deno.land/std@0.198.0/dotenv/mod.ts';
export { export {
FileMigrationProvider, FileMigrationProvider,
@ -65,7 +66,7 @@ export {
type NullableInsertKeys, type NullableInsertKeys,
sql, sql,
} from 'npm:kysely@^0.25.0'; } from 'npm:kysely@^0.25.0';
export { DenoSqliteDialect } from 'https://gitlab.com/soapbox-pub/kysely-deno-sqlite/-/raw/v1.0.1/mod.ts'; export { DenoSqliteDialect } from 'https://gitlab.com/soapbox-pub/kysely-deno-sqlite/-/raw/v1.1.0/mod.ts';
export { default as tldts } from 'npm:tldts@^6.0.14'; export { default as tldts } from 'npm:tldts@^6.0.14';
export * as cron from 'https://deno.land/x/deno_cron@v1.0.0/cron.ts'; export * as cron from 'https://deno.land/x/deno_cron@v1.0.0/cron.ts';
export { S3Client } from 'https://deno.land/x/s3_lite_client@0.6.1/mod.ts'; export { S3Client } from 'https://deno.land/x/s3_lite_client@0.6.1/mod.ts';