Files
Docwell/Database
tajniak81andClaude Opus 5.5 cad42fbe89
CI / desktop (ubuntu-latest) (push) Successful in 2h34m54s
CI / mobile (push) Failing after 4m52s
CI / desktop (macos-latest) (push) Canceled after 0s
CI / desktop (windows-latest) (push) Canceled after 0s
CI / docker (push) Successful in 53m34s
Docs / build (push) Canceled after 0s
Docs / deploy (push) Canceled after 0s
CI / go (Media) (push) Successful in 13m0s
CI / go (Server) (push) Successful in 24m4s
CI / go (Web-App) (push) Successful in 12m35s
CI / frontend (push) Failing after 11m51s
Prepare the 0.3.0 release
CHANGELOG.md gets the 0.3.0 notes: everything since 0.2.0 by area, and
the steps for upgrading a 0.2.0 install (new compose files with a stock
PocketBase on 8070, pb_data at /pb/pb_data, the media service, and the
SMTP password to enter once more). The release workflow now uses the
tag's CHANGELOG section as the Gitea release text. A v0.2.0 compose stack
with data was upgraded in place to this commit and kept its data.

Also fixes what CI would have failed on:
- Server lint (golangci-lint v2.14): errors.Is/As for sentinel errors,
  the bbolt/errors package instead of the deprecated bolt error, one
  needless conversion, and commented nolints for gosec false positives.
- SPDX headers on Database/export-schema.sh and Server/entrypoint.sh.
- Prettier on two files; the generated pbschema/schema.json is ignored.
- The editor-bridge dist page rebuilt to match the phone app's copy.

PLAN.md and the upgrade guide point to the release notes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 10:21:57 +01:00
..
2026-11-17 10:21:57 +01:00

Database schema

docwell-db is a stock PocketBase: the stack runs tajniak81/pocketbase-docker-root (source) as it is. There is no Docwell image for it any more. docwell-server brings PocketBase up to Docwell's schema itself, every time it starts (Server/internal/pbschema): missing collections and fields are created, existing ones keep their data. It also writes the DOCWELL_* settings (app name and URL, mail, file storage) and sends Docwell's own emails, so PocketBase needs no hooks either.

This folder is where that schema is written:

  • pb_migrations/ holds the JS migrations, the source of truth for the schema.
  • export-schema.sh turns them into Server/internal/pbschema/schema.json, the snapshot docwell-server embeds and applies.
  • All collection API rules are null, so only superusers have access. Never expose PocketBase publicly; only docwell-server talks to it.

Changing the schema

  1. Add a migration to pb_migrations/ (pocketbase migrate create "add_comments" --migrationsDir ./pb_migrations, or copy an existing file). Leave earlier migrations alone.

  2. Regenerate the snapshot (needs Docker and Go):

    sh Database/export-schema.sh
    
  3. Commit the migration and the new schema.json together. go test ./internal/pbschema checks the snapshot.

Removing a collection or a field is not done by the snapshot: it only adds and updates. Do that by hand, once, in the PocketBase dashboard of each install, after the release that stops using it.

The admin panel manages two parts of the users collection itself, the OAuth2 providers and the magic link switch (otp.enabled), so the snapshot leaves them out and they keep whatever is set.

Run locally

Download PocketBase v0.40.6 for your OS into Database/bin/, then:

./bin/pocketbase superuser upsert admin@docwell.test devpassword123 --dir ./pb_data
./bin/pocketbase serve --dir ./pb_data --http 127.0.0.1:8070

Start docwell-server against it (DOCWELL_PB_EMAIL and DOCWELL_PB_PASSWORD set to that superuser) and it creates the collections. The PocketBase dashboard is at http://127.0.0.1:8070/_/.