--- tags: Auto Direct Nearest Location --- # Database Schema Auto Direct Nearest Location ```plantuml package evm { entity user_address <<@, yellow >> { uuid : varchar(50) <<PK2>> -- userId : bigint(20) <<FK>> urbanId : bigint(20) <<FK>> baseAddress : text address : text } entity user <<U, darkCyan >> { id : bigint(20) <<generated>> -- username: varchar(254) password: text } entity stock_location <<S, green >> { id : bigint(20) <<generated>> label : varchar(255) -- brandId: bigInt(20) password: text } entity brand <<B, orange >> { id : bigint(20) <<generated>> code : varchar(10) -- name: varchar(100) stockLocation: int(11) } user::id ||--|{ user_address::userId brand::stockLocation ||--|{ stock_location::id stock_location::brandId||--||brand::id } package inv { entity product_variant_stock <<P, cyan >> { id : char(36) -- product_variant_id : char(36) product_variant_id_int : bigint(20) -- stock_location_id_int: bigint(20) -- stock_on_hand : int(11) stock_reserved : int(11) stock_available : int(11) } } product_variant_stock::stock_location_id_int||--||stock_location::id ```