I have a domain OrderItem
class OrderItem {
Product product
Packaging packaging
//other details
}
class Product {
//other details
}
class Packaging {
//other details
}
Currently, OrderItem refers only to Beers. Product is the type of beers. Packaging is the cans/bottles/keg/etc.
Then the client decides to also sell items that are not beers: Spirits, Ingredients, Souvenirs, etc.
I'm thinking that these are all OrderItem objects, but the system currently treats OrderItem as Beers. How should I introduce the expanded models? (Note: Some of the new items don't have product, packaging or both.)
I prefer the second one, adding additional property like category
or itemType
.
So when adding the new field your migration script must set the itemType
field value to Beers
for all the existing records( Because all the products you had are all Beers
).
I dont know which of your fields are going to be null
, but if your OrderItem
table is still having many nullable
columns you need to to normalize it.