packing migration files with the library
hey there, I'm trying to use
migrate
inside from a library consumer (i.e I have a @mycompany/db-lib
that has doMigration
and from my internal dev-app, I want to do something like:
```ts
import { doMigrate } from '@mycompany/db-lib'
export const onMigrateClick = () => {...Any way to invoke a SQL function?
For ex: lets say I declare a SQL function
CREATE OR REPLACE FUNCTION do_something()
how do i invoke this function using Drizzle's interface?...How to include array literals in raw sql?
I have an input array used for an order by using the array_position function - rather than passing the array as a single param, the call to:
...
.orderBy(sql`array_position(${ingredientNames}, ${entity.name})`);
.orderBy(sql`array_position(${ingredientNames}, ${entity.name})`);
any way to automatically cast numeric types on retrieval?
I have a numeric field in a video table:
```
export const VideoTable = pgTable('videos', {
id: uuid('id').primaryKey().defaultRandom(),
height: integer('height'),...
Query in drizzle doesn't work
Error:
...
DrizzleError: No fields selected for table "usersToGroups" ("users_groups")
DrizzleError: No fields selected for table "usersToGroups" ("users_groups")

Cannot read properties of undefined (reading 'referencedTable')
Seemingly getting this error out of nowhere. I believe it's related to the relations I defined, but can't quite figure out what is causing it specifically.
Relational query builder in mysql?
I cant find anything about how to implement this. Am I blind or is this impossible?
TransactionRollbackError
Need some help understanding TransactionRollbackError...
Is this error saying the
tx.rollback()
function itself threw an error and that the rollback was unsuccessful, or just that the tx.rollback()
function was called?...PostgresError: null value in column "id" of relation "pairs" violates not-null constraint
Hello, I am fairly new to Drizzle and working with databases, so I am running into a problem that I am unsure how to solve and hope that you can help me with it.
I use Directus CMS to create all of my tables. Then, I wrote schema.ts (using introspect and making a couple of manual changes).
So, one of my tables looks like this:...
OnConflictDoNothing with mysql
Hi everyone,
I want to use the on conflict do nothing method described here: https://orm.drizzle.team/docs/insert#onconflict-and-upsert-insert-or-update.
But it seems to be that only onConflictDoUpdate is available. Is this database specific or Am I doing something wrong here?
this is my query: ...
drizzle-kit introspect reorder tables
Here is the case:
- I have a remote database. I made a backup and restore it locally
- I ran: drizzle-kit introspect:pg --config=./database/drizzle/drizzle.config.ts
- With different connections in the config: first for the remote DB and second for the local DB, I got different orders of tables in the generated schema...
Migration custom logger
Hey there, I'm want to run migration as part of my CI/CD, and would have liked the output of the
migrate
function to be passed to my custom logger function. is it something that is supported/planned?
if not - i'd suggest adding two logging options infoLogger
and errorLogger
both of type (msg: string) => void
thx...why do snapshots not have the same name as the migrations?
Hey, loving dirzzle so far.
Hit a snag recently. Me and my friend are collaborating on a project. We ended up in a merge conflict. Here is what happened:
1. We both created our separate branches from main....

Help with improving database query
Hello, I am seeking advice on how to improve a database query I am currently working with. My objective is to get the data of a prompt using its ID, and this data includes the names of the tags associated with it.The currently way I am doing this works, but feels hacking so wondering if theres a more efficient way to achieve this, possibly through restructuring the database or altering the query itself.
Below are the definitions for my "prompts" and "tags" tables from supabase DB:
```sql...
Typescript types for relational queries with neon db
Hey, I am having an issue with typescript types for relational queries with drizzle and neon db. Details: https://github.com/drizzle-team/drizzle-orm/issues/1204. Can anyone help me please?
Migrating in JS & JSON (no filesytem)
👋 we're big fans (and sponsors) of Drizzle at Val Town. We use it internally and love it.
We just shipped an integration with Turso to give every Val Town user a SQLIte database, and I'm happy to report that I got Drizzle working in that environment!
Integration: https://www.val.town/v/std.turso...
Unable to generate uuid as primary key
Hey everyone! I've searched through the help posts with similar titles but I could not get the answer I wanted. I have a prisma current setup, and trying to switch over, but my uuid is generated as my postgres primary key but I keep getting the following error:
...
"null value in column \"id\" of relation \"User\" violates not-null constraint"
"null value in column \"id\" of relation \"User\" violates not-null constraint"