Skip to content
This repository was archived by the owner on Mar 21, 2025. It is now read-only.
This repository was archived by the owner on Mar 21, 2025. It is now read-only.

Unique array error #417

Closed
Closed
@karima-xyz

Description

@karima-xyz

I come from Javascript background so apologize in advance if I don't use the correct term/syntax. I am making a tree data structure using materialized path. Each path in a database should be a unique array. However, when I generate the client it created an invalid client.

Here is an example model:

model item {
    numeric_id BigInt   @unique @default(autoincrement())
    path       BigInt[] @unique
}

Here is the offending snippet in the generated client:

impl From<UniqueWhereParam> for WhereParam {
    fn from(value: UniqueWhereParam) -> Self {
        match value {
            UniqueWhereParam::NumericIdEquals(value) => {
                Self::NumericId(_prisma::read_filters::BigIntFilter::Equals(value))
            }
            UniqueWhereParam::PathEquals(value) => {
                Self::Path(_prisma::read_filters::BigIntListFilter::Equals(value))
            }
        }
    }
}

The problem is that value on PathEquals is i64 and the expected type for BigIntListFilter::Equals is Vec<i64>.

EDIT : Forgot to mention, my current workaround is manually editing the enum. I haven't tested it but it compiles just fine.

Before:

pub enum UniqueWhereParam {
    NumericIdEquals(i64),
    PathEquals(i64),
}

After:

pub enum UniqueWhereParam {
    NumericIdEquals(i64),
    PathEquals(Vec<i64>),
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions