updates on the ai agents and time series prediction and updates on the api to

This commit is contained in:
2026-10-09 13:50:30 +05:30
parent 29690c56f2
commit 153be40e5c
42 changed files with 4889 additions and 186 deletions

View File

@@ -0,0 +1,29 @@
cmd/migratecheck — run the real migration against a throwaway Postgres.
The test suite never calls migrations.Migrate(): the integration tests
AutoMigrate only the models they need. So every raw statement at the end of
migrations/migrate.go — CREATE EXTENSION, the views, the indexes, the registry
seed — was unexecuted until this existed, and Migrate() logs those failures
NON-FATALLY. A broken view therefore returned "migration completed
successfully" and failed later at query time.
That is not hypothetical: it caught `bd.destinationid` (the real column is
bookingdestinationid), which would have left consignment_booking uncreated and
every query that joins through it failing in production.
Run it before shipping a migration change:
docker run -d --name dm-testpg -e POSTGRES_PASSWORD=test -e POSTGRES_DB=logistics \
-p 55432:5432 pgvector/pgvector:pg16
docker exec dm-testpg psql -U postgres -d logistics -c "CREATE EXTENSION IF NOT EXISTS vector;"
MIGRATE_CHECK_DSN="host=localhost port=55432 user=postgres password=test dbname=logistics sslmode=disable" \
go run ./cmd/migratecheck
Check the OUTPUT, not just the exit code — Migrate() returns OK on a logged
failure. Any ❌ or ⚠️ line is a statement that did not run.
The same DSN unskips 50 Postgres integration tests:
REGISTRY_TEST_DSN="host=localhost port=55432 user=postgres password=test dbname=logistics sslmode=disable" \
go test ./... -count=1