v0.8.2 β Prisma importer correctness + JSON defaults
Fixed
prax-import(Prisma) β@defaultvalue round-trip. The Prisma
importer now emits.praxoutput that reparses. Three underlying bugs
were fixed together:- String literal defaults (
@default("standard")) no longer round-trip
as doubled quotes (@default(""standard"")). The source quote
characters are stripped before stashing inAttributeValue::String. - Bare-identifier defaults on enum fields (
@default(PENDING)) now map
toAttributeValue::Identinstead ofAttributeValue::String. The
emitter was writing them as quoted string literals, which the parser
rejected on an enum-typed field. dbgenerated("uuid_to_text(id)")arguments are unquoted the same way
so they don't double-quote either.
- String literal defaults (
prax-import(Prisma) β pgvector columns. Prisma models pgvector
columns viaUnsupported("vector(N)"). The importer now recognizes
the four pgvector shapes (vector(N),halfvec(N),sparsevec(N),
bit(N)) inside theUnsupported(β¦)payload and translates them to
the matchingScalarType::Vector(β¦)/HalfVector(β¦)/SparseVector(β¦)
/Bit(β¦)variants. The emitter prints the dimension via the
@dim(N)attribute that the schema parser already accepts.prax validateβ diagnostic rendering. The CLI now renders schema
errors viamiette::Reportwith the source attached, so the specific
prax::schema::invalid_field,unknown_type, etc. diagnostic is
visible. Previously every parse or validation failure surfaced as the
same bare "syntax error in schema" string, which hid the actionable
detail.prax-schemavalidator βJsondefault values. The validator now
acceptsString,Array,Boolean,Int, andFloatpayloads as
the@defaultof aJson-typed field. Prisma encodes JSON defaults
as quoted text literals (@default("[]"),@default("{}")), which
are valid because Postgres parses the text intojsonbat insert
time β the old validator only acceptedStringdefaults on
String-typed fields, rejecting every JSON default outright.
Motivation
Discovered importing the Lexmata schema.prisma (71 models, 33 enums,
1,149 fields, 226 relations) as part of LD-15 / LX-33 β the
admin-backend is adopting Prax as its in-tree ORM and needed a
committable schema.prax regenerated from the authoritative Prisma
schema. The import was failing and the generic "syntax error" message
was masking four distinct bugs; each is now a named regression test.