DT
Drizzle TeamBoxer
Module '"drizzle-orm/mysql-core"' has no exported member 'unique'.ts(2305)
Getting this error when trying to import
unique
B
Boxer•303d ago
docs state it should be there:
https://orm.drizzle.team/docs/indexes-constraints#unique
Indexes & Constraints – DrizzleORM
Drizzle ORM | %s
D
DiamondDragon•302d ago
me too with pg
S
ShiftyMcCool•302d ago
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 nowD
DiamondDragon•302d ago
@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
D
DiamondDragon•302d ago
@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.AS
Andrii Sherman•302d ago
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
AS
Andrii Sherman•302d ago
AS
Andrii Sherman•302d ago
you can find a full set of examples here
D
DiamondDragon•301d ago
ah ok thx. saw the unique import in the docs so was wondering if it was required
B
Boxer•301d ago
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
columnThe official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
7.3KMembers
View on DiscordWant results from more Discord servers?
More PostsIs there a way to set the index operator type for postgres?I'm migrating our project to drizzle, and I want to add the indexes to the table.
Previously we wereHow to update multiple rows with one query?Take this array as an example:
```ts
const data = [
{id: 1, col1: "col1 data where id = 1"}
{id:Use Drizzle in NestJS appHi everyone ! I am new to both drizzle and NestJS and was wondering if there was any recipe out ther[Solved] Transforming const to the configured target environment ("es5") is not supported yetSo I had a old project, and I copied the `DATABASE_URL` and on created a basic drizzle project and `Placeholders in inserting: db.insert().values(placeholder('example'))Hey, how do I add placeholders inside the values of an insert prepare statement? I get an typeerror Can I add a Unique constraint to a column?I couldn't find an option for that in the docs. I'm assuming Drizzle doesn't support that.
So, coul"Cannot parse date or time" using AWS Data API, aurora postgresI'm trying drizzle-orm (with sst) and aurora pg thru aws data api, when trying to insert a Date valuFiltering against a relationI have a orgs table that have a many to many relation with a users table.
while querying with the fGet type for select query?Hey guys, is there a way to infer the "select" type for a given table? for example:
```ts
async getorderBy related table columnGiven a relational query such as
```
const matchResult = await db.query.matches.findMany({
Soft Delete StrategyI'm a person of eloquent taste; one who prefers the soft delete. With the current feature set of driColumns that not allowed to updatedHi guys, I'm looking for a proper way to declare SQL schema and its `InferModel` types when there'rExecute sql with '?' as parameterHello everyone.
Please, how do I execute a sql that uses as a parameter the character '?' ?
For examForeign Key Reference to auth Schema Not Generated in CodeI'm having an issue with my Drizzle-ORM code where the foreign key reference to the 'auth' schema isHow can I add a Prefix Index?I migrated from Prisma, and I have a column with `varchar(2000)` which I indexed with `@@index([coluconnect to local postgresDoes anyone knows how to connect to a local pg with neon?
I tried:
```
import { neon, neonConfig } defaultNow(), onUpdateNow() not available on the datetime data typeI'm able to build this into my database, but I'm not able to express it through drizzle. What gives?NeonDbError: db error: ERROR: permission denied for schema drizzleCreated a new database on neon.tech today and trying to run migrations
```
// src/db/migrate.ts
impHow can I filter on a joined table field (nested value) with the relational query syntax?☝🏻How to implement a where clause on a joined table with the new relation builder?This was my original query, the big problem is that it returns as many rows as there are messages in