Asseater Peter
Explore posts from serversDTDrizzle Team
•Created by ale3xdyo on 8/14/2023 in #help
Bug: drizzle-kit generate:pg didn't see the changes in the schema
Well, seems like it's not supported right now, not sure what else I can do here tbh
9 replies
DTDrizzle Team
•Created by Zamiel on 8/14/2023 in #help
What is the Drizzle convention for storing the `db` object?
t3-env is checking my environment variables on the build step too, so I know for certain that if the code deployed those variables are in my environment and I can safely import them from my env file
57 replies
DTDrizzle Team
•Created by Zamiel on 8/14/2023 in #help
What is the Drizzle convention for storing the `db` object?
I don't see what you mean?
I'm using t3-env for my environment, could that be the confusion?
57 replies
DTDrizzle Team
•Created by SteveS on 8/14/2023 in #help
Drizzle-Kit: incorrect schema.ts being used
happens ¯\_(ツ)_/¯
4 replies
DTDrizzle Team
•Created by Zamiel on 8/14/2023 in #help
What is the Drizzle convention for storing the `db` object?
Abstract classes are really neat and useful and not enough people use them in ts sadly
57 replies
DTDrizzle Team
•Created by Zamiel on 8/14/2023 in #help
What is the Drizzle convention for storing the `db` object?
So, my abstract controller is the one making the connection, then every member inherits it with the db connection
57 replies
DTDrizzle Team
•Created by Zamiel on 8/14/2023 in #help
What is the Drizzle convention for storing the `db` object?
https://github.com/yuval59/twitch-stats-server
Here's the repo, you need src/db/controllers
57 replies
DTDrizzle Team
•Created by Zamiel on 8/14/2023 in #help
What is the Drizzle convention for storing the `db` object?
If you want to see an implementation of it, I believe I have a public repo using it gimme a sec and I'll find it
57 replies
DTDrizzle Team
•Created by SteveS on 8/14/2023 in #help
Drizzle-Kit: incorrect schema.ts being used
Could you share some more info?
The drizzle config, file structure, are you using a central schema file or glob?
4 replies
DTDrizzle Team
•Created by Zamiel on 8/14/2023 in #help
What is the Drizzle convention for storing the `db` object?
I came up with this solution tho, so there might be a better pattern available. However, from fiddling around and thinking about it (quite a lot, actually) I haven't come up with any better ideas
57 replies
DTDrizzle Team
•Created by Zamiel on 8/14/2023 in #help
What is the Drizzle convention for storing the `db` object?
So I'm actually never directly interfacing with the connection variable outside of my classes, and the classes themselves inherit it from the abstract class which is only responsible for that one thing.
Type inference is therefore super easy and the errors are quite useful
57 replies
DTDrizzle Team
•Created by Zamiel on 8/14/2023 in #help
What is the Drizzle convention for storing the `db` object?
Sort of?
It's a singleton, but every one of my controllers is a separate singleton inheriting a specific parent's connection
57 replies
DTDrizzle Team
•Created by Eidur on 8/14/2023 in #help
Group by Multiple columns with drizzle
Yeah that's how I'd do it (tho I haven't tried it in a hot minute)
Is it working?
4 replies
DTDrizzle Team
•Created by Zamiel on 8/14/2023 in #help
What is the Drizzle convention for storing the `db` object?
So, two things:
First, I highly recommend giving https://env.t3.gg/docs/introduction a look, it is excellent
Second, @zamiel did you give my solution a look? It's been in prod for me for about a month with no issues, and the DX is pretty solid
57 replies
DTDrizzle Team
•Created by ale3xdyo on 8/14/2023 in #help
Bug: drizzle-kit generate:pg didn't see the changes in the schema
Could you share the whole table declaration + schema file if you have one? I haven't personally had this issue before, but something is bound to jump out at me
9 replies
DTDrizzle Team
•Created by ale3xdyo on 8/14/2023 in #help
Bug: drizzle-kit generate:pg didn't see the changes in the schema
Can you confirm that it's 100% seeing this file?
9 replies
DTDrizzle Team
•Created by Zamiel on 8/14/2023 in #help
What is the Drizzle convention for storing the `db` object?
I had the same problem, but I think I have a bit of a more elegant solution (Tho I did actually do exactly what @mr_pablo_85 suggested for a while)
My current project has
controllers
for each table (UserController, MessageController), so I did this:
I have an abstract class controller
that looks like this:
And then whenever I need a new controller I extend the abstract class and go from there;
Example use:
57 replies
DTDrizzle Team
•Created by Jumaron on 8/9/2023 in #help
Planetscale Serverless for Relational queries
You can! The Drizzle Team have the docs site repo on GitHub as well!
40 replies
DTDrizzle Team
•Created by Jumaron on 8/9/2023 in #help
Planetscale Serverless for Relational queries
I'm 100% certain that this is just not true.
Just set up the ORM for PlanetScale like the docs say and then use relational queries. Should work perfectly fine.
40 replies
DTDrizzle Team
•Created by azn4lifee on 8/8/2023 in #help
How can I declare a relationship with a SELECT statement?
Note: as we've figured out today, this only works on many-to-x relations and you can only use the
where
clause on the many
side i.e. user -> messages
but not message -> sender
8 replies