Louis
Louis
Explore posts from servers
DTDrizzle Team
Created by Louis on 6/26/2024 in #help
Normal boolean conditions
Hello, i want to achieve the following:
const record = await drizzle(c.env.DATABASE)
.select()
.from(dataProject)
.where(and(eq(dataProject.id, id), and(eq(dataProject.userId, user.id), user.role == "manager")))
.limit(1);
const record = await drizzle(c.env.DATABASE)
.select()
.from(dataProject)
.where(and(eq(dataProject.id, id), and(eq(dataProject.userId, user.id), user.role == "manager")))
.limit(1);
Show everything for managers (user is an object outside of drizzle) or the records where the userId is the current users id. the user.role == "manager" part doesnt work. is there a alternative for this without unnecessary if statements? Thanks yall
4 replies
DTDrizzle Team
Created by Louis on 6/7/2024 in #help
Reference the same table
Hello, I use drizzle with a sqlite d1 database. I have the following schema: export const authUser = sqliteTable("auth_user", { id: text("id").notNull().primaryKey(), email: text("email").notNull().unique(), firstName: text("first_name").notNull(), lastName: text("last_name").notNull(), role: text("role").notNull(), // unassigned, office, construction verified: integer("verified", { mode: "boolean" }).notNull(), manager: text("user_id").references(() => authUser.id), }); But it get the following error: typescript: 'authUser' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. How can i fix this?
4 replies
DTDrizzle Team
Created by Louis on 1/16/2024 in #help
D1 Migrations
No description
1 replies
DTDrizzle Team
Created by Louis on 1/14/2024 in #help
Migrate all data from Turso to Cloudflare D1
Hello, is there some tool or function to migrate all data from Database Provider A to B?
2 replies
DTDrizzle Team
Created by Louis on 12/18/2023 in #help
Best way to seperate environments
Hello, I use drizzle with cf workers and turso database. Whats the best way to split my project into a dev and prod database? So i can develop and change the dev database and push it to the prod database? Any ideas someone? Thanks yall
5 replies
DTDrizzle Team
Created by Louis on 12/9/2023 in #help
Unix Timestamp conditions
Hello everyone, Im trying to build a select statement rn but u dont get it done and could need some help. I have a database (turso sqlite) where i store timestamps in the unix epoch format (like: 1702132073000). Now i want to select all rows where the timestamp is TODAY so only compare the date and ignore the time. how can i do this? Thanks everyone!
4 replies
DTDrizzle Team
Created by Louis on 10/11/2023 in #help
between operator
Hello i have a table where i have 2 columns where i save timestamps (epoch time) as integer. when i try to query it with the between operator i get no response. .where(between(1697013797353, table.startDate, table.endDate)) the number gets red underlined. Also when i use sqlCURRENT_TIME and so on it doesnt work either. Any idea anyone? Thanks!
6 replies
DTDrizzle Team
Created by Louis on 10/2/2023 in #help
No such table: main.__old_push_[TABLENAME]
Hello, I tried to setup Lucia Auth with DrizzleORM and Torso LibSQL. The database reads/writes work via drizzleORM but when i want to create a user via Lucia Auth i get the error from the title. Does anyone have an idea?
77 replies