javascript - Prisma 2 - Map int column to enum - Stack Overflow

At the database I've a column that is from type Integer that can only contain the following values

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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745209777a4616766.html

相关推荐

  • javascript - Prisma 2 - Map int column to enum - Stack Overflow

    At the database I've a column that is from type Integer that can only contain the following values

    5小时前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信