@@ -6,11 +6,11 @@ Seed spec files are MiniJinja templates: they are rendered with environment vari
66
77## Supported Databases
88
9- | Driver | Connection URL format |
10- | ------------ | -- ---------------------------------------------- |
11- | ` postgres ` | ` postgres://user:pass@host:5432/dbname ` |
12- | ` mysql ` | ` mysql://user:pass@host:3306/dbname ` |
13- | ` sqlite ` | ` /path/to/database.db ` or ` :memory: ` for tests |
9+ | Driver | Connection URL format |
10+ | ---------- | ---------------------------------------------- |
11+ | ` postgres ` | ` postgres://user:pass@host:5432/dbname ` |
12+ | ` mysql ` | ` mysql://user:pass@host:3306/dbname ` |
13+ | ` sqlite ` | ` /path/to/database.db ` or ` :memory: ` for tests |
1414
1515## Quick Start
1616
@@ -65,47 +65,47 @@ phases:
6565
6666### Field reference
6767
68- | Field | Type | Required | Description |
69- | -------------------------------------------------- | ---------- | -- -------- | ---------------------------------------------------------------- |
70- | ` database.driver` | string | Yes | Database driver: `postgres`, `mysql`, or `sqlite` |
71- | `database.url` | string | No | Direct database connection URL |
72- | `database.url_env` | string | No | Environment variable containing the database URL |
73- | `database.tracking_table` | string | No | Name of the seed tracking table (default : ` initium_seed` ) |
74- | `phases[].name` | string | Yes | Unique phase name |
75- | `phases[].order` | integer | No | Execution order (lower first, default : 0) |
76- | `phases[].database` | string | No | Target database name (for create/switch) |
77- | `phases[].schema` | string | No | Target schema name (for create/switch) |
78- | `phases[].create_if_missing` | boolean | No | Create the database/schema if it does not exist (default : false) |
79- | `phases[].timeout` | string | No | Default wait timeout (e.g. `30s`, `1m`, `1m30s`; default : ` 30s` ) |
80- | `phases[].wait_for[].type` | string | Yes | Object type : ` table` , `view`, `schema`, or `database` |
81- | `phases[].wait_for[].name` | string | Yes | Object name to wait for |
82- | `phases[].wait_for[].timeout` | string | No | Per-object timeout override (e.g. `60s`, `2m`, `1m30s`) |
83- | `phases[].seed_sets[].name` | string | Yes | Unique name for the seed set (used in tracking) |
84- | `phases[].seed_sets[].order` | integer | No | Execution order (lower values first, default : 0) |
85- | `phases[].seed_sets[].tables[].table` | string | Yes | Target database table name |
86- | `phases[].seed_sets[].tables[].order` | integer | No | Execution order within the seed set (default : 0) |
87- | `phases[].seed_sets[].tables[].unique_key` | string[] | No | Columns for duplicate detection |
88- | `phases[].seed_sets[].tables[].auto_id.column` | string | No | Auto-generated ID column name |
89- | `phases[].seed_sets[].tables[].auto_id.id_type` | string | No | ID type (default : ` integer` ) |
90- | `phases[].seed_sets[].tables[].rows[]._ref` | string | No | Internal reference name for cross-table references |
68+ | Field | Type | Required | Description |
69+ | ----------------------------------------------- | -------- | -------- | ---------------------------------------------------------------- |
70+ | ` database.driver` | string | Yes | Database driver: `postgres`, `mysql`, or `sqlite` |
71+ | `database.url` | string | No | Direct database connection URL |
72+ | `database.url_env` | string | No | Environment variable containing the database URL |
73+ | `database.tracking_table` | string | No | Name of the seed tracking table (default : ` initium_seed` ) |
74+ | `phases[].name` | string | Yes | Unique phase name |
75+ | `phases[].order` | integer | No | Execution order (lower first, default : 0) |
76+ | `phases[].database` | string | No | Target database name (for create/switch) |
77+ | `phases[].schema` | string | No | Target schema name (for create/switch) |
78+ | `phases[].create_if_missing` | boolean | No | Create the database/schema if it does not exist (default : false) |
79+ | `phases[].timeout` | string | No | Default wait timeout (e.g. `30s`, `1m`, `1m30s`; default : ` 30s` ) |
80+ | `phases[].wait_for[].type` | string | Yes | Object type : ` table` , `view`, `schema`, or `database` |
81+ | `phases[].wait_for[].name` | string | Yes | Object name to wait for |
82+ | `phases[].wait_for[].timeout` | string | No | Per-object timeout override (e.g. `60s`, `2m`, `1m30s`) |
83+ | `phases[].seed_sets[].name` | string | Yes | Unique name for the seed set (used in tracking) |
84+ | `phases[].seed_sets[].order` | integer | No | Execution order (lower values first, default : 0) |
85+ | `phases[].seed_sets[].tables[].table` | string | Yes | Target database table name |
86+ | `phases[].seed_sets[].tables[].order` | integer | No | Execution order within the seed set (default : 0) |
87+ | `phases[].seed_sets[].tables[].unique_key` | string[] | No | Columns for duplicate detection |
88+ | `phases[].seed_sets[].tables[].auto_id.column` | string | No | Auto-generated ID column name |
89+ | `phases[].seed_sets[].tables[].auto_id.id_type` | string | No | ID type (default : ` integer` ) |
90+ | `phases[].seed_sets[].tables[].rows[]._ref` | string | No | Internal reference name for cross-table references |
9191
9292# ## Wait-for object support by driver
9393
94- | Object type | SQLite | PostgreSQL | MySQL |
95- | ------------- | -------- | ------------ | -- ----- |
96- | `table` | ✅ | ✅ | ✅ |
97- | `view` | ✅ | ✅ | ✅ |
98- | `schema` | ❌ | ✅ | ✅* |
99- | `database` | ❌ | ✅ | ✅* |
94+ | Object type | SQLite | PostgreSQL | MySQL |
95+ | ----------- | ------ | ---------- | ----- |
96+ | `table` | ✅ | ✅ | ✅ |
97+ | `view` | ✅ | ✅ | ✅ |
98+ | `schema` | ❌ | ✅ | ✅* |
99+ | `database` | ❌ | ✅ | ✅* |
100100
101101\* In MySQL, `schema` and `database` are synonymous.
102102
103103# ## Create-if-missing support by driver
104104
105- | Operation | SQLite | PostgreSQL | MySQL |
106- | ------------------- | -------- | ------------ | -- ----- |
107- | `CREATE DATABASE` | ❌ | ✅ | ✅ |
108- | `CREATE SCHEMA` | ❌ | ✅ | ✅* |
105+ | Operation | SQLite | PostgreSQL | MySQL |
106+ | ----------------- | ------ | ---------- | ----- |
107+ | `CREATE DATABASE` | ❌ | ✅ | ✅ |
108+ | `CREATE SCHEMA` | ❌ | ✅ | ✅* |
109109
110110\* In MySQL, `CREATE SCHEMA` maps to `CREATE DATABASE`.
111111
@@ -276,30 +276,30 @@ spec:
276276
277277# # CLI Reference
278278
279- | Flag | Default | Description |
280- | ----------- | -- ---------- | --------------------------------------- |
281- | `--spec` | (required) | Path to seed spec file (YAML or JSON) |
282- | `--reset` | `false` | Delete existing data and re-apply seeds |
283- | `--json` | `false` | Enable JSON log output |
279+ | Flag | Default | Description |
280+ | --------- | ---------- | --------------------------------------- |
281+ | `--spec` | (required) | Path to seed spec file (YAML or JSON) |
282+ | `--reset` | `false` | Delete existing data and re-apply seeds |
283+ | `--json` | `false` | Enable JSON log output |
284284
285285# # Failure Modes
286286
287- | Scenario | Behavior |
288- | --------------------------------------- | -- ------------------------------------------------------ |
289- | Invalid spec file | Fails with parse error before connecting to database |
290- | Invalid MiniJinja template | Fails with template syntax error before parsing YAML |
291- | Database unreachable | Fails with connection error |
292- | Unsupported driver | Fails with descriptive error listing supported drivers |
293- | Missing env var for URL | Fails with error naming the missing variable |
294- | Missing env var in `$env:` | Fails with error naming the missing variable |
295- | Unresolved `@ref:` | Fails with error naming the missing reference |
296- | Row insertion failure | Entire seed set rolled back via transaction |
297- | Duplicate row (with unique_key) | Row silently skipped |
298- | Already-applied seed set | Seed set silently skipped |
299- | Wait-for object timeout | Fails with structured timeout error naming the object |
300- | Unsupported object type for driver | Fails immediately with driver-specific error |
301- | CREATE DATABASE on SQLite | Fails with "not supported" error |
302- | CREATE SCHEMA on SQLite | Fails with "not supported" error |
287+ | Scenario | Behavior |
288+ | ---------------------------------- | ------------------------------------------------------ |
289+ | Invalid spec file | Fails with parse error before connecting to database |
290+ | Invalid MiniJinja template | Fails with template syntax error before parsing YAML |
291+ | Database unreachable | Fails with connection error |
292+ | Unsupported driver | Fails with descriptive error listing supported drivers |
293+ | Missing env var for URL | Fails with error naming the missing variable |
294+ | Missing env var in `$env:` | Fails with error naming the missing variable |
295+ | Unresolved `@ref:` | Fails with error naming the missing reference |
296+ | Row insertion failure | Entire seed set rolled back via transaction |
297+ | Duplicate row (with unique_key) | Row silently skipped |
298+ | Already-applied seed set | Seed set silently skipped |
299+ | Wait-for object timeout | Fails with structured timeout error naming the object |
300+ | Unsupported object type for driver | Fails immediately with driver-specific error |
301+ | CREATE DATABASE on SQLite | Fails with "not supported" error |
302+ | CREATE SCHEMA on SQLite | Fails with "not supported" error |
303303
304304# # Examples
305305
0 commit comments