Development

Datasets

Use lazy dump and lazy load to capture and restore local service data.

By Guillermo Alvarez - Published Updated

Dataset shape

A dataset is a named local snapshot under datasets/:

datasets/
  baseline/
    postgres.dump
    minio.dump

Each file belongs to one service. The service name comes from lazy.toml or from a discovered :start task. For PostgreSQL, the conventional file is:

datasets/NAME/postgres.dump

Datasets are local development data. Do not commit production data. Commit only small, intentional fixtures after reviewing the contents.

Dump a dataset

Create a dataset from every discovered service that defines a dump task:

lazy dump baseline

For a postgres service, lazy creates datasets/baseline/ and runs:

mise run postgres:dump -- datasets/baseline/postgres.dump

Services without a dump task are skipped. If no discovered service can dump, the command fails instead of creating an empty dataset.

Load a dataset

Restore a dataset:

lazy load baseline

For each discovered service with a matching dump file, lazy runs:

mise run postgres:load -- datasets/baseline/postgres.dump

If a dump file exists but the service has no load task, the command fails so data is not silently ignored. Services with no dump file in that dataset are skipped.

Service task contract

The dump and load tasks receive exactly one path argument:

#!/usr/bin/env bash
set -euo pipefail

out="$1"
pg_dump --format=custom --file "$out" "$DATABASE_URL"
#!/usr/bin/env bash
set -euo pipefail

in="$1"
dropdb --if-exists "$DATABASE_NAME"
createdb "$DATABASE_NAME"
pg_restore --dbname "$DATABASE_NAME" "$in"

Keep the destructive parts explicit in the task. lazy load coordinates file paths and service selection; the app owns the actual database or object-store behavior.

Read Services for the complete service lifecycle and Mise for task-file conventions.