ImEgg
ImEgg
Explore posts from servers
PPrisma
Created by ImEgg on 10/28/2024 in #help-and-questions
Mongodb, Making Breaking changes to production database
Hi, I'm trying to understand what the suggested way or best practices for making breaking changes to a database in production are. for simplicity sake, let's say I have a schema for mongodb:
model User {
id String
tenant_id String
email String @unique
password String
line_one String
city String
state String
zip String
@@map("users")
}
model User {
id String
tenant_id String
email String @unique
password String
line_one String
city String
state String
zip String
@@map("users")
}
where there is already data present. let's say now I want to be able to have multiple addresses so I want the schema to be put like this:
model User {
id String
tenant_id String
email String @unique
password String
//assume type is of same fields
address Address[]
@@map("users")
}
model User {
id String
tenant_id String
email String @unique
password String
//assume type is of same fields
address Address[]
@@map("users")
}
To add the new address field is okay but the moving of existing data from the 4 separate fields to now the new address object is what I am having a hard time understanding how to do. I'd like to understand how people are doing these types of database changes for mongodb with prisma or just in general I suppose. thanks!
6 replies
TTCTheo's Typesafe Cult
Created by ImEgg on 2/23/2024 in #questions
Integration Testing for APIs that interact with a Third-Party System
I have built an API (using FastAPI) where it's only job is to collect data from a Third-Party System via Webhooks, process that data then store it into my MySQL DB using prisma. from these Events that get sent to my API from this external system, depending on the event, I have a series of API requests back to this Third-Party System to actually gather the data that is a part of that specific event from that system (don't ask why that data isn't just present in the webhook event data, I have no idea.) That being said, I'm trying to move forward with building out a testing framework (using pytest) to make sure that everything works and continues to work. I'm having issues understanding how to go about doing this so I'm hoping someone could break down where my thinking is going wrong and help better explain things for my specific scenario (in comments... too many words) Totally understand there's a lot to read here. If it's just one bullet point you respond to, even that would be super helpful. Thank you for your time!!
4 replies