hopesix
Explore posts from serversTTCTheo's Typesafe Cult
•Created by hopesix on 4/3/2024 in #questions
Can't set env variables in package.json scripts?
So essentially I'm trying to run some test scripts (playwright for example) and I want to assign an env var like APP_ENV=test or something like that when I do, this way I can swap the database to a local testing db
src/server/db/index.ts 1:
I've seen several instances as I've been googling of people simply adding things to scripts like:
Example: https://stackoverflow.com/a/77810676/630988
But for some reason when I try and do this it doesn't work, my log results always show undefined as well if I don't have something pre-set in .env, and when something is pre set it never changes to test.
Note: I should mention I'm using Mac OSX, and I've also tried using
cross-env
and that also didn't work.
So I'm not sure if the src/env.js
file has something to do with this, but I've tried adding stuff in there as well and had no difference in results. I'm also not entirely sure how I could use that SKIP_ENV_VALIDATION or if it would even help. https://github.com/t3-oss/t3-env3 replies
DTDrizzle Team
•Created by hopesix on 2/7/2024 in #help
Can't edit datetime column in drizzle studio "Error: value.toISOString is not a function"
So I'm seeing my database with some data, and for the two
datetime
fields I've had a strange issue where I can ONLY submit as a javascript date object, even though in the schema it shows multiple options.
And then when I save as a JS Date and go into Drizzle Studio and try to edit it (even changing a single hour or minute) I get this error when I try and save:
And here's an example value of what is saved in the column 2024-02-07T08:17:36.000Z
Using PlanetScale as a DB, project started with create-t3-app
2 weeks ago
from my package.json
"drizzle-orm": "^0.29.3",
"drizzle-kit": "^0.20.9",
schema file (excerpt of bookings table)
When I hover over datetime
I see
However, when I try and save this in any way other than a javascript date (either new Date()
or using luxon .toJSDate()
) I get an error in my db insert values, here's where I've tried to return them as .toISO
with luxon for example. For some reason the error shows under the id
key and it took me a long time to debug that it was related to the startTime
and endTime
values.
I'm very confused here, from what I've read online I should be able to store ISO inside of datetime?6 replies
DTDrizzle Team
•Created by hopesix on 1/30/2024 in #help
Trying to rename empty table from "user" to "users" w/ push
Building an app using T3 stack w/ Drizzle and PlanetScale(MySQL)
Here's my current schema (at the bottom), I'm trying to rename
"user"
to "users"
and my table is completely empty. When I run "db:push": "drizzle-kit push:mysql"
I get
I've tried the second option to rename it and I get this back
No idea what is happening, since I'm working in development I don't mind deleting tables completely or wiping data from them frequently right now, so just curious, should I be handling this a different way? I generally thought if I did push
that it was going to rebuild the entire db based off my current schema ?
Full schema so far
2 replies
TTCTheo's Typesafe Cult
•Created by hopesix on 1/24/2024 in #questions
T3 Drizzle Questions: Push, Migrate, Etc
Apologies I'm still pretty new to using ORM's, I've only worked with Prisma a few times in the past as well.
When I say, add a new table, or add a new column to a table, I simply need to call
pnpm db:push
afterwards and it'll push that up to PlanetScale for me.
So when exactly would I need to deal with Migrations with Drizzle Kit..?3 replies
TTCTheo's Typesafe Cult
•Created by hopesix on 1/18/2024 in #questions
T3 tRPC tutorials/videos show useQuery / useMutation, but I only see query / mutate?
6 replies