seed

Initial content lives next to the config: seed/<table>.json — a JSON array of row objects, keys are column names. At startup (and when a reload rebuilds the whole site), after auto-migration, the engine looks for a seed file of every table declared in settings.json. If the file exists, its rows are written in one transaction with INSERT OR REPLACE and the file is removed — each file applies once, the next start does not read it again.

This documentation was seeded from seed/doc_groups.json and seed/docs.json; both files were removed after the first start. The feedback table has no seed file — it starts empty and fills from the contact form.

Two rows for a notes table, saved as seed/notes.json; the first row gets id 1 automatically:

[
  { "text": "First note" },
  { "text": "Second note", "id": 7 }
]

Pre-loaded uploads. The built-in media table can be seeded too: seed/media.json with rows { id, ext, size, created }, while the files themselves are placed under the media folder with the id/1000 sharding — id 7 → media/0/7.jpg. After the start they behave like real uploads: listed and deletable in the Media section, and new uploads continue numbering after them. This is how a site template ships with its pictures.

← All articles in this group