Repository navigation
feat: support SQLite as an alternative to PostgreSQL - #21
Closed
harsHdokyc wants to merge 1 commit into
Closed
harsHdokyc wants to merge 1 commit into
harsHdokyc wants to merge 1 commit into
Conversation
DATABASE_URL picks the database: postgresql://… as before, or file:/absolute/path.db for SQLite, so Dossier can run as a single container (AienTech#17). PostgreSQL stays the default and is unchanged. - prisma/sqlite/schema.prisma is generated from prisma/schema.prisma (yarn sqlite-schema; a test fails when it's stale), with its own migrations; prisma7.config.ts picks the pair by DATABASE_URL. - createPrismaClient() in src/lib/database.ts picks the client and adapter. On SQLite, queries from outside an open transaction wait for it to end, so a rollback can't undo them. - FOR UPDATE only on PostgreSQL; skipDuplicates replaced by upserts or deduplication; enum order sorted in code where it matters. - Citext's case-insensitive names become COLLATE NOCASE, and the built-in theme trigger is ported to SQLite. - CI runs the database tests on SQLite too; README, DEVELOPMENT.md and .env.example document it. Closes AienTech#17 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011GfGRofhBkPHKP9dUZYLr9
Owner
|
Hi, thanks for the PR. This one however is already being implemented and quite differs from the current implementation made by Claude. Thank you anyway for taking the time |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #17
Summary
Set
DATABASE_URL=file:/data/dossier.dbto run Dossier on a single SQLite file in one container. PostgreSQL stays the default and is unchanged.Changes
prisma/sqlite/schema.prismais generated fromprisma/schema.prisma(yarn sqlite-schema; a test fails if it's stale), with its own migrations inprisma/sqlite/migrations.prisma7.config.tspicks the schema and migrations byDATABASE_URL.src/lib/database.ts→createPrismaClient()picks the Postgres or SQLite client and adapter (@prisma/adapter-better-sqlite3). The app stays typed with the Postgres client.FOR UPDATE→${forUpdate()}, which is empty on SQLite.skipDuplicates→ upserts withupdate: {}, or removing duplicates first.citext→COLLATE NOCASE.DATABASE_URLacceptsfile:with an absolute path.yarn generatebuilds both clients. The seed bundle leavesbetter-sqlite3external. CI runs the database tests on SQLite too..env.example.Testing
yarn lint,yarn typecheck: passyarn test:coverageon PostgreSQL: 1686 passed, 26 skipped (unchanged), thresholds metyarn vitest run --project dbon SQLite: 436 passed, 1 skipped (a race that SQLite's one-at-a-time transactions rule out)yarn build+ standalone server on SQLite: migrate, seed (incl.--demo), sign-in, failed-login throttle, main pages, Settings → AboutKnown limitations
AI assistance (Claude Code) was used; I reviewed every change and ran the tests above.