Skip to content

CICD-316 · Database seed generation ​

Encyclopedia · Database delivery and migration · All snippets

Previous · CICD-315 · Next · CICD-317

1. Where it fits ​

  • Placement tests/seed.sql.
  • Prerequisites disposable database, migration tools and a scoped database role.
  • Platforms local-lab.

2. Copy the snippet ​

sql
INSERT INTO accounts (id, status)
VALUES (101, 'active'), (102, 'disabled')
ON CONFLICT (id) DO UPDATE SET status = EXCLUDED.status;

3. How it works ​

Use the database connection and transaction boundary called out below. The SQL statement controls the actual schema or data change.

4. Verify the result ​

Use synthetic records with fixed IDs on a test database. Two seed runs should produce the same state.

Validation untested. Status definitions.