drizzle-team / drizzle-team/drizzle-orm
[BUG]: drizzle multi project schema with kysely
- Dominant language
- TypeScript
- Stars
- 35.8k
- Forks
- 1.6k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 4
Description
### What version of `drizzle-orm` are you using?
0.32.1
### What version of `drizzle-kit` are you using?
0.23.1
### Describe the Bug
I am using https://github.com/drizzle-team/drizzle-orm/tree/main/drizzle-orm/src/kysely as a connector between drizzle and kysely. When I define my custom mysqlTableCreator, the drizzle is not working properly.
```typescript
const mysqlTable = mysqlTableCreator((name) => `${name.toUpperCase()}`);
export const user = mysqlTable(
"user",
{
age: varchar("age", { length: 128 }).notNull(),
email: varchar("email", { length: 128 }).notNull(),
id: varchar("id", { length: 128 }).$defaultFn(() => createId()),
name: varchar("name", { length: 128 }).notNull(),
},
(user) => ({
userEmailIndex: unique("USER_EMAIL_INDEX").on(user.email),
userIdPK: primaryKey({ name: "USER_ID_PK", columns: [user.id] }),
}),
);
```
```SHELL
kysely:error: Error: Table 'hono-poc.user' doesn't exist
...
```
### Expected behavior
The table name should 'USER' instead of 'hono-poc.user'.
### Environment & setup
node -v: v20.16.0
pnpm -v: 9.6.0
os: macOS 14.5 (23F79)
Contributor guide
Research direction
Start in drizzle-orm/src/kysely and reproduce the issue with the custom mysqlTableCreator shown in the report. Trace how the table name is passed through the Kysely connector, then verify that the generated query targets USER rather than hono-poc.user.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mysql, typescript
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100