How to make scripts in a t3-stack app (with tsx and t3-env)?
I am trying to create a scripts folder to run things along my website and create tools, test things and all. I tried tsx with success, until I needed the env to be available (thus involving t3-env).
I am currently trying to do a small script to test inserting things in my database:
import { db } from "~/server/db";import { food } from "~/server/db/schema";await db.insert(food).values({ name: "Banana",});
import { db } from "~/server/db";import { food } from "~/server/db/schema";await db.insert(food).values({ name: "Banana",});
Until now, I did scripts that did not involve resources from the app but right now I would like to connect to my database but I get this error: