Glorrin
Glorrin
Explore posts from servers
DTDrizzle Team
Created by Glorrin on 11/23/2023 in #help
need help to optimise a query
simplified schema :
export const event = mysqlTable(
"event",
{
id: varchar("id", { length: 191 })
.default(sql`uuid()`)
.notNull(),
name: varchar("name", { length: 256 }).notNull(),
start: timestamp("date").notNull(),
}
);

export const character = mysqlTable(
"character",
{
id: varchar("id", { length: 191 })
.default(sql`uuid()`)
.notNull(),
name: varchar("name", { length: 256 }).notNull(),
userId: varchar("userId", { length: 191 }).notNull(),
}
);

export const eventCharacter = mysqlTable(
"eventCharacter",
{
id: varchar("id", { length: 191 })
.default(sql`uuid()`)
.notNull(),
eventId: varchar("eventId", { length: 191 }).notNull(),
characterId: varchar("characterId", { length: 191 }).notNull(),
}
);

export const eventCharacterSoftReserved = mysqlTable(
"eventCharacterSoftReserved",
{
id: varchar("id", { length: 191 })
.default(sql`uuid()`)
.notNull(),
name: varchar("name", { length: 256 }).notNull(),
eventCharacterId: varchar("eventCharacterId", { length: 191 }),
}
);
export const event = mysqlTable(
"event",
{
id: varchar("id", { length: 191 })
.default(sql`uuid()`)
.notNull(),
name: varchar("name", { length: 256 }).notNull(),
start: timestamp("date").notNull(),
}
);

export const character = mysqlTable(
"character",
{
id: varchar("id", { length: 191 })
.default(sql`uuid()`)
.notNull(),
name: varchar("name", { length: 256 }).notNull(),
userId: varchar("userId", { length: 191 }).notNull(),
}
);

export const eventCharacter = mysqlTable(
"eventCharacter",
{
id: varchar("id", { length: 191 })
.default(sql`uuid()`)
.notNull(),
eventId: varchar("eventId", { length: 191 }).notNull(),
characterId: varchar("characterId", { length: 191 }).notNull(),
}
);

export const eventCharacterSoftReserved = mysqlTable(
"eventCharacterSoftReserved",
{
id: varchar("id", { length: 191 })
.default(sql`uuid()`)
.notNull(),
name: varchar("name", { length: 256 }).notNull(),
eventCharacterId: varchar("eventCharacterId", { length: 191 }),
}
);
2 replies
TTCTheo's Typesafe Cult
Created by Glorrin on 11/16/2023 in #questions
server side ref
you don't "use server" components, that is for server actions I didn't know about that thanks 🙂 I am using ant design (sigh) and using the tour component, ant design is not realy easy to work with, but the tour component is exactly what I need : highlight the component I am trying to explain and show a pop up. What it does is not important what is important is what it needs: A ref on each element it highlights in the correct order. For that I need to create a ref a apply it to each element. This works fine in a client component with use ref. But on a server component useRef is not available. I can put every thing in another file but it is a bit annoying to create a new file just for that. Also data fetching and data usage gets separated and thats realy annoying for debugging or changing the page.
6 replies
TTCTheo's Typesafe Cult
Created by th3xaw3s0m3 on 5/1/2023 in #questions
How would you fix USA flag stars?
Simple fix to have a better flag : sort the colors so that each of those are in a single column (or row) so that the gflag can be scale up or down easily
6 replies
TTCTheo's Typesafe Cult
Created by Glorrin on 4/27/2023 in #questions
why do we add prisma in ctx instead of using import ?
Ok but if my routers become more complexe and I want to externalise it in services files, can I import it there or should I "drill prop" prisma in ctx ?
8 replies
TTCTheo's Typesafe Cult
Created by l on 4/13/2023 in #questions
S3 with TRPC
- make a request to generate a put signed urls from s3 - use this url to put your file on s3 from the client - send a final request to update database (in most cases you want to keep track of this file)
15 replies
TTCTheo's Typesafe Cult
Created by Perchant on 3/27/2023 in #questions
Browser suggestion
I find this question hilarious, no I am not making fun of you I am making fun of me, I am old enough to remember when the slightest bug would close current window erasing ALL your work so you will need to save OFTEN. And I am still amazed in 2023 when I open a browser that it remembers my previous tabs, yes I know it has been a thing for over 10 years now, let me be amazed for small things ok. Sorry I can't help you with your problem, hope you will find what you search for a leav grumpy old guys like me in the dust.
17 replies
TTCTheo's Typesafe Cult
Created by Lopen on 3/22/2023 in #questions
how to store actually boolean in mysql instead 0 and 1
You could go to paint, create a realy big image write true on it, create another big image writing false on it, and store those as longblob in your database. Sarcasm aside what is wrong with 0 and 1, and what is the difference with true and false ? The role of your database is not to store your ui only data. for boolean it makes sense to use 0 and 1. If the boolean is nullable you even have this option: 0, 1 or null. If you don't like looking at 0 and 1 on your ui change the ui not the data. A terrible way to solve your issue would be to store it as string "true" and "false" but why would you do that ? Maybe i am misunderstanding the question and your issue is with prisma not mysql but you will have to share where your issue is within your code. An example would be nice.
5 replies
TTCTheo's Typesafe Cult
Created by WOLFLEADER on 11/9/2022 in #questions
Learning a functional lang
for proffessional use or for fun ? If it is just for fun scheme is ok.
14 replies
TTCTheo's Typesafe Cult
Created by ! Obeh on 11/7/2022 in #questions
Apollo with nextjs 13 ?
I would go with tanStack useQuery + fetch. I have used apollo for graphql for a year, but if you don't have graphql save yourself the headache and don't use apollo. If you do have graphql still try to find a way to not use apollo.
3 replies
TTCTheo's Typesafe Cult
Created by Glorrin on 11/5/2022 in #questions
For low computational work should I do it on server or client ?
But your comment is great, for another page, thanks 🙂
4 replies
TTCTheo's Typesafe Cult
Created by Glorrin on 11/5/2022 in #questions
For low computational work should I do it on server or client ?
It is the other way around, it is a form where the user can translate his own fields if he wants to, I could translate them for him but sometimes user want to change the wording depending on language.
4 replies
TTCTheo's Typesafe Cult
Created by Gaden on 11/5/2022 in #questions
Is there a scaleable realtime type safe message broker?
If you like pusher, what about using zod on write and read to make it typesafe ?
3 replies
TTCTheo's Typesafe Cult
Created by taco is a friend of bluey 🥥🌴 on 10/22/2022 in #questions
Getting an error saying `TypeError movies.map is not a function`
const Home = ({ movies }: { movies: MovieTypes | any }) should probably be { movies }: { movies: MovieTypes[] } Also are you sure your api return a list ? And not an object containing page, results, and results would be your list ?
9 replies
TTCTheo's Typesafe Cult
Created by Donny D on 10/8/2022 in #questions
Generating a Layout with main AND sidebar content??
how many different sidebar do you need ? you could do : <Layout sidebarType={"default" | "empty" | "fancy"}> <Content/> </Layout> And define your sidebars inside Layout
23 replies