Module '"drizzle-orm/mysql-core"' has no exported member 'unique'.ts(2305)
Getting this error when trying to import
unique
10 Replies
docs state it should be there:
https://orm.drizzle.team/docs/indexes-constraints#unique
Indexes & Constraints – DrizzleORM
Drizzle ORM | %s
me too with pg
I'm here for the same reason in pg. Are the docs out of date? It seems that
uniqueIndex
exists but the docs don't use it.
This syntax from the docs doesn't work, even with uniqueIndex
But, this does:
Hope this helps, but the docs should really be updated if this is the correct way to do it now@shiftymccool @boxer01 not sure if you all found a solution but seems like i can add it now, but ts is telling me its not being read for some reason
@Andrew Sherman am i reading this right, is there not a unique function in the latest version? https://www.npmjs.com/package/drizzle-orm/v/0.27.2?activeTab=code
npm
drizzle-orm
Drizzle ORM package for SQL databases. Latest version: 0.27.2, last published: 7 days ago. Start using drizzle-orm in your project by running
npm i drizzle-orm
. There are 20 other projects in the npm registry using drizzle-orm.there is a unique function in latest
if you want to use unique on column level - no need to imoprt anything. It's already available on column level
if you want to have composite unique on 2+ columns, than you need to import this function and use in 3 param of pgTable
you can find a full set of examples here
ah ok thx. saw the unique import in the docs so was wondering if it was required
it's showing up now, but it doesn't seem to be enforced:
I am able to still insert records into the db with the same number in the
channel_id
column