Skip to content

Modernize node sqlite - #26

Merged
Ionaru merged 2 commits into
masterfrom
modernize-node-sqlite
Jul 9, 2026
Merged

Modernize node sqlite#26
Ionaru merged 2 commits into
masterfrom
modernize-node-sqlite

Conversation

@Ionaru

@Ionaru Ionaru commented Jul 9, 2026

Copy link
Copy Markdown
Owner

No description provided.

Ionaru added 2 commits July 7, 2026 22:31
better-sqlite3 is a native module with no prebuilt binary for Node 24, so
`npm install` failed and a fresh Docker image could not be built. Replace
TypeORM and better-sqlite3 with Node's built-in node:sqlite and a small
hand-written data-access layer, removing all native compilation from the
install and the Docker build.

- Add src/database/connection.ts: opens the database, enables foreign keys,
  runs an idempotent CREATE TABLE IF NOT EXISTS bootstrap, and creates the
  data directory if it is missing.
- Rewrite the models as enum + interface + repository using prepared
  statements; drop the abstract base model and all TypeORM decorators.
- Rewire notify.command.ts and watch.controller.ts onto the new
  repositories and simplify database.controller.ts.
- Remove typeorm, better-sqlite3 and reflect-metadata, the TypeORM
  migrations, and ormconfig.js. Pin Node 24 (engines) and bump @types/node.
- Replace the Dockerfile with a multi-stage build and add .dockerignore.
- Add an in-memory data-layer test suite; delete the obsolete
  TypeORM-based watch controller spec.

Existing therabot.db databases keep working: the bootstrap is a no-op on
already-migrated databases and the physical column names are preserved.
Replace the TeamCity-triggered deploy with a self-contained GitHub Actions
pipeline mirroring the fruiz repo: build the image, push it to GHCR, then SSH
into the deploy host and run docker compose pull + up against
deploy/compose.yaml.

- Rewrite cd.yml into audit/get_sha/test/build-image/push-image/deploy jobs;
  drop the TeamCity step and the API_TOKEN secret.
- Move Dockerfile to deploy/Dockerfile and add deploy/compose.yaml (image +
  build), replacing the root docker-compose.yml.
- Add an undici ^6.27.0 override to clear the advisories dragged in
  transitively by discord.js (which pins the vulnerable 6.24.1), so
  npm audit --omit=dev gates cleanly.
@Ionaru
Ionaru merged commit 3570f70 into master Jul 9, 2026
6 checks passed
@Ionaru
Ionaru deleted the modernize-node-sqlite branch July 9, 2026 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant