Skip to content

feat(database): finalize operational schemas - #25

Merged
MagicTheDev merged 6 commits into
mainfrom
feat/remove-cwl-season-statistics
Sep 16, 2026
Merged

MagicTheDev merged 6 commits into
mainfrom
feat/remove-cwl-season-statistics

Conversation

@MagicTheDev

@MagicTheDev MagicTheDev commented Sep 10, 2026 •

Copy link
Copy Markdown
Member

Summary

  • remove the rejected CWL-only cwl_season_statistics surface in forward migration 016 while retaining canonical CWL and war storage
  • finalize battle storage in migration 017 with numeric mode/direction codes, non-null smallint durations, canonical share codes, and no hashes or compatibility columns
  • replace parallel aggregate schemas with unsuffixed day/cohort totals for legend_i, top_1000, and top_200
  • compact current/daily leaderboard storage, move notification categories and timings to user scope, and enforce verified-link account ownership
  • migrate bases to bigint identities with relational images, private votes/public counts, and retry-safe first-click enrichment
  • retain migration 018 unchanged in history, then supersede its numbered slots in migration 019 with unlimited user_saved_bases rows and nullable text war|legend labels
  • move lifetime first-download identity onto bases.downloads as an immutable Discord-user-to-ISO-timestamp JSON object, migrate existing timestamps, drop base_downloaders, and count unique JSON keys
  • remove obsolete hash contracts and cleanup tooling, and document exact Tracking/API/Bot/Dashboard/App contracts

Validation

  • goose -dir database/timescale validate
  • go test ./... from database/
  • clean disposable Timescale 001 -> 019: bash ../scripts/with-test-timescale.sh --profile retained-api -- env GOCACHE=/tmp/clashking-schemas-go-cache go test ./schema ./migrations -count=1
  • data-bearing disposable Timescale 013 -> 019: bash ../scripts/with-test-timescale.sh --profile baseline-013 -- env GOCACHE=/tmp/clashking-schemas-go-cache go test ./schema -run '^TestArmyCodeFamilyCompatibilityMigration$' -count=1 -v
  • populated personal-base Timescale 018 -> 019: bash ../scripts/with-test-timescale.sh --profile baseline-018 -- env GOCACHE=/tmp/clashking-schemas-go-cache go test ./schema -run '^TestPersonalBaseStorageMigration$' -count=1 -v
  • node --test scripts/with-test-timescale.test.mjs
  • env GOCACHE=/tmp/clashking-schemas-go-cache bash scripts/validate-repository.sh
  • actionlint .github/workflows/schema-upgrade.yml
  • git diff --check

Rollout boundary

This PR does not deploy or apply migrations. Migration 017 and migration 019 are irreversible and require coordinated final Tracking/API/Bot/App consumers before production execution. Migration 019 must be present before the API/App unlimited personal-base contract ships. Aggregate rows are rebuilt from retained raw attacks because the prior tables do not contain the final cohort/day semantics.

Migration 019 SQL SHA-256: 892a3639391311c0d34348be5679fdb1f7a70ce2cbf82fc3181d3a35e4aff11d.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@MagicTheDev MagicTheDev changed the title fix(database): remove CWL season statistics feat(database): finalize operational schemas Sep 11, 2026
@MagicTheDev
MagicTheDev merged commit 1e25d6e into main Sep 16, 2026
2 checks passed
@MagicTheDev
MagicTheDev deleted the feat/remove-cwl-season-statistics branch September 16, 2026 04:11
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