Skip to content

Commit

Permalink
Change to supabase
Browse files Browse the repository at this point in the history
  • Loading branch information
neutcomp committed Apr 16, 2024
1 parent 81a1691 commit d15e1f1
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 172 deletions.
108 changes: 0 additions & 108 deletions prisma/migrations/0_init/migration.sql

This file was deleted.

125 changes: 61 additions & 64 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -3,84 +3,63 @@ generator client {
}

datasource db {
provider = "mysql"
url = env("DATABASE_URL")
provider = "postgresql"
url = env("DATABASE_URL")
directUrl = env("DIRECT_URL")
}

model Account {
id String @id @default(cuid())
userId String
type String
provider String
providerAccountId String
refresh_token String? @db.Text
access_token String? @db.Text
expires_at Int?
token_type String?
scope String?
id_token String? @db.Text
session_state String?
id String @id
userId String @unique
type String
provider String
providerAccountId String
refresh_token String? @db.Text
access_token String? @db.Text
expires_at Int?
token_type String?
scope String?
id_token String? @db.Text
session_state String?
User User @relation(fields: [userId], references: [id], onDelete: Cascade)
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@unique([provider, providerAccountId])
@@index([userId])
}

model Attendee {
id Int @id @default(autoincrement())
userId String
firstname String @db.VarChar(20)
lastname String @db.VarChar(30)
rating Int?
isActive Boolean @default(true)
createdAt DateTime @default(now()) @db.DateTime(0)
updatedAt DateTime? @db.DateTime(0)
User User @relation(fields: [userId], references: [id])
TournamentAttendees TournamentAttendees[]
@@unique([userId, firstname, lastname])
}

model Session {
id String @id @default(cuid())
id String @id
sessionToken String @unique
userId String
expires DateTime
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
}
User User @relation(fields: [userId], references: [id], onDelete: Cascade)
model User {
id String @id @default(cuid())
name String?
email String? @unique
emailVerified DateTime?
image String?
accounts Account[]
sessions Session[]
attendee Attendee[]
tournament Tournament[]
}

model VerificationToken {
identifier String
token String @unique
expires DateTime
@@unique([identifier, token])
}

model Attendee {
id Int @id @default(autoincrement())
userId String
firstname String @db.VarChar(20)
lastname String @db.VarChar(30)
rating Int?
isActive Boolean @default(true)
createdAt DateTime @default(now()) @db.DateTime(0)
updatedAt DateTime? @db.DateTime(0)
user User @relation(fields: [userId], references: [id], onUpdate: Cascade)
tournamentAttendees TournamentAttendees[]
@@unique([userId, firstname, lastname])
@@index([userId])
}

model Tournament {
id Int @id @default(autoincrement())
userId String
name String @db.VarChar(45)
createdAt DateTime @default(now()) @db.DateTime(0)
updatedAt String? @db.VarChar(45)
tournamentAttendees TournamentAttendees[]
user User @relation(fields: [userId], references: [id], onUpdate: Cascade)
id Int @id @default(autoincrement())
userId String
name String @db.VarChar(45)
createdAt DateTime @default(now()) @db.DateTime(0)
updatedAt String? @db.VarChar(45)
User User @relation(fields: [userId], references: [id])
TournamentAttendees TournamentAttendees[]
@@unique([userId, name])
}
Expand All @@ -89,11 +68,29 @@ model TournamentAttendees {
id Int @id @default(autoincrement())
tournamentId Int
attendeeId Int
Attendee Attendee @relation(fields: [attendeeId], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "attendee_id_fkey")
Tournament Tournament @relation(fields: [tournamentId], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "tournament_id_fkey")
@@index([attendeeId], map: "attendee_id_fkey_idx")
@@index([tournamentId], map: "tournament_id_fkey")
}

model User {
id String @id
name String?
email String? @unique
emailVerified DateTime?
image String?
Account Account?
Attendee Attendee[]
Session Session[]
Tournament Tournament[]
}

model VerificationToken {
identifier String
token String @unique
expires DateTime
@@unique([identifier, token])
}

0 comments on commit d15e1f1

Please sign in to comment.