Channels
Drizzle wants to truncate my tables when not needed
I have this schema:
```ts
export const users = sqliteTable('users', {
id: text('id').notNull().primaryKey(),
username: text('username').notNull(),...
SQLean's uuid4() in SQLite CREATE TABLE
I'm using Turso, enabled SQLean uuid extension and I would like to generate a table via drizzle-kit with a following id:
...
id: text("id")
.primaryKey()
.default(sql`uuid4()`),
id: text("id")
.primaryKey()
.default(sql`uuid4()`),
How can we specify COLLATE on the schema?
There is a feature request here: https://github.com/drizzle-team/drizzle-orm/issues/638
For adding support for COLLATE to the schema. This seems like a fairly simple feature request, but very useful, especially for case insensitive queries.
How can we get it on the roadmap?...
Drizzle pg client throwing `scanner_yyerror` on push
Getting the following error upon running
drizzle-kit push:pg
to my local postgres.
Drizzle-Kit version 0.20.17
Drizzle-ORM version 0.30.9
using pg
version 8.11.3
...DrizzleError: Rollback is being rethrown unexpectedly
No matter which error I throw for the rollback - it doesn't work as indented because it bleeds outside the transaction as postgres-js is rethrowing it.
```ts
const mute = await db.transaction(async (tx) => {
await tx.rollback();...
Id being required in types when using insert and values
Hello! I' been following the tutorial and I'm having a issue with the following function:
```js
export const addTodo = async (text: string) => {
await db.insert(todo).values({
text: text,...
Failed push to planetscale
Every time I try to push my schema to Planetscale, I get the following error:
```
if (unsquashed.columns.length === 1 && currentSchema.tables[statement.tableName].columns[unsquashed.columns[0]].type === "serial" && prevSchema.tables[statement.tableName].columns[unsquashed.columns[0]].type === "serial" && currentSchema.tables[statement.tableName].columns[unsquashed.columns[0]].name === unsquashed.columns[0]) {
^
...
Select parent rows where child exists
I want to use a relational query to select all users and their posts where users have at least one post.
Creating a View with Turso/Sqlite
```export const jobsView = sqliteView("jobsView").as((qb) =>
qb
.select({
id: job.id,
title: job.title,...
How to update "updated_at" column automaticly when related row is updated?
Hello.
I'm using PostgreSQL as a dbms. So driver is pg. I want to update the "updated_at" column when the row is updated.
Is this implementation is ok for the feature. ...
Error with Nested Transactions
I'm experiencing an issue with nested transactions on neon serverless 0.9.1, drizzle-orm 0.30.9, and ws 8.16.0.
The following works locally but not in production:
```javascript
async function createOrGet<T>(...
Supabase branching w/ Drizzle?
Does anyone know if it is possible to get Supabase branching working with Drizzle migrations? (https://supabase.com/docs/guides/platform/branching)
Type inference is not working when findFirst is extracted
Hey typescript wizards, could anyone spot what I'm doing wrong here?
```ts
type OrgTableQueryParams = Parameters<
typeof db.query.organizationTable.findFirst...
Drizzle Query, Relationship Sub-Query
I have Domains and Products, and a pivot between them (DomainProducts).
I'd like to query (
findFirst
) the DomainProducts
where DomainProducts.Slug='hello-world'
and DomainProducts.Domain.Url='mydomain.com'
Is that possible? It seems like it's not possible to do it with the Query, instead I have to use it like a normal Select and manually do the join?...MariaDB driver and generate migrations
The company im working for insists on using MariaDB but im having issues generating migrations for my mariaDB.
For schemas i am using
'drizzle-orm/mysql-core'
and i create tables with mysqlTable()
and for generating the migrations im using drizzle-kit generate:mysql
.
In the drizzle.config.ts
i set the driver to this driver: 'mysql2'
when i now want to run drizzle-kit push:mysql
i get this error message...Naming Migrations
how do i set a name for a new migration when running
drizzle-kit generate:mysql
? i tried setting a flag like --tag=new_migration
or --name=new_migration
. i wouldn't want to rename them manually afterwards everytime 😄[postgres][zod] createInsertSchema
Hey! Trying to make my Sveltekit form schema.
Here is my example:
```export const userAccessesFormSchema = createInsertSchema(usersTable, {
id: z.string().min(1),
hasDatabase: z.boolean(),...