seed

Initial content lives next to the config: seed/<table>.json — a JSON array of row objects, keys are column names. At startup, after auto-migration, the engine checks every table declared in settings.json: if the table is empty and its seed file exists, the rows are inserted once. A non-empty table is never touched, so seeding cannot overwrite real data.

This documentation is seeded from seed/doc_groups.json and seed/docs.json. 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