Error starting Drizzle Studio.

Hi, I am new to drizzle, and rand into some issues starting drizzle studio, mentioned below.
ules/drizzle-orm/index-1899b9ae.cjs:4180
throw new Error(`There is not enough information to infer relation "${sourceTableTsName}.${relation.fieldName}"`);
^

Error: There is not enough information to infer relation "Links.filters"
ules/drizzle-orm/index-1899b9ae.cjs:4180
throw new Error(`There is not enough information to infer relation "${sourceTableTsName}.${relation.fieldName}"`);
^

Error: There is not enough information to infer relation "Links.filters"
My table schema is:
export const Links = pgTable(
"user_links",
{
linkId: uuid("link_id")
.default(sql`gen_random_uuid()`)
.primaryKey()
.unique(),
userId: uuid("user_id").references(() => Users.userId),
parentUrl: varchar("parent_url").notNull(),
urlHash: varchar("url_hash", { length: 256 }).notNull().unique(),
maskedUrl: varchar("masked_url", { length: 256 }).notNull(),
otpMethod: varchar("otp_method", {
enum: [OTP_METHODS.EMAIL, OTP_METHODS.MOBILE, OTP_METHODS.BOTH],
}).notNull(),
filter_comparison: text("filter_comparison", {
enum: [FILTER_COMPARE.AND, FILTER_COMPARE.OR],
}),
filters: uuid("filter_ids_check")
.references(() => Filters.filterId)
.array(),
createdAt: timestamp("created_at").defaultNow().notNull(),
updatedAt: timestamp("updated_at").defaultNow().notNull(),
},
(table) => {
return {
urlHashIndex: index("hash_index").on(table.urlHash),
};
},
);
export const Links = pgTable(
"user_links",
{
linkId: uuid("link_id")
.default(sql`gen_random_uuid()`)
.primaryKey()
.unique(),
userId: uuid("user_id").references(() => Users.userId),
parentUrl: varchar("parent_url").notNull(),
urlHash: varchar("url_hash", { length: 256 }).notNull().unique(),
maskedUrl: varchar("masked_url", { length: 256 }).notNull(),
otpMethod: varchar("otp_method", {
enum: [OTP_METHODS.EMAIL, OTP_METHODS.MOBILE, OTP_METHODS.BOTH],
}).notNull(),
filter_comparison: text("filter_comparison", {
enum: [FILTER_COMPARE.AND, FILTER_COMPARE.OR],
}),
filters: uuid("filter_ids_check")
.references(() => Filters.filterId)
.array(),
createdAt: timestamp("created_at").defaultNow().notNull(),
updatedAt: timestamp("updated_at").defaultNow().notNull(),
},
(table) => {
return {
urlHashIndex: index("hash_index").on(table.urlHash),
};
},
);
No description
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server