admin管理员组

文章数量:1415664

At the database I've a column that is from type Integer that can only contain the following values Active = 1, Temporary=7, Deleted=10. Can these values be mapped from the server to a enum and the database is storing it within a integer column?

According to the documentation I can only use enums when the values are also stored as enums in the database.

At the database I've a column that is from type Integer that can only contain the following values Active = 1, Temporary=7, Deleted=10. Can these values be mapped from the server to a enum and the database is storing it within a integer column?

According to the documentation I can only use enums when the values are also stored as enums in the database.

Share Improve this question asked May 9, 2021 at 18:49 ProVProV 2611 gold badge4 silver badges15 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 3

Have you tried to look at @map? Using your question as input, the enum would look like this.

enum YOU_ENUM {
    Active  @map(1)
    Temporary @map(7)
}

I think it is impossible at the time of writing.

本文标签: javascriptPrisma 2Map int column to enumStack Overflow