dilomere
PPrisma
•Created by dilomere on 4/24/2025 in #help-and-questions
Schema Troubleshooting
@Nurul (Prisma) yeah i did both
7 replies
PPrisma
•Created by dilomere on 4/24/2025 in #help-and-questions
Schema Troubleshooting
@Nurul (Prisma) absolutely,
There 3 main ideas i have tried in the following order.
1) tried db push, then db push --force-reset.
2) removed the migration folder. then did db push --force-reset. got the same error. then I tried to create a new migration just in case there was a mirgration drift, sadly I got the same error. I then tried to reset the migration and then push a new migration up, but the error persisted.
3) For the local database server, the application i'm using is xammps to host the mysql database. Xammps uses myphpadmin for its server.
a) i navigated to the YOTP database, went into Bid table, and drop the index. tried repushing.
b) Tried dropping the indexes along with their foreign key column.
c) Tried dropping the table
d) lastly i dropped the whole database, including the migration table, but when i went to repush i got the same error. (One thing to note is that I was able to get db push to work as long as I as i forced it)
7 replies
PPrisma
•Created by dilomere on 4/24/2025 in #help-and-questions
Schema Troubleshooting
generator client {
provider = "prisma-client-js"
previewFeatures = ["metrics"]
}
datasource db {
provider = "mysql"
url = env("DATABASE_URL")
}
model User {
userID Int @id @default(autoincrement()) //primary key of the user table
username String @unique
password String
email String @unique
emailVerified Boolean @default(false)
listings Listing[] //one to many relationship. One user can have many listing
allBids Bid[] // one to many relationship. One user can have many bids
}
model Listing {
listingID Int @id @default(autoincrement()) //primary key of the Listing table
sellerID Int //foreign key of the user table is stored here. This is the user who is creating the listing
listCreationTimestamp DateTime @default(now())
listExpirationTimestamp DateTime @default(dbgenerated("DATE_ADD(NOW(), INTERVAL 2 DAY)")) //when the auction is over
closedListing String @default("open")
listTitle String
listDesc String?
listImg Bytes? @db.LongBlob
currentBid Int @default(0) //remove from schema to futher normalize, we can use this value by joining the bid table
creator User @relation(fields: [sellerID], references: [userID])
highBider Bid? //one to one relation.
}
model Bid {
bidID Int @id @default(autoincrement()) //primary key of the table of the Bid table
listID Int @unique //foreign key of the listing table. represents the listing that users are bidding on.
bidderID Int //foreign key of the user table. represents the user who is bidding on a listing
value Int @default(0) //must be greater than 0
bidder User @relation(fields: [bidderID], references: [userID]) //establishing the foreign key of the user table.
bidOnListing Listing @relation(fields: [listID], references: [listingID]) //establishing the foreign key of the Listing table.
}
7 replies
PPrisma
•Created by dilomere on 4/15/2025 in #help-and-questions
Schema Troubleshooting
generator client {
provider = "prisma-client-js"
previewFeatures = ["metrics"]
}
datasource db {
provider = "mysql"
url = env("DATABASE_URL")
}
model User {
userID Int @id @default(autoincrement()) //primary key of the user table
username String @unique
password String
email String @unique
emailVerified Boolean @default(false)
listings Listing[] //one to many relationship. One user can have many listing
allBids Bid[] // one to many relationship. One user can have many bids
}
model Listing {
listingID Int @id @default(autoincrement()) //primary key of the Listing table
sellerID Int //foreign key of the user table is stored here. This is the user who is creating the listing
listCreationTimestamp DateTime @default(now())
listExpirationTimestamp DateTime @default(dbgenerated("DATE_ADD(NOW(), INTERVAL 2 DAY)")) //when the auction is over
closedListing String @default("open")
listTitle String
listDesc String?
listImg Bytes? @db.LongBlob
currentBid Int @default(0) //remove from schema to futher normalize, we can use this value by joining the bid table
creator User @relation(fields: [sellerID], references: [userID]) highBider Bid? //one to one relation. } model Bid { bidID Int @id @default(autoincrement()) //primary key of the table of the Bid table listID Int @unique //foreign key of the listing table. represents the listing that users are bidding on. bidderID Int //foreign key of the user table. represents the user who is bidding on a listing value Int @default(0) //must be greater than 0 bidder User @relation(fields: [bidderID], references: [userID]) //establishing the foreign key of the user table. bidOnListing Listing @relation(fields: [listID], references: [listingID]) //establishing the foreign key of the Listing table. }
creator User @relation(fields: [sellerID], references: [userID]) highBider Bid? //one to one relation. } model Bid { bidID Int @id @default(autoincrement()) //primary key of the table of the Bid table listID Int @unique //foreign key of the listing table. represents the listing that users are bidding on. bidderID Int //foreign key of the user table. represents the user who is bidding on a listing value Int @default(0) //must be greater than 0 bidder User @relation(fields: [bidderID], references: [userID]) //establishing the foreign key of the user table. bidOnListing Listing @relation(fields: [listID], references: [listingID]) //establishing the foreign key of the Listing table. }
5 replies