fix(#9): drop pgTable variants, switch storage layer to sqlite-only #11
No reviewers
Labels
No labels
bug
in-progress
triage-approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
AuWoMe/Drift!11
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/9-drizzle-overload"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #9.
drizzle-orm 0.39.3 with TypeScript 5.6.3 cannot reconcile the union of pgTable + sqliteTable variants declared in shared/schema.ts. storage.ts operates on db whose type is the union of node-postgres and better-sqlite3 adapters, and every .select/.insert/.update/.delete call site fails with TS2349.
Codebase is unambiguously SQLite at runtime: dev.db is committed, CI workflow doesn't set DATABASE_URL, better-sqlite3 is the actual driver. Switch to sqlite-only.
Verified:
Unblocks #7.
drizzle-orm 0.39.3 with TypeScript 5.6.3 cannot reconcile the union of pgTable + sqliteTable variants declared for the same logical tables in shared/schema.ts. storage.ts operates on db whose type is the union of node-postgres and better-sqlite3 adapters, and every .select/.insert/ .update/.delete call site fails with TS2349 ('no compatible signatures'). Codebase is unambiguously SQLite at runtime: dev.db is committed, CI workflow doesn't set DATABASE_URL, better-sqlite3 is the actual driver. docker-compose.yml mentions Postgres but storage.ts never wired against pgTable types. Switch to sqlite-only: - shared/schema.ts: drop pgTable imports and the *Sqlite duplicates; the canonical table exports (users, projects, ...) are now sqliteTable-backed with text/integer columns and datetime defaults. - server/db.ts: drop the Postgres branch, always instantiate better-sqlite3 (filename honours DATABASE_URL when it doesn't look like a postgres URL, else 'dev.db'). - script/migrate.ts: SQLite-only. - drizzle.config.ts: dialect fixed to 'sqlite'. - server/test/setup.ts: drop pool from mock. - server/storage.ts: convert new Date() assignments to ISO strings (text columns); default optional email to '' on insert. - server/routes.ts: import Relationship/Action types, String() coerce req.params.id where express typings widened it to string | string[]. - server/index.ts: logger.error signature is (string, string?) — embed path/stack into the message instead of the second arg. Verified: - npm run check exits 0 from the lockfile (was 30+ errors). - npm run build succeeds (client + server bundles). - npx vitest run: 10/10 tests pass. - Closes: Forgejo issue #9 (and unblocks #7).Closing this PR as part of repo flattening (parent kanban card t_74fbb28b).
The branch's fix is stale relative to main:
mainnow carries commit8bfee31("fix(#9): clear drizzle-orm schema overload errors blocking npm run check") which addresses the same issue with a different approach (narrowing the db type and adding logger meta). The branch's +39/-149 changes are largely already superseded by main.Closing PR and deleting source branch
fix/9-drizzle-overload. The work in this PR is preserved in git history on the branch's head SHA8c0dc80.Pull request closed