nr7751
Explore posts from serversDTDrizzle Team
•Created by nr7751 on 6/18/2024 in #help
Drizzle kit generating migrations but not migrating, claiming all remains the same
Can anybody help? I changed my schema to add 1 column to 2 new tables. I hadn’t updated kit in a long while, which I had to do. After all the updating, migration files show these 2 new columns. And when I run drizzle generate it works fine and generates teh migrations files but MIgrate claims db is teh same and does nothing.
shoudl I go for push, instead?
Thanks in advance
6 replies
DTDrizzle Team
•Created by nr7751 on 5/3/2024 in #help
Columns are being stringified at random
Hi everyone.
In my JSON response object , some numeric fields are being turned into strings, whereas otehr fileds are kept in their oiginal numeric format. Why? Is this a config problem? Can I do somethign about it? The schema is correctly typed, but when I fetch some fields get turned into text whereas others do not.
Thanks in advance for any help
!
For context, this is the fucntion:
For example, price is a number, but is being returned as a string. Personnel is a number and is being returned as a number.
I can't figure this out.
4 replies
DTDrizzle Team
•Created by nr7751 on 5/2/2024 in #help
( sql question ) How do you join full tables with select columns from other table?
Hi everyone. I'm new to Drizzle. I have this TypeScript function:
I realize this is a basic SQL question. This is currently returning one object of services and another of serviceProfiles per entry in the services table. Bear in mind there is one serviceProfile per services entry, in a one-to-one relationship.
Instead of two separate objects per each entry of services table, how can I return a single object with all entries of services table plus select columns from serviceProfiles table, all merged into a single object per services table entry?
Thanks in advance!
4 replies
DTDrizzle Team
•Created by nr7751 on 4/1/2024 in #help
Drizzle spontaneously trying to truncate my db
Today I opened up Drizzle Studio, connected to my Vercel Postgres database, and a modal popped up saying: 'Database truncation Deleting 57 rows from 17 tables.'
Now, I do have 17 tables and 57 entries but did not ask for anything to be truncated or deleted. This is completely spontaneous and extremely undesired. What sparked this action? Is there a setting on my Vercel Database or in Drizzle config I should be aware of?
I certainly don't want Drizzle spontaneously clearing out my Database.
Any help would be extremely appreciated.
Thanks in advance!
21 replies
DTDrizzle Team
•Created by nr7751 on 3/5/2024 in #help
Enum breaking schema
Hi everyone,
In a Next.js / Vercel PostgreSQL database, I'm encountering migration errors with a part of the schema:
javascript
Copy code
export const daysOfWeekEnum = pgEnum("days_of_week", [
"sunday",
"monday",
"tuesday",
"wednesday",
"thursday",
"friday",
"saturday",
]);
export const timeSlotsEnum = pgEnum("time_slots", ["morning", "afternoon", "evening"]);
export const providerAvailabilities = pgTable("provider_availabilities", {
id: serial("id").primaryKey(),
providerId: integer("provider_id")
.notNull()
.references(() => providers.id),
day: integer("day").notNull(),
timeSlot: timeSlotsEnum("time_slot").notNull(),
});
It throws this error:
vbnet
Copy code
Error: Database migration failed
error: column "day" cannot be cast automatically to type days_of_week
and this hint:
vbnet
Copy code
hint: 'You might need to specify "USING day::days_of_week".',
This column was previously an integer. If I revert back to an integer, it still throws the same error. So I'm stick.
IIf I delete the column , it still throws the error about the enum. Can anybody tell me what's going on?
Any help would be greatly appreciated.
Thanks in advance!
1 replies
DTDrizzle Team
•Created by nr7751 on 2/27/2024 in #help
Basic config problems - can't get Drizzle to start
4 replies
DTDrizzle Team
•Created by nr7751 on 2/26/2024 in #help
Can someone direct me to a UUID implementation as PK with Drizzle ORM?
Hello eveyone. I'm trying to create a user table in a Vercel Postgres db, but keep running into errors.
Could anyone kindly provide guidance,? An example would be perfect.
I'm looking for a schema of sorts.
Any help will be greatly appreciated!
25 replies
DTDrizzle Team
•Created by nr7751 on 2/23/2024 in #help
Password hashing in Drizzle schema
Hi everyone,
I'm looking at ways to hash the password in the "user" table and define them in the Drizzle ORM schema defining a Vercel Postgres database. I have not been able to find documentation on the topic.
Could anyone kindly provide some guidance? Any help would be greatly appreciated.
Thanks in advance!
8 replies
DTDrizzle Team
•Created by nr7751 on 2/22/2024 in #help
Data being uploaded , schema not updating
6 replies