最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin0浏览0评论

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.

发布评论

评论列表(0)

  1. 暂无评论