G
G
Gleb Lukashonok2022-03-14 00:52:48
ORM
Gleb Lukashonok, 2022-03-14 00:52:48

How to do an INSERT in a model?

Started writing in NestJS and decided to use postgres and prisma ( https://www.prisma.io/ ).
Here is the model:

model User {
    id Int @id @default(autoincrement())
    createdAt DateTime @default(now())
    updatedAt DateTime @updatedAt
    login String @default(autoincrement())
    password String?
}

Whether it is possible somehow at the declaration of this model to make so that the prism did INSERT in a DB? Let's say that admin is always created with an empty password.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
entermix, 2022-03-14
@entermix

Fixtures are usually used for such purposes (google: prisma.io fixtures)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question