Skip to content

Commit

Permalink
update the schema to match needs
Browse files Browse the repository at this point in the history
  • Loading branch information
samos123 committed Apr 28, 2024
1 parent 10826f5 commit b1fdcc1
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 14 deletions.
2 changes: 1 addition & 1 deletion app/routes/_index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default function Index() {
</div>
<div className="sticky bottom-0">
<form className="flex items-end">
<textarea placeholder="Bio" className="flex-1 textarea textarea-bordered textarea-lg w-full" ></textarea>
<textarea placeholder="Enter chat message.." className="flex-1 textarea textarea-bordered textarea-lg w-full" ></textarea>
<button className="btn bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-r-md">Send</button>
</form>
</div>
Expand Down
44 changes: 31 additions & 13 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,50 @@ generator client {
provider = "prisma-client-js"
}

model User {
id String @id @default(cuid())
email String @unique
model APIProvider {
id String @id @default(cuid())
name String
url String
apiKey String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
password Password?
notes Note[]
models Model[] @relation("models")
activeModel Model? @relation("activeModel", fields: [activeModelId], references: [id])
activeModelId String? @unique
}

model Model {
id String @id @default(cuid())
name String @unique
apiProvider APIProvider @relation("models", fields: [apiProviderId], references: [id])
apiProviderId String
activeForProvider APIProvider? @relation("activeModel")
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}

model Password {
hash String
model Message {
id String @id @default(cuid())
content String
role String
conversation Conversation @relation(fields: [conversationId], references: [id])
conversationId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade, onUpdate: Cascade)
userId String @unique
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}

model Note {
model Conversation {
id String @id @default(cuid())
title String
body String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
user User @relation(fields: [userId], references: [id], onDelete: Cascade, onUpdate: Cascade)
userId String
messages Message[]
}

0 comments on commit b1fdcc1

Please sign in to comment.