pecko0326
Explore posts from serversDTDrizzle Team
•Created by pecko0326 on 12/27/2024 in #help
Run migrations programatically
Is there a way to programatically run new migrations?
The use case for this would be in a testing scenario (if I'm not doing something completely wrong here):
- When running my tests I'd like to drop all of my existing tables in my database designated for testing
- Then I'd like to generate and push the migrations based on the existing schema to the database, which will create the empty tables
- Finally I'd like to seed the testing tables with some fake data that I can use as the starting point for my testing
I've found this github issue (https://github.com/drizzle-team/drizzle-orm/discussions/1901) mentioning the usage of the undocumented
generateDrizzleJson
and generateMigration
functions from the drizzle-kit/api
file. But when I use these functions in my tests setup file, I get the following error: Error: Dynamic require of "fs" is not supported
.
I'm using DrizzleORM v0.36.4; with NodeJS / Express application written in Typescript and using Vitest as the testing library.
Any solutions / workarounds to this? Is there any other way I could programatically run the migrations? I think this is somewhat commonly requested feature.3 replies
DTDrizzle Team
•Created by pecko0326 on 8/9/2024 in #help
MySQL Driver keeps asking for 'password' parameter
When trying to connect to my local MySQL database, to which I do not have any password setup, I get an error when running
drizzle-kit migrate
command.
Here's my drizzle.config.ts
file, I double checked the docs but I can't seem to figure out what I'm missing out:
In my .env file I have the fields setup, and the DB_PASSWORD
variable has an empty string value as there's no password associated with the database user.
The error that I get is Please provide required params for MySQL driver:
and the password
field is marked with an X and an empty string value.2 replies
DTDrizzle Team
•Created by pecko0326 on 3/14/2024 in #help
How to delete multiple rows whose value is contained in a list of values, at once?
If I want to delete multiple rows whose value (e.g. 'key') is included in a list of values, in raw SQL I can do something like this:
But, that seems to not be working correctly when using it in Drizzle, or I'm doing something completely wrong. Using MySQL.
Here's my code:
I tried also joining the keys to delete as a single string using
keysToDelete.join(",")
but that also didn't work.
The entries are not being removed from the database.
However if I want to check against a single value within the IN (...)
clause, it works fine.2 replies
TTCTheo's Typesafe Cult
•Created by pecko0326 on 3/13/2024 in #questions
Uploadthing Deleting files
Has anything changed regarding the provided Open API that we can use to send requests to from our own servers when we want to delete files? Previously it worked fine, sent the requests and files were being deleted from Uploadthing without providing the
X-Uploadthing-Version
header.
But now for some reason, I must include that header in order for my requests to actually delete the targeted file(s) based on the provided file keys.
Is this something that was changed recently, and if so, will we need to update the version anytime there's an update to the Uploadthing's API?2 replies