DT
Drizzle Team•4mo ago
ppppp

Unique constraint typescript error

i want to make unique constraint based on two columns, but i always got an error for the first column argument. anyone know how to fix this?
No description
6 Replies
ppppp
pppppOP•4mo ago
No description
Mario564
Mario564•4mo ago
Check your imports, you might be importing unique from mysql-core instead of pg-core
ppppp
pppppOP•4mo ago
Thank youuu 😘 To avoid this mistake again i just set the linter rule where i get error when i import from drizzle-orm/mysql-core and drizzle-orm/sqlite-core
Mario564
Mario564•4mo ago
Oh, very nice! Mind if I ask how you implemented that lint rule? Drizzle as an ESLint plugin and what you describe could be a nice addition
ppppp
pppppOP•4mo ago
sorry for the late response, i don't use discord that much. there is an eslint rule where you can restrict specific import called no-restricted-imports.
{
"rules": {
"no-restricted-imports": [
"error",
{ "paths": ["drizzle-orm/mysql-core", "drizzle-orm/sqlite-core"] }
]
}
}
{
"rules": {
"no-restricted-imports": [
"error",
{ "paths": ["drizzle-orm/mysql-core", "drizzle-orm/sqlite-core"] }
]
}
}
Mario564
Mario564•4mo ago
Oh, didn't know this was a rule, very nice. Thanks for sharing
Want results from more Discord servers?
Add your server