Seed Data API
Seed definitions and their plans. Base path /api/db-devops, needs an active license, signed-in callers. Any role can list seeds, plan them and create a script from a plan; creating, changing and deleting seeds needs a Release Manager or admin (403 otherwise). Plans take the engine and database from the connection; a request may still send dialect, but one that does not match the connection is 400 (DIALECT_MISMATCH). Seed plans support PostgreSQL (and CockroachDB, TimescaleDB), MySQL/MariaDB and SQLite; any other engine is 400 (UNSUPPORTED_DIALECT).
Seeds
| Method | Endpoint | Description |
|---|---|---|
| GET | /seed | All seed definitions by name: [{ id, name, description, schemaName, tableName, mode, keyColumns, rows, appliesToDialects, isActive, createdBy, createdAt, updatedAt }] |
| POST | /seed | Create a seed (Release Manager or admin): { "name", "tableName", "mode", "keyColumns", "rows", "schemaName"?, "description"?, "appliesToDialects"?, "isActive"? }. mode is insert, upsert or sync; rows is an array of objects, each with a value for every key column and no two with the same key; a sync seed needs at least one row; appliesToDialects names seed engines only. Answers 201 with the seed |
| PUT | /seed/:id | Replace a seed (Release Manager or admin), with the same body and rules |
| DELETE | /seed/:id | Delete a seed (Release Manager or admin). Rows already applied to tables are not touched. Answers { success } |
A seed that breaks a rule is 400 (INVALID_SEED) with every problem in the message; a name another seed already uses, ignoring case, is 409 (SEED_NAME_TAKEN).
Plans and scripts
| Method | Endpoint | Description |
|---|---|---|
| POST | /seed/plan | Compare { "seedId", "connectionId" } with the table on the connection. Answers { inserts, updates, changes, deletes, sql, dialect }: the rows to insert, the seed rows that change, each change as { key, columns: { column: { from, to } } }, the table rows to delete (sync only), and the script in the connection engine's language (SQL, CQL, MongoDB shell commands, Redis commands, Cypher, or Elasticsearch operations as JSON; Elasticsearch seeds must use _id as their only key column, otherwise 400 INVALID_SEED) |
| POST | /seed/:id/script | Plan the seed against { "connectionId" } and save the SQL as a migration script for that connection, waiting for approval (any role that can create scripts). Answers 201 with { scriptId, name, approvalStatus, counts }; a table that already matches is 409 (SEED_NOTHING_TO_DO) |
Values are compared by meaning: JSON by content, dates by day, numbers by value, booleans also against 1 and 0. Missing rows are plain INSERTs and changed rows an UPDATE of only the changed columns, so the table needs no unique key on the key columns.
Errors
400— an invalid seed (INVALID_SEED), a dialect that does not match the connection, or an engine seeds do not support403— the caller's role cannot do this404— a malformed or unknown seed (SEED_NOT_FOUND) or connection (CONNECTION_NOT_FOUND)409— the seed is inactive (SEED_INACTIVE), applies to other engines (SEED_ENGINE_MISMATCH), its name is taken (SEED_NAME_TAKEN), the table holds a key more than once (SEED_DUPLICATE_KEYS), or there is nothing to apply (SEED_NOTHING_TO_DO)422— the table (or Cassandra table, or Elasticsearch index) does not exist on the connection (SEED_TABLE_MISSING)502— the table could not be read (SEED_PLAN_FAILED), with the engine's reason
Errors answer { "error": "...", "code": "..." }.