philbookst
philbookst
Explore posts from servers
DTDrizzle Team
Created by philbookst on 5/11/2023 in #help
DatabaseError: Duplicate column name 'id'
i'm sorry i don't quite remeber, it was almost a year ago i do remeber printing out the raw sql and asking chatgpt whats wrong πŸ˜„
5 replies
DTDrizzle Team
Created by philbookst on 12/20/2023 in #help
push:sqlite error _old_push table with turso
yes i think i also had this error sometimes
6 replies
DTDrizzle Team
Created by philbookst on 12/20/2023 in #help
push:sqlite error _old_push table with turso
I don’t think so πŸ˜΅β€πŸ’«
6 replies
DTDrizzle Team
Created by thdxr on 7/12/2023 in #help
0.27.2 mysql:push
it deleted the dummy constraint when trying db:push
26 replies
DTDrizzle Team
Created by thdxr on 7/12/2023 in #help
0.27.2 mysql:push
I think you can use any schema with uniqueIndex added Here is my schema for the failing table as reference though:
export const Account = mysqlTable(
"Account",
{
id: varchar("id", { length: 50 }).primaryKey().notNull(),
tenantId: varchar("tenantId", { length: 100 }).notNull(),
createdAt: timestamp("createdAt").defaultNow(),
updatedAt: timestamp("updatedAt").defaultNow().onUpdateNow(),
role: mysqlEnum("role", ["ADMIN", "USER"]).default("USER").notNull(),
email: varchar("email", { length: 100 }).notNull(),
emailVerified: timestamp("emailVerified"),
passwordHash: varchar("passwordHash", { length: 150 }).notNull(),
userAuthToken: varchar("userAuthToken", { length: 50 }).notNull(),
passwordResetToken: varchar("passwordResetToken", { length: 50 }),
passwordResetExpiry: timestamp("passwordResetExpiry"),
userId: varchar("userId", { length: 50 }).notNull()
},
(table) => {
return {
userIdKey: uniqueIndex("Account_userId_key").on(table.userId),
passwordResetTokenKey: uniqueIndex("Account_passwordResetToken_key").on(
table.passwordResetToken
),
tenantIduserAuthTokenIdx: uniqueIndex("Account_tenantId_userAuthToken_idx").on(
table.userAuthToken,
table.tenantId
),
tenantIdUserEmailIdx: uniqueIndex("Account_tenantId_userEmail_idx").on(
table.tenantId,
table.email
)
};
}
);
export const Account = mysqlTable(
"Account",
{
id: varchar("id", { length: 50 }).primaryKey().notNull(),
tenantId: varchar("tenantId", { length: 100 }).notNull(),
createdAt: timestamp("createdAt").defaultNow(),
updatedAt: timestamp("updatedAt").defaultNow().onUpdateNow(),
role: mysqlEnum("role", ["ADMIN", "USER"]).default("USER").notNull(),
email: varchar("email", { length: 100 }).notNull(),
emailVerified: timestamp("emailVerified"),
passwordHash: varchar("passwordHash", { length: 150 }).notNull(),
userAuthToken: varchar("userAuthToken", { length: 50 }).notNull(),
passwordResetToken: varchar("passwordResetToken", { length: 50 }),
passwordResetExpiry: timestamp("passwordResetExpiry"),
userId: varchar("userId", { length: 50 }).notNull()
},
(table) => {
return {
userIdKey: uniqueIndex("Account_userId_key").on(table.userId),
passwordResetTokenKey: uniqueIndex("Account_passwordResetToken_key").on(
table.passwordResetToken
),
tenantIduserAuthTokenIdx: uniqueIndex("Account_tenantId_userAuthToken_idx").on(
table.userAuthToken,
table.tenantId
),
tenantIdUserEmailIdx: uniqueIndex("Account_tenantId_userEmail_idx").on(
table.tenantId,
table.email
)
};
}
);
i've played with adding a dummy constraint ALTER TABLE Account ADD CONSTRAINT Account_userId_key CHECK (LENGTH(id) > 0); which fixed the error for Account_userId_key but then a new error for Account_passwordResetToken_key popped up
26 replies
DTDrizzle Team
Created by thdxr on 7/12/2023 in #help
0.27.2 mysql:push
i got the same problem, did you find a fix for it or do we need to wait for a new version?
26 replies
DTDrizzle Team
Created by philbookst on 5/11/2023 in #help
uuid missing in drizzle-orm/mysql-core?
i use varchar("id", { length: 191 }).primaryKey().notNull() for most tables and then just generate the id via crypto.randomUUID() on the server side for my insert statements
12 replies
DTDrizzle Team
Created by philbookst on 5/30/2023 in #help
Top-level await is not available in the configured target environment ("chrome87", "edge88", "es2020
fixed in v0.26.3!
2 replies
DTDrizzle Team
Created by philbookst on 5/11/2023 in #help
uuid missing in drizzle-orm/mysql-core?
oh ok! what is the alternative that i could use? do you happen to know what prisma does, do they just do a plain crypto.randomUUID() as a fallback?
12 replies
DTDrizzle Team
Created by philbookst on 5/11/2023 in #help
Need help transform a nested prisma query to drizzle
oh that's sad, but at the end of the day not a big problem - thank you!
4 replies