# Local database seed Anything in `nearledb/` or `cataloguedb/` is applied by Postgres, in filename order, **the first time the volume is created**. Editing a file later does nothing on its own — drop the volume to re-apply: ``` docker compose -f ../docker-compose.local.yml down -v ``` ## Why this is not optional Fiesta runs migrations on boot, and most of them assume tables that nothing in this repository creates: ``` ALTER TABLE products ADD COLUMN IF NOT EXISTS productimages ALTER TABLE products ADD COLUMN IF NOT EXISTS imageid ALTER TABLE productlocations ADD COLUMN IF NOT EXISTS publishedat ``` `AutoMigrate` covers only `stockrequests`, the two POS order tables and `staffshifts`. Against an empty database the first `ALTER` fails and `log.Fatal` stops the process — so a schema is required before the first run. ## Getting the schema Structure only, no data, no ownership: ``` pg_dump --schema-only --no-owner --no-privileges \ -h -p 5433 -U -d nearledb \ > nearledb/01-schema.sql ``` **Take the schema, not the data.** A dump with rows in it puts real customers, real orders and real (cleartext) passwords on a laptop, and this directory is inside a git repository. `.gitignore` excludes `*.sql` here for that reason. ## Getting something to test against An empty schema boots but has no tenants, so there is nothing to sign in as. Two options: - **Onboard a tenant through the console** once it is pointed at localhost. That exercises the real path and is usually what you want. - **Copy a few rows** you actually need — a tenant, its locations, its app_users — with `pg_dump --data-only --table=...`. Check what you are copying: `app_users.password` is stored in clear.