Is it possible to introspect relations?
Polymorphic relationships using a discriminator column
LicenseAssignments
has a column LicenseTargetDiscriminator
(which could be something like User
, Organisation
, Document
, etc.) and a column LicenseTargetId
which contains the ID of the resource in its particular table....JsonB and $type
Drizzle push not respecting .existing views. Have to drop the view everytime i change schema
How to make a wrapper function for a table (after version 0.39.0)?
Cannot be cast automatically
how to set an initial autoincrement value
ALTER TABLE penguins AUTO_INCREMENT=1001;
how can I achieve this on schema generation?...Complex filter on query.
Magic sql does not add table name in query?
``ts
const userSubQuery = sql<{ logo: string | null; email: string }>
(...Package pg can't be external
turborepo
with two next.js apps, and a db package that uses drizzle-orm, and api package that uses trpc.
I have things set up according to the docs, but when I run the web app (pnpm run dev), it error out with the following error:
```shell....npmrc
file
public-hoist-pattern[]=*pg*
...Problems querying with findMany and relations
⨯ TypeError: Cannot read properties of undefined (reading 'referencedTable')
```export const studentsTable = pgTable("students", {...Generating/ applying migrations directly in code instead of using the CLI?
Generated many Relations not available in Relational query builder.

Magic sql'' operator concat
error: column " " does not exist
when running this query:
```
const result = await db.query.user.findMany({
columns: {
id: true,...Error in `migrate` command: `PostgresError: no schema has been selected to create in`
Need help with relation
characters
and character_scores
. They are linked by an id
column. characters
can have many of the same ID and character_scores
as well. I want to make a relation between those ID's so that when I query a unique row from characters
I want to include the associated character_scores
row(s). So for example (pseudo sql):
from characters I want 1 row where id = x and specialization = y and include columns from character_scores where id = x and category = z
from characters I want 1 row where id = x and specialization = y and include columns from character_scores where id = x and category = z
Buffer is not defined - drizzle-arktype
import { createInsertSchema, createSelectSchema } from 'drizzle-arktype'
into my vite app
Running multiple projects from one database
GraphQL deeply nested relations
Seed local SQLite database from Remote D1 data?