Skip to content

Instantly share code, notes, and snippets.

@igor-ribeiro
Created July 20, 2022 15:00
Show Gist options
  • Save igor-ribeiro/1cd7c3ac732e0d399afd72d849898f38 to your computer and use it in GitHub Desktop.
Save igor-ribeiro/1cd7c3ac732e0d399afd72d849898f38 to your computer and use it in GitHub Desktop.
{
"id": {
"prefix": ["id"],
"description": "Prisma id column",
"body": ["id String @id @default(${1:cuid()})"]
},
"dates": {
"prefix": ["dates"],
"description": "Prisma createdAt and updatedAt",
"body": [
"createdAt DateTime @default(now())",
"updatedAt DateTime @updatedAt",
""
]
},
"model": {
"prefix": ["model"],
"description": "Prisma model",
"body": [
"model $1 {",
" id String @id @default(${2:cuid()})",
" $3",
" ",
" createdAt DateTime @default(now())",
" updatedAt DateTime @updatedAt",
"}"
]
},
"relation": {
"prefix": ["relation"],
"description": "Prisma relation",
"body": [
"$1 ${1/(.*)/${1:/capitalize}/} @relation(fields: [$1Id], references: [id], onDelete: Cascade, onUpdate: Cascade)",
"$1Id String"
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment