Files
Docwell/Database
tajniak81andClaude Opus 5.5 3d1cf362d7 Add calendars, a web clipper, more importers and workspace snapshots
Phase F of the AFFiNE plan (ADR-16):

- Calendars: people subscribe to iCal feeds (webcal, Google's secret
  address, Outlook) or CalDAV accounts in account settings; their
  events show at the top of journal pages in the reader's time zone.
  Repeats, moved and cancelled occurrences, IANA and Windows zones
  are handled. Events are read on demand and kept in memory for 15
  minutes; passwords are sealed with DOCWELL_SECRET_KEY; sources
  follow the webhook address rules. New calendar_accounts collection.
- Importers: zips of Markdown (Obsidian vaults, Bear TextBundles and
  .bear2bk, Readwise's Markdown, Docwell's own space export) keep
  folders as pages, resolve [[wikilinks]] and embeds by name, and turn
  front matter and #tags into properties and tags. OneNote .mht
  exports, Readwise CSV, and any other CSV as a database page.
- Exports: PNG of a page drawn in the browser, print styles that print
  only the page in the light theme, and workspace snapshots (records,
  Yjs states, JSON and files in one zip) that restore as a new
  workspace. Old ids are swapped byte for byte inside the Yjs updates,
  so links point at the restored pages and comments stay anchored.
- Web-Clipper/: a Manifest V3 extension for Chrome, Edge and Firefox
  that saves the article or the selection as Markdown through the
  import API with a personal API token.
- OpenAPI, generated clients, translations and user docs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 11:56:03 +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/_/.