Commit graph

7 commits

Author SHA1 Message Date
Tracewebstudio Dev
65262e842c fix(db): add missing ai_credit_orders columns + ai_coupons tables
All checks were successful
build-and-release / build (cron) (push) Successful in 1m0s
build-and-release / build (catering-services) (push) Successful in 1m53s
build-and-release / build (companies) (push) Successful in 2m2s
build-and-release / build (employees) (push) Successful in 2m17s
build-and-release / build (developers) (push) Successful in 2m32s
build-and-release / build (customers) (push) Successful in 2m39s
build-and-release / build (gateway) (push) Successful in 1m4s
build-and-release / build (fitness-trainers) (push) Successful in 2m38s
build-and-release / build (graphic-designers) (push) Successful in 1m49s
build-and-release / build (makeup-artists) (push) Successful in 1m37s
build-and-release / build (jobs) (push) Successful in 1m44s
build-and-release / build (job-seekers) (push) Successful in 2m57s
build-and-release / build (social-media-managers) (push) Successful in 1m43s
build-and-release / build (payments) (push) Successful in 2m47s
backend-integration-tests / ai-credits (push) Successful in 52s
build-and-release / build (photographers) (push) Successful in 2m57s
build-and-release / build (ugc-content-creators) (push) Successful in 2m31s
build-and-release / build (tutors) (push) Successful in 2m53s
build-and-release / build (video-editors) (push) Successful in 2m33s
build-and-release / build (users) (push) Successful in 4m52s
20260814000000: add coupon_code + discount_applied to ai_credit_orders
CREATE TABLE — create_order inserts both columns but the original
migration omitted them.

20260814020000 (new): create ai_coupons + ai_coupon_redemptions, the
tables referenced by create_order/verify_order in ai_credits.rs.
Extracted from the skipped 20260706300000 migration which couldn't be
enabled because it referenced ai_credit_orders before that table existed.

Runbook updated with the 3 pending prod migrations and redeploy step.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-08-13 23:10:40 +02:00
Tracewebstudio Dev
0e2bbd34eb docs: mark DB migrations as completed in runbook
All checks were successful
build-and-release / build (cron) (push) Successful in 4s
build-and-release / build (employees) (push) Successful in 4s
build-and-release / build (fitness-trainers) (push) Successful in 5s
build-and-release / build (gateway) (push) Successful in 7s
build-and-release / build (developers) (push) Successful in 17s
build-and-release / build (companies) (push) Successful in 19s
build-and-release / build (catering-services) (push) Successful in 21s
build-and-release / build (customers) (push) Successful in 20s
build-and-release / build (graphic-designers) (push) Successful in 7s
build-and-release / build (job-seekers) (push) Successful in 7s
build-and-release / build (jobs) (push) Successful in 7s
build-and-release / build (makeup-artists) (push) Successful in 7s
build-and-release / build (photographers) (push) Successful in 6s
build-and-release / build (payments) (push) Successful in 11s
build-and-release / build (tutors) (push) Successful in 7s
build-and-release / build (social-media-managers) (push) Successful in 11s
build-and-release / build (ugc-content-creators) (push) Successful in 7s
build-and-release / build (users) (push) Successful in 7s
build-and-release / build (video-editors) (push) Successful in 7s
backend-integration-tests / ai-credits (push) Successful in 10s
All four DB tasks confirmed applied to production (2026-08-13):
- wallet_full migration re-enabled
- ai_credits_wallet migration rewritten as idempotent and applied
- TIMESTAMP → TIMESTAMPTZ fix for 9 AI table columns
- nxtgauge_test DB + Forgejo CI secret wired

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-08-13 21:32:48 +02:00
Ashwin Kumar Sivakumar
da9be7f6a3 feat(db,ci): fix missing ai_credits tables, wire integration tests to CI
Some checks failed
build-and-release / build (cron) (push) Successful in 1m10s
build-and-release / build (developers) (push) Successful in 1m40s
build-and-release / build (catering-services) (push) Successful in 1m58s
build-and-release / build (employees) (push) Successful in 2m19s
build-and-release / build (companies) (push) Successful in 2m36s
build-and-release / build (customers) (push) Successful in 2m45s
build-and-release / build (gateway) (push) Successful in 1m11s
build-and-release / build (jobs) (push) Successful in 40s
build-and-release / build (fitness-trainers) (push) Successful in 2m28s
build-and-release / build (graphic-designers) (push) Successful in 2m14s
build-and-release / build (payments) (push) Successful in 1m48s
build-and-release / build (job-seekers) (push) Successful in 2m57s
build-and-release / build (makeup-artists) (push) Successful in 2m49s
build-and-release / build (photographers) (push) Successful in 2m43s
backend-integration-tests / ai-credits (push) Failing after 31s
build-and-release / build (social-media-managers) (push) Successful in 2m58s
build-and-release / build (tutors) (push) Successful in 2m47s
build-and-release / build (ugc-content-creators) (push) Successful in 2m39s
build-and-release / build (users) (push) Has been cancelled
build-and-release / build (video-editors) (push) Has been cancelled
Re-enables and corrects 20260703210000_ai_credits_wallet, which had been
disabled (.up.sql.skip) in commit 0163349 because 'relation already
exists' aborted the original CREATE TABLE script on its very first
table (ai_plans) - silently leaving ai_credit_ledger and
ai_reservation_holds never created, despite the wallet system being
actively wired into apps/users/handlers/ai_credits.rs, apps/payments,
apps/cron with real subscription rows already in prod.

Rewrote the migration to be idempotent: ADD COLUMN IF NOT EXISTS to
bring ai_plans/user_ai_subscriptions/ai_feature_costs/ai_usage_logs up
to the full column set crates/db/src/models/ai_credits.rs expects
(safe zero/default backfills, no data loss - verified against the 3
existing subscription rows), and CREATE TABLE IF NOT EXISTS for the 2
genuinely-missing tables. down.sql updated to only reverse what this
corrected version actually adds, not drop tables that predate it.

Applied directly to the live database (verified schema + existing rows
intact afterward).

Also wires crates/db/tests/ai_credits.rs + ai_credits_reaper.rs to
Forgejo Actions CI (docs/LIVE_SERVER_RUNBOOK.md step 6):
- New TEST_DATABASE_URL repo secret, pointing at a dedicated
  nxtgauge_test database (created fresh, schema mirrored from live prod
  via pg_dump --schema-only - never runs against the real nxtgauge DB).
- .forgejo/workflows/test.yaml: runs on push to main/high-performance,
  skips when crates/db/ isn't touched, cargo test -p db --test
  ai_credits --test ai_credits_reaper -- --test-threads=1.

Also commits docs/openapi.wallet-holds.json (hand-written minimal
OpenAPI spec used for schemathesis fuzzing in step 4) and gitignores
the local .schemathesis/ cache directory from that run.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-13 17:31:22 +05:30
Tracewebstudio Dev
9e37060737 docs: add live server runbook
All checks were successful
build-and-release / build (cron) (push) Successful in 12s
build-and-release / build (customers) (push) Successful in 16s
build-and-release / build (employees) (push) Successful in 15s
build-and-release / build (companies) (push) Successful in 18s
build-and-release / build (developers) (push) Successful in 17s
build-and-release / build (catering-services) (push) Successful in 19s
build-and-release / build (fitness-trainers) (push) Successful in 5s
build-and-release / build (graphic-designers) (push) Successful in 7s
build-and-release / build (gateway) (push) Successful in 6s
build-and-release / build (job-seekers) (push) Successful in 6s
build-and-release / build (makeup-artists) (push) Successful in 8s
build-and-release / build (jobs) (push) Successful in 9s
build-and-release / build (payments) (push) Successful in 7s
build-and-release / build (photographers) (push) Successful in 6s
build-and-release / build (social-media-managers) (push) Successful in 7s
build-and-release / build (ugc-content-creators) (push) Successful in 7s
build-and-release / build (tutors) (push) Successful in 8s
build-and-release / build (video-editors) (push) Successful in 7s
build-and-release / build (users) (push) Successful in 9s
Covers everything that needs a running DB/server:
- Deploy the backend changes (wallet holds, printpdf upgrade)
- Verify /wallet/me/holds endpoint with curl
- cargo audit + cargo deny check
- Schemathesis API fuzzing setup
- Playwright e2e tests
- CI integration tests with TEST_DATABASE_URL
- npm run lint and tsc --noEmit

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-08-12 13:39:36 +02:00
Ashwin Kumar Sivakumar
c85e6af22e feat(ai): complete AI plans/credits implementation and build tooling
- Add AI plans, credits, model routing, LiteLLM client, and orchestrator services
- Add AI management endpoints, auto-apply/auto-request handlers, and log endpoints
- Add cron jobs for daily action reset and monthly credit reset
- Add AI credit purchase flow in payments service
- Add ai_credit_packages migration with seed data
- Update Dockerfile build tooling across services
2026-06-15 06:15:49 +05:30
Tracewebstudio Dev
03376b9567 feat: Add database redesign documentation and Phase 1-2 migrations
- Add schema_audit.md documenting current schema issues
- Add target_schema.md with complete target schema design
- Add old_to_new_mapping.md with table mapping
- Add migration_plan.md with phased migration strategy
- Add Phase 1 migrations (core infrastructure):
  - user_sessions table
  - users missing columns
  - departments updates
  - designations updates
  - employees updates
- Add Phase 2 migrations (profile domain - CRITICAL):
  - create user_role_profiles root table
  - backfill user_role_profiles from existing profiles
  - add user_role_profile_id to extension tables
  - remove forbidden external portfolio links
- Add user_role_profile Rust model
- Update photographer model to use user_role_profile_id
2026-04-12 23:21:11 +02:00
Ashwin Kumar
20684655d7 chore: bootstrap rust backend workspace and migration master plan 2026-03-16 22:23:58 +01:00