Pramus
Pramus
Explore posts from servers
DTDrizzle Team
Created by Pramus on 4/23/2024 in #help
SQLean's uuid4() in SQLite CREATE TABLE
I think I might've figured out what is the problem. Not sure if it exists in code but definitely in Drizzle Studio. I created an issue on GitHub: https://github.com/drizzle-team/drizzle-orm/issues/2198
7 replies
DTDrizzle Team
Created by Pramus on 4/23/2024 in #help
SQLean's uuid4() in SQLite CREATE TABLE
No description
7 replies
DTDrizzle Team
Created by Pramus on 4/23/2024 in #help
SQLean's uuid4() in SQLite CREATE TABLE
Unfortunately this results in a broken syntax (note I mistakenly removed one DEFAULT from my initial output, fixed it):
`id` text PRIMARY KEY DEFAULT DEFAULT(uuid4()) NOT NULL,
`id` text PRIMARY KEY DEFAULT DEFAULT(uuid4()) NOT NULL,
AFAIK the syntax for default values is DEFAULT + value rather than DEFAULT(value)
7 replies
DTDrizzle Team
Created by Pramus on 4/5/2024 in #help
libSQL/SQLite: Issue with CAST and ILIKE
Forget it... libSQL/SQLite doesn't have ILIKE, my bad. I'll leave it here just in case someone does the same mistake. Here's the correct code:
.where(
or(
sql`LOWER(customers.name) LIKE ${`%${query.toLowerCase()}%`}`,
sql`LOWER(customers.email) LIKE ${`%${query.toLowerCase()}%`}`,
sql`CAST(LOWER(invoices.amount) AS TEXT) LIKE ${`%${query.toLowerCase()}%`}`,
sql`CAST(LOWER(invoices.date) AS TEXT) LIKE ${`%${query.toLowerCase()}%`}`,
sql`LOWER(invoices.status) LIKE ${`%${query.toLowerCase()}%`}`,
),
.where(
or(
sql`LOWER(customers.name) LIKE ${`%${query.toLowerCase()}%`}`,
sql`LOWER(customers.email) LIKE ${`%${query.toLowerCase()}%`}`,
sql`CAST(LOWER(invoices.amount) AS TEXT) LIKE ${`%${query.toLowerCase()}%`}`,
sql`CAST(LOWER(invoices.date) AS TEXT) LIKE ${`%${query.toLowerCase()}%`}`,
sql`LOWER(invoices.status) LIKE ${`%${query.toLowerCase()}%`}`,
),
2 replies