Rorsch
DTDrizzle Team
•Created by Rorsch on 7/31/2024 in #help
findMany with custom field
Currently, I have a code to fetch order details by aggregating several tables (Order, Customer, and Order Line Items tables). I've read the documentation about
.findMany()
and this is what I'm able to do
The code currently can return something like below
I want to fetch name
from Service Table, and replace serviceId
with it where serviceId = service.id
. How can I achieve that? I've read https://orm.drizzle.team/docs/rqb#include-custom-fields but I still can't get it to work.5 replies
DTDrizzle Team
•Created by Rorsch on 7/23/2024 in #help
Fetch data based on client's timezone.
Currently, I have a postgres db, where my timestamp data is being saved as a
timestamp with timezone
type, with +0
timezone. I've been fetching my data with the code below
The problem I have, is that the system will group the data based on the DB server's timezone (in this case +0).
How can i update the code so that the data returned will always follow the client's timezone? For example, If the client is in UTC +9, then it should group the date after offsetting the timestamps by 9 hours.3 replies
DTDrizzle Team
•Created by Rorsch on 7/15/2024 in #help
How to Normalize Database using Drizzle?
I previously have made my Order Table to only support one service/line item back then (based on the business logic back then). Now, I need to normalize my database, so that it supports multiple services/line items in a single order. I have tried to write the migration file but it's not running.
13 replies
DTDrizzle Team
•Created by Rorsch on 7/3/2024 in #help
Altering existing table with Timestamp column to Timestamp with Timezone in Postgres using Drizzle
I have an existing table with columns such as
created_at
with data type of timestamp
. I want to update the column, so that every single timestamp
in my database will be timestamp with timezone
. I tried modifying db schema from JS by changing
to
When trying to push the changes, drizzle-kit warned me that my data will be lost.
What strategy that I can use to achieve this?1 replies
DTDrizzle Team
•Created by Rorsch on 4/16/2024 in #help
Selecting from 2 subqueries without using magic `sql()`
Is it possible to select 2 subqueries together using drizzle-orm? in my case, i want to return current month revenue and previous month revenue.
below is a working code
I'm just wondering if i can do it without using the magic sql
4 replies
DTDrizzle Team
•Created by Rorsch on 12/17/2023 in #help
net::ERR_NAME_NOT_RESOLVED showing multiple times on the console
Hello, I'm trying to do simple database access using drizzle orm. The data got fetched, but my console has been showing a lot of the error
index.js: POST https://undefined/psdb.v1alpha1.Database/Execute net::ERR_NAME_NOT_RESOLVED
This is the code that I use to fetch my data.
this is the db setup
and this is the drizzle.config.ts
32 replies
DTDrizzle Team
•Created by Rorsch on 12/16/2023 in #help
Error in SQL syntax when pushing schema
Hello, I'm trying to push my database schema to planetscale using
drizzle-kit push:mysql
, but I got the error below after confirming the execution. Can someone point out for me what did i do wrong?
this is my schema
and this is the SQL generated by drizzle-kit push:mysql
Thank you6 replies