Skip to content

feat(db): make seed_demo_db.sql idempotent and execute seed.py in docker-compose migrations - #46

Merged
getdownandcode merged 2 commits into
mainfrom
feat/docker-compose-seed
Oct 1, 2026
Merged

getdownandcode merged 2 commits into
mainfrom
feat/docker-compose-seed

Conversation

@getdownandcode

Copy link
Copy Markdown
Owner

Summary

  • Added ON CONFLICT (id) DO NOTHING; to products and orders insert statements in scripts/seed_demo_db.sql for strict idempotency across multiple runs.
  • Created scripts/seed.py standalone database seeding script with CLI arguments and programmatic seed_database helper.
  • Updated examples/demo.py to delegate demo database seeding to scripts.seed.seed_database.
  • Updated Dockerfile to copy scripts/ into the runtime container image.
  • Updated docker-compose.yml migrations service command to ["sh", "-c", "alembic upgrade head && python scripts/seed.py"].
  • Added integration test tests/integration/test_seed.py verifying repeated runs succeed cleanly without duplicate rows or integrity errors.

Verification

  • ruff check . passed
  • ruff format --check . passed
  • mypy agentkit tests examples scripts passed
  • pytest --cov=agentkit --cov-fail-under=85 passed (91.58% coverage)
  • docker compose config passed

@getdownandcode getdownandcode left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM: Strict review complete.

  • seed_demo_db.sql is now fully idempotent using ON CONFLICT (id) DO NOTHING;.
  • scripts/seed.py provides clean async execution with proper transaction context and resource disposal.
  • Dockerfile copies scripts to the runtime image.
  • docker-compose.yml automatically runs python scripts/seed.py after migrations.
  • Tested and verified with tests/integration/test_seed.py and docker compose config.

@getdownandcode
getdownandcode merged commit 50b4e25 into main Oct 1, 2026
1 check passed
@getdownandcode
getdownandcode deleted the feat/docker-compose-seed branch October 1, 2026 06:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant