Creating CLI for interacting with prisma database

Hi! I'm looking to write a little script in my create-t3-app which would allow me to easily add an entry to the database. I don't want this exposed in the web app, and I think it's inconvenient to just add a function call which runs once that I then, later delete. Is there any way for me to just create a .ts file which I can run in isolation in the project? Maybe parse some command line arguments and such?
6 Replies
Piotrek
Piotrek3y ago
you can create a .ts file and run it with ts-node <filename>.ts just instantiate the client in this file and you'll be good
Vincent Udén
Vincent Udén3y ago
Ah, thanks a lot! Was looking around a bit for how to run a standalone ts file, thanks!
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Vincent Udén
Vincent Udén3y ago
Ooooh, these are for sure out of scope for this little thing. But I'm almost a 100% sure I'll use one or both of these in the future, looks really fun!
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Vincent Udén
Vincent Udén3y ago
For sure, Ive mostly been doing it in Python and Haskell before. Anything but the weird bash syntax is fine by me. Efficieny and portability doesnt really matter at all when its just tiny little scripts for my own setup
Want results from more Discord servers?
Add your server