Replies: 2 comments
-
Hello! This might be because of the new API for pgTable for creating indeces. Please do refer to the type documention: /** @example
* Deprecated version:
* ```ts
* export const users = pgTable("users", {
* id: integer(),
* }, (t) => ({
* idx: index('custom_name').on(t.id)
* }));
* ```
*
* New API:
* ```ts
* export const users = pgTable("users", {
* id: integer(),
* }, (t) => [
* index('custom_name').on(t.id)
* ]);
* ```
*/ |
Beta Was this translation helpful? Give feedback.
0 replies
-
Leaving this here in case anyone else comes across this issue... I was using syntax like this for indexes, which will throw the error above. export const user = pgTable("user", {
id: serial("id").primaryKey(),
name: text("name"),
email: text("email"),
}, (table) => {
index("name_idx").on(table.name);
uniqueIndex("email_idx").on(table.email);
}); The correct syntax is to return an array. export const user = pgTable("user", {
id: serial("id").primaryKey(),
name: text("name"),
email: text("email"),
}, (table) => [ // < Square brace!
index("name_idx").on(table.name),
uniqueIndex("email_idx").on(table.email)
]); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Does anyone know how to fix this?
Beta Was this translation helpful? Give feedback.
All reactions