circles
circles
TTCTheo's Typesafe Cult
Created by circles on 2/9/2023 in #questions
What's the best way to synchronize the DB Schema when using T3 Stack with Prisma??
I'm using docker to build the T3 app alongside with the prisma client, https://create.t3.gg/en/deployment/docker/, but I cannot really push my schema to the db
8 replies
TTCTheo's Typesafe Cult
Created by circles on 12/10/2022 in #questions
How to make MUI TimePicker use UTC? (I really need this help)
Already specified, but thanks anyway. It has to be done in MUI rn.
3 replies
TTCTheo's Typesafe Cult
Created by Lopen on 11/25/2022 in #questions
does using github co pilot always makes me a noob ?
yeah it requires pro, however if you're a student you can get it for free with the github students pack
10 replies
TTCTheo's Typesafe Cult
Created by Lopen on 11/25/2022 in #questions
does using github co pilot always makes me a noob ?
Probably not, as long as you're critically and actively thinking what you're doing. Copilot (at least for me) has been very useful in situations where I have to type code that is kind of very trivial. Sometimes I use it for more complex problems as well, just to see its suggestion, but most of those times I end up writing the code myself. So, all in all, it's okay to use copilot in my opinion, but don't rely entirely on it.
10 replies
TTCTheo's Typesafe Cult
Created by circles on 11/20/2022 in #questions
Is there an 'easy' way to expose tRPC function as an external REST API?
That's exactly what I was looking for, thanks a lot @barry
3 replies
TTCTheo's Typesafe Cult
Created by currenthandle on 11/19/2022 in #questions
Why is noUncheckedIndexedAccess enabled by default?
Are you sure you didn't change anything else in your tsconfig? Maybe the jsx property?
47 replies
TTCTheo's Typesafe Cult
Created by currenthandle on 11/19/2022 in #questions
Why is noUncheckedIndexedAccess enabled by default?
I like how this discussion is turning into discrete math proofs 😄 (jk)
47 replies
TTCTheo's Typesafe Cult
Created by lukiba38 on 11/19/2022 in #questions
Reusable components folder location?
This is a very subjective topic. It's a good idea to make a convention that you will follow throughout the development of your app, so you can be as consistent as possible. If you're still not sure google for someone else's convention, so you might get some ideas. There are a bunch of open source projects on github that you can pick up from as well.
7 replies
TTCTheo's Typesafe Cult
Created by venego on 11/19/2022 in #questions
I can't inner join with a table twice
Try something like this:
select a.*, owner, author from articles a
INNER JOIN (SELECT username FROM users WHERE users.username = a.ownerId) as owner
INNER JOIN (SELECT username FROM users WHERE users.username = a.authorId) as author
select a.*, owner, author from articles a
INNER JOIN (SELECT username FROM users WHERE users.username = a.ownerId) as owner
INNER JOIN (SELECT username FROM users WHERE users.username = a.authorId) as author
I'm not sure if it's gonna work, I wrote it from top of my head, but try to get the idea.
9 replies
TTCTheo's Typesafe Cult
Created by venego on 11/19/2022 in #questions
I can't inner join with a table twice
This will return the articles by the user, no matter if he's the author or the owner of it
9 replies
TTCTheo's Typesafe Cult
Created by venego on 11/19/2022 in #questions
I can't inner join with a table twice
Why are you joining the same table twice? Did you mean to join the users table based on two conditions? If that's the case, then you could do something like this:
select * from articles
INNER JOIN users ON articles.ownerId = users.id OR articles.authorId = users.id
select * from articles
INNER JOIN users ON articles.ownerId = users.id OR articles.authorId = users.id
9 replies
TTCTheo's Typesafe Cult
Created by circles on 11/18/2022 in #questions
What is the best approach to migrate to a new state management tool?
Thank you @robotkutya for your detailed explanation, appreciate that. I totally agree with you
26 replies
TTCTheo's Typesafe Cult
Created by circles on 11/18/2022 in #questions
What is the best approach to migrate to a new state management tool?
Thanks for your help @Scot. Everything that you said is definitely on point. I will make sure to look into everything in detail before making any decisions on this one.
26 replies
TTCTheo's Typesafe Cult
Created by circles on 11/18/2022 in #questions
What is the best approach to migrate to a new state management tool?
No, it's just plain redux with redux thunk middleware, it's like the old school way
26 replies
TTCTheo's Typesafe Cult
Created by circles on 11/18/2022 in #questions
What is the best approach to migrate to a new state management tool?
No, it's because I think redux is overkill for the application that we've built and continue building. Redux is not needed for my situation, because the app is an admin panel which most of it is just fetching/mutating data from/to an API, for which global application state is not really needed, thus developers write more code which is kinda useless, takes more time, and makes the code unmaintanable, and so on...
26 replies
TTCTheo's Typesafe Cult
Created by circles on 11/18/2022 in #questions
What is the best approach to migrate to a new state management tool?
thanks!
26 replies
TTCTheo's Typesafe Cult
Created by utdev on 11/18/2022 in #questions
Postgres docker image with database creation?
you can create a db service in your docker-compose like so:
db:
image: postgres:11.2-alpine
container_name: postgres-${BRANCH_NAME}
restart: always
environment:
- POSTGRES_USER=${DB_USER}
- POSTGRES_PASSWORD=${DB_PASSWORD}
- POSTGRES_DB=${DB_DATABASE}
volumes:
- ./project-root/init-postgres.sh:/docker-entrypoint-initdb.d/init-postgres.sh
- /opt/project-root-db-${BRANCH_NAME}:/var/lib/postgresql/data
ports:
- "${DB_PORT}:5432"
db:
image: postgres:11.2-alpine
container_name: postgres-${BRANCH_NAME}
restart: always
environment:
- POSTGRES_USER=${DB_USER}
- POSTGRES_PASSWORD=${DB_PASSWORD}
- POSTGRES_DB=${DB_DATABASE}
volumes:
- ./project-root/init-postgres.sh:/docker-entrypoint-initdb.d/init-postgres.sh
- /opt/project-root-db-${BRANCH_NAME}:/var/lib/postgresql/data
ports:
- "${DB_PORT}:5432"
For this to work, you will also need this script: ./project-root/init-postgres.sh
#!/bin/bash

psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<EOF
ALTER USER $POSTGRES_USER CREATEDB;
GRANT ALL PRIVILEGES ON DATABASE $POSTGRES_DB TO $POSTGRES_USER;
CREATE DATABASE $DB_DATABASE
EOF
#!/bin/bash

psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<EOF
ALTER USER $POSTGRES_USER CREATEDB;
GRANT ALL PRIVILEGES ON DATABASE $POSTGRES_DB TO $POSTGRES_USER;
CREATE DATABASE $DB_DATABASE
EOF
Note that I use this with gitlab CD/CI, so you will probably need to change/remove some of the env variables, but this is just to get the idea. Hope it helps.
4 replies
TTCTheo's Typesafe Cult
Created by Danta on 11/17/2022 in #questions
Tabnine vs Copilot for fullstack development
I find copilot very useful for writing util functions, but prefer to turn it off when I need to write some complicated bussiness logic that is specific for the app. Copilot is definitely worth it to even buy it, if you aren't a student
12 replies