Skip to content

Instantly share code, notes, and snippets.

@joshnuss
Created October 11, 2022 08:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshnuss/8b8975ebd982adacc0218aaa757ab407 to your computer and use it in GitHub Desktop.
Save joshnuss/8b8975ebd982adacc0218aaa757ab407 to your computer and use it in GitHub Desktop.
snippet model "define a model"
model ${1:Name} {
id Int @id @default(autoincrement())
${2}
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
snippet enum "define an enum"
enum ${1:Name} {
${2:VALUE}
}
snippet field "define a field"
${1:name} ${2:String}
snippet many "define a has many relationship"
${1:authors} ${2:Author}[]
snippet belongs "define a belongs to relationship"
${1:author} ${2:Author} @relation(fields: [$1Id], references: [id])
$1Id Int
snippet index "define an index"
@@index([${1:field}])
snippet unique "define a unique index"
@@unique([${1:field}])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment