fix(seed): handle finite FK generation feedback#37
Merged
Conversation
StructLint — All checks passed168 rules validated against
|
ff48cbe to
5f24e38
Compare
6d6f95e to
d1add2b
Compare
…ress
Faker mapping/generation:
- temporal primary-key columns get a real date/time/datetime instead of a
sequential integer (a DATE in a composite PK was seeded as "1")
- UNIQUE numeric/temporal columns get a collision-free monotonic sequence (the
numeric analog of uuid) — they previously got a uuid string a numeric column
can't store ("Data truncated"), or a random number that collides at high row
counts ("Duplicate entry")
- decimal/numeric generators are sized to the declared precision/scale: scale-0
columns get integers, small-precision columns are bounded so values never
exceed the column ("Out of range value")
Serve UI:
- stream per-table progress during truncate, mirroring the insert phase
Tests/docs:
- unit + integration coverage (Postgres & MySQL) for temporal PKs, unique
numeric/temporal columns at volume, precision-bounded fixed-point, and
per-table truncate progress
- README and docs/schema.md updated
d1add2b to
e2f2f29
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Generate values that fit the column type & constraints
DATEin a composite PK was seeded as1→Incorrect date value)sequence— the numeric analog ofuuid. They previously got auuidstring a numeric column can't store (Data truncated), or a randomnumber()that collides at high row counts (Duplicate entry)decimal/numericgenerators are sized to the declared precision/scale: scale-0 columns get integers, and small-precision columns (e.g.decimal(3,2)) are bounded so values never exceed the column (Out of range value)docs/schema.mdmapping rules updated to matchServe UI
Tests (TDD: reproduced before fixing)
internal/fakerfor every mapping/PK path, plus money-type, precision-bounded decimal, and a 5000-row unique-sequence no-collision checkTests
go test ./internal/...→ 437 passcd integration && go test -tags integration -count=1 ./...→ pass on Postgres + MySQLgo build ./...