DuckyDev
08/08/2022, 7:43 AMJared Fraser
08/08/2022, 7:44 AMDuckyDev
08/08/2022, 7:46 AMNurul
08/08/2022, 9:43 AMDuckyDev
08/08/2022, 10:10 AMDuckyDev
08/08/2022, 10:29 AMprisma db pull
, created a new data service in nestjs
import { INestApplication, Injectable, OnModuleInit } from '@nestjs/common';
import { PrismaClient } from '@prisma/client';
@Injectable()
export class DataService extends PrismaClient implements OnModuleInit {
async onModuleInit() {
await this.$connect();
}
async enableShutdownHooks(app: INestApplication) {
this.$on('beforeExit', async () => {
await app.close();
});
}
}
[Nest] 34568 - 08/08/2022, 12:27:54 ERROR [ExceptionHandler] @prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.
In case this error is unexpected for you, please report it in <https://github.com/prisma/prisma/issues>
Error: @prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.
DuckyDev
08/08/2022, 10:30 AMprisma generate
when I used the introspect tool?Nurul
08/08/2022, 10:33 AMprisma generate
command every time there is changes to the schema file.DuckyDev
08/08/2022, 10:38 AMschema
file. However it doesn’t seem like it is possible to have two fields with the same name in the database?
error: Field "Year" is already defined on model "tblibsclaims".
--> schema.prisma:704
|
703 | Year Int @default(0) @map("1Year")
704 | Year Int @default(0) @map("3Year")
|
error: Field "Years" is already defined on model "tblibsconvictions".
--> schema.prisma:718
|
717 | Years Int? @default(100) @map("3Years")
718 | Years Int? @default(100) @map("5Years")
DuckyDev
08/08/2022, 10:41 AMNurul
08/08/2022, 10:43 AMDuckyDev
08/08/2022, 10:44 AMJared Fraser
08/08/2022, 11:48 PM703 | Year1 Int @default(0) @map("1Year")
704 | Year3 Int @default(0) @map("3Year")
Note that in javascript identifiers can't start with a number, so 1Year
won't be a valid name.DuckyDev
08/12/2022, 7:31 AM