Type error?

import { pgTable, serial, integer } from 'drizzle-orm/pg-core';

export const users = pgTable('users', {
id: serial('id').primaryKey(),
});

export const products = pgTable('products', {
id: serial('id').primaryKey(),
});

export const metadata = pgTable('metadata', {
id: serial('id').primaryKey(),

someOtherRef: integer('some_other_ref_id').references(() => someOtherRef.id),
});

export const someOtherRef = pgTable('someOtherRef', {
id: serial('id').primaryKey(),

metadataId: integer('meta_data_id').references(() => metadata.id),
});
import { pgTable, serial, integer } from 'drizzle-orm/pg-core';

export const users = pgTable('users', {
id: serial('id').primaryKey(),
});

export const products = pgTable('products', {
id: serial('id').primaryKey(),
});

export const metadata = pgTable('metadata', {
id: serial('id').primaryKey(),

someOtherRef: integer('some_other_ref_id').references(() => someOtherRef.id),
});

export const someOtherRef = pgTable('someOtherRef', {
id: serial('id').primaryKey(),

metadataId: integer('meta_data_id').references(() => metadata.id),
});
....it does not have a type annotation and is referenced directly or indirectly in its own initializer.
1 Reply
Maston
Maston16mo ago
.references((): AnyPgColumn => someOtherRef.id)
Want results from more Discord servers?
Add your server