Chagne year to db year.

This commit is contained in:
Bradley Shellnut 2023-08-19 18:10:34 -07:00
parent 1a8ec5b905
commit 714cdca2e4
2 changed files with 28 additions and 2 deletions

View file

@ -159,7 +159,7 @@ model Game {
slug String
description String? @db.LongText
description_preview String? @db.LongText
year_published Int?
year_published Int? @db.Year
min_players Int?
max_players Int?
min_playtime Int?
@ -195,6 +195,7 @@ model Game {
model GameName {
id String @id @default(cuid())
name String
slug String
game_id String
game Game @relation(references: [id], fields: [game_id])
created_at DateTime @default(now()) @db.Timestamp(6)
@ -247,6 +248,7 @@ model Mechanic {
model Designer {
id String @id @default(cuid())
name String
slug String
external_id String @unique
games Game[]
primary_designer Game[] @relation("PrimaryDesigners")
@ -260,7 +262,7 @@ model Designer {
model Artist {
id String @id @default(cuid())
name String
external_id String @unique
slug String @unique
games Game[]
created_at DateTime @default(now()) @db.Timestamp(6)
updated_at DateTime @updatedAt @db.Timestamp(6)

View file

@ -1,5 +1,6 @@
import { PrismaClient } from '@prisma/client';
import kebabCase from 'just-kebab-case';
import { createId } from '@paralleldrive/cuid2';
import categories from './categories.json' assert { type: 'json' };
import mechanics from './mechanics.json' assert { type: 'json' };
@ -49,6 +50,29 @@ async function main() {
console.log('Categories created.');
}
await prisma.publisher.create({
data: {
name: 'Unknown',
slug: 'unknown',
external_id: createId()
}
});
await prisma.designer.create({
data: {
name: 'Unknown',
slug: 'unknown',
external_id: createId()
}
});
await prisma.artist.create({
data: {
name: 'Unknown',
slug: 'unknown'
}
});
// for (const p of userData) {
// const user = await prisma.user.create({
// data: {