| .. | ||
| README.md | ||
Bootstrap Scripts
This directory contains data initialization scripts executed on empty databases.
File Naming
Files are named with alphabetic prefixes for execution order:
01-init-roles.sql02-seed-config.py03-reference-data.sql
Files are executed alphabetically (not numerically parsed).
Execution Context
Bootstrap scripts run:
- Development: Each
patch apply(allows iteration on bootstrap) - Production: Initial
cloneonly (one-time setup)
For production data changes, use patches (not bootstrap).
Python Files
Python files can define a run(model) function to share the database connection:
def run(model):
# model is the halfORM Model instance with active connection
MyModel = model.get_relation_class('schema.table')
MyModel(field='value').ho_insert()
Without run(model), the file executes as a subprocess (must handle own connection).
SQL Files
SQL files can use any SQL commands:
-- Initialize roles
INSERT INTO public.roles (name) VALUES ('admin'), ('user');
Notes
- No tracking mechanism (files execute on every restore)
- Not idempotent (assumes empty database)
- Maintained manually by developers