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