Skip to content
Discussion options

You must be logged in to vote

Hello @liaodalin19903 👋

You would need to use the @default and @updatedAt attributes in your Prisma model.

The @default attribute sets a default value for a field each time a new record is created. You can use it with now() to set the current timestamp as the default value. (Reference)

The @updatedAt attribute updates the timestamp each time the record is updated. (Reference)

Your model would look something like this:

model DispsysProjs {
  id           Int      @id @default(autoincrement())
  proj_name    String?  @db.VarChar(255)
  proj_dir     String?  @db.VarChar(255)
  proj_version String?  @db.VarChar(255)
  proj_desc    String?
  createdAt    DateTime @default(now()) @db.Timestamptz(6

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@nurul3101
Comment options

@ckblockit
Comment options

Answer selected by liaodalin19903
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants