francis
Explore posts from serversDTDrizzle Team
•Created by francis on 9/20/2024 in #help
How do you define two tables that have foreign keys to each other? drizzle-kit introspect fails
created issue for mutual foreign keys: https://github.com/drizzle-team/drizzle-orm/issues/2993
created issue for introspect reversing column order: https://github.com/drizzle-team/drizzle-kit-mirror/issues/574
5 replies
DTDrizzle Team
•Created by francis on 9/20/2024 in #help
How do you define two tables that have foreign keys to each other? drizzle-kit introspect fails
note that:
- this doesn't compile due to the mutual references causing type errors in inference
- in addition, the generated
testKey
on child
has the columns in inverse order5 replies
DTDrizzle Team
•Created by francis on 9/20/2024 in #help
How do you define two tables that have foreign keys to each other? drizzle-kit introspect fails
generated schema that fails:
5 replies
DTDrizzle Team
•Created by francis on 9/20/2024 in #help
How do you define two tables that have foreign keys to each other? drizzle-kit introspect fails
sql source to generate tables:
5 replies
DTDrizzle Team
•Created by terryball on 3/14/2024 in #help
Type error working with Postgres dates in v.0.30.1
this has been resolved for ages now I think
9 replies
DTDrizzle Team
•Created by Mosch on 8/12/2024 in #help
defaultFn when using magic sql is not applying
check your table DDL to see if you have a default defined
14 replies
DTDrizzle Team
•Created by Mosch on 8/12/2024 in #help
defaultFn when using magic sql is not applying
that would be why
14 replies
DTDrizzle Team
•Created by Mosch on 8/12/2024 in #help
defaultFn when using magic sql is not applying
oh, do you not have a default defined at the sql level
14 replies
DTDrizzle Team
•Created by CrashChicken on 8/13/2024 in #help
Using default values removes columns from insert and update types
in general, turn strict mode on
14 replies
DTDrizzle Team
•Created by CrashChicken on 8/13/2024 in #help
Using default values removes columns from insert and update types
ah yep that'll do it
14 replies
DTDrizzle Team
•Created by CrashChicken on 8/13/2024 in #help
Using default values removes columns from insert and update types
and what is the type generated by
typeof testSchema.$inferSelect
and typeof testSchema.$inferInsert
14 replies
DTDrizzle Team
•Created by CrashChicken on 8/13/2024 in #help
Using default values removes columns from insert and update types
interesting. what driver?
14 replies
DTDrizzle Team
•Created by Mosch on 8/12/2024 in #help
defaultFn when using magic sql is not applying
not sure what sql flavor you are using but at least for postgres, you have to explicitly list the columns you are inserting into if you want to skip some and have it filled by default: "The target column names can be listed in any order. If no list of column names is given at all, the default is all the columns of the table in their declared order; or the first N column names, if there are only N columns supplied by the VALUES clause or query. The values supplied by the VALUES clause or query are associated with the explicit or implicit column list left-to-right."
14 replies
DTDrizzle Team
•Created by Chris Soul on 8/9/2024 in #help
Does introspect only generate schema in the "out" (./drizzle) directory?
I recommend setting that sort of thing up since it's relatively easy to do and have it be consistent
14 replies
DTDrizzle Team
•Created by Chris Soul on 8/9/2024 in #help
Does introspect only generate schema in the "out" (./drizzle) directory?
postprocess-pulled-schema
is an intermediate step I put in that runs sed
over the output to change some things - e.g. introspect always pulls timestamp columns in 'string' mode, so I have "shx sed -i \"s/mode: 'string'/mode: 'date'/\" drizzle/schema.ts",
to fix those14 replies
DTDrizzle Team
•Created by Chris Soul on 8/9/2024 in #help
Does introspect only generate schema in the "out" (./drizzle) directory?
(in a package.json script)
14 replies
DTDrizzle Team
•Created by Chris Soul on 8/9/2024 in #help
Does introspect only generate schema in the "out" (./drizzle) directory?
"drizzle-kit introspect && npm run postprocess-pulled-schema && mv drizzle/schema.ts src/lib/db/schema.ts",
14 replies
DTDrizzle Team
•Created by Chris Soul on 8/9/2024 in #help
Does introspect only generate schema in the "out" (./drizzle) directory?
here's my commands, fyi
14 replies
DTDrizzle Team
•Created by Chris Soul on 8/9/2024 in #help
Does introspect only generate schema in the "out" (./drizzle) directory?
it's always been that way for me, I have a package script to generate the schema and copy it to the target
14 replies
DTDrizzle Team
•Created by Jaymal on 4/4/2024 in #help
Timestamp formatted differently if fetched as relation rather than directly
tl;dr is that the relational query system casts the rows to json, and postgres to_json on a timestamp converts it to ISO, where a plain select returns it in sql timestamp format
19 replies