prisma: prisma generate - The model name `Subscription` is invalid - Can you un-reserve the name `Subscription`?

Subscription is an object we are using, Can you un-reserve the name Subscription? Thanks

npx prisma generate
Environment variables loaded from prisma/.env
Error: Schema parsing
error: Error validating model "Subscription": The model name `Subscription` is invalid. It is a reserved name. Please change it.
  -->  schema.prisma:1158
   | 
1157 | 
1158 | model Subscription {
1159 |   averagePrice           Float?
1160 |   companieId             String
1161 |   countAveragePrice      Float?
1162 |   createdAt              DateTime
1163 |   dateCancellation       DateTime?
1164 |   id                     String                         @id
1165 |   issuedCardId           String
1166 |   lastInvoiceDate        DateTime?
1167 |   maxDateAveragePrice    DateTime?
1168 |   minDateAveragePrice    DateTime?
1169 |   paymentFrequency       Subscription_paymentFrequency?
1170 |   productId              String
1171 |   status                 Subscription_status
1172 |   testMode               Boolean
1173 |   trialPeriod            Float?
1174 |   updatedAt              DateTime
1175 |   userId                 String
1176 |   Companie               Companie                       @relation(fields: [companieId], references: [id])
1177 |   IssuedCard             IssuedCard                     @relation(fields: [issuedCardId], references: [id])
1178 |   Product                Product                        @relation(fields: [productId], references: [id])
1179 |   User                   User                           @relation(fields: [userId], references: [id])
1180 |   SubscriptionInvoice    SubscriptionInvoice[]          @relation("SubscriptionToSubscriptionInvoice_subscriptionId")
1181 |   SubscriptionManagement SubscriptionManagement[]
1182 |   DataProduct            DataProduct[]                  @relation(references: [id])
1183 |   File                   File[]                         @relation(references: [id])
1184 |   Log                    Log[]                          @relation(references: [id])
1185 | 
1186 |   @@index([companieId], name: "companieId")
1187 |   @@index([issuedCardId], name: "issuedCardId")
1188 |   @@index([productId], name: "productId")
1189 |   @@index([userId], name: "userId")
1190 | }
   | 

Validation Error Count: 1

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 15 (7 by maintainers)

Most upvoted comments

You can change the name of the model to something else than Subscription and add @@map("Subscription") inside the model, so Prisma knows what database table this refers to.