Seeding the Local database - RodrigoMattosoSilveira/EnterpriseRemoteSystems GitHub Wiki

Introduction

This is a local development/manual testing utility that lets you reset backend/data/app.db and load realistic operational data without depending on E2E-created synthetic records.

This is a link to a description of how to reset the local database, now deprecated by this page's content.

Brief description

Uses:

Makefile
scripts/seed-manual-testdata.py

Make targets:

make manual-testdata-local-reset
make manual-testdata-local-seed
make manual-testdata-local-reset-no-work-periods

Recommended normal use:

make manual-testdata-local-reset
python3 scripts/verify-manual-testdata.py

This script will:

  1. Deletes backend/data/app.db
  2. Runs all migrations
  3. Seeds the manual-test dataset

To seed an already-migrated local DB without deleting it:

make manual-testdata-local-seed

To reset and seed people/collaborators/reference/transactions but skip work periods:

make manual-testdata-local-reset-no-work-periods

The script uses stable manual-* IDs and deletes/replaces only previous manual seed rows, so it is safe to rerun for local development. It does not delete E2E ers-testdata-* rows unless you reset the database first.

Database Content

The seed dataset includes:

Reference data

  Cantina/Canteen price-list items
  Sectors
  Locations
  Tasks
  Mines: North, South
  Periods: Day, Night
  Availability: A, D, L

People

  70 total
  40 Active
  25 Inactive
   5 Deactivated

Collaborators

  40 total
  Journey dates between today and the prior 90 days
  16 commission earners
  16 daily wage earners
   8 salary earners

Work Periods

  14 recent Work Periods
  12 posted/with accruals
   2 pending input / waiting for gold production

Gold production

  Two wells/mines
  Around 38g per well per day

Transactions

  80 expense records
  15 PIX ledger remittance records
  Ledger entries
  Receipt lifecycle samples
  Gold prices
  Posted accrual runs/items

Important domain note: the script keeps PIX as current-account ledger remittance transactions, not normal expense-category rows.