xander karimi
xander karimi

Reputation: 443

add field to database without erasing data of table in Prisma

i'm trying to use Prisma ORM. in my table some data exists and this is my model:

model User {
  id Int @default(autoincrement()) @id 
  username String @db.VarChar(100) @unique
}
model Post {
  id         Int        @id @default(autoincrement())
  createdAt  DateTime   @default(now())
  title      String
}

in user model exists some data. how can i add 'password' field in User model without delete any data from User model?

Upvotes: 0

Views: 689

Answers (1)

xander karimi
xander karimi

Reputation: 443

I added this line to the User model and it worked.

password String ?

the ? means that this field can be blank or null.

Upvotes: 1

Related Questions