Studio: Not Enough Info to Infer Relation

https://www.answeroverflow.com/m/1180072254214766632

Running into this issue:
bun run drizzle-kit studio
Error: There is not enough information to infer relation "__public__.auditLogs.users"


export const users = sqliteTable('users', {
  id: text('id').$default(() => createId()).primaryKey(),
  username: text('username').unique().notNull(),
  email: text('email'),
  //...
});

export const usersRelations = relations(users, ({ one, many }) => ({
  auditLogs: many(auditLogs),
  //...
}));

export const auditLogs = sqliteTable('audit_logs', {
  userId: text('user_id').references(() => users.id, { onDelete: 'cascade' }),
  action: text('action'),
  timeStamp: text('time_stamp').$default(() => toISO8601(new Date())),
}, (table) => ({
  unq: unique().on(table.userId, table.action, table.timeStamp),
}));

export const auditLogsRelations = relations(auditLogs, ({ one }) => ({
  users: one(users),
}));


Any ideas? Based on the stack overflow, the suggestion is that the relationship isn't on both sides, but it seems like I do in this case, no?
I am trying to use drizzle studio but I'm running into the following issue,
There is not enough information to infer relation "__public__.collectionsTable.tokens"
.

Here's a simplified version of the schema.
```ts
export const tokensTable = mysqlTable(
'tokens',
{
tokenId: varchar('token_id', { length: 255 }).notNul...
Was this page helpful?