status updated

This commit is contained in:
2026-10-09 16:27:51 +05:30
parent ed32a2620e
commit f0361d8343
12 changed files with 559 additions and 23 deletions

26
main.go
View File

@@ -251,6 +251,32 @@ func main() {
log.Println("⚠️ could not add orders.deliveryslotdate, orders will not record which day their window falls on:", err)
}
// Whether a branch is trading today.
//
// SEPARATE FROM tenantlocations.status, which is the platform's word for
// whether the branch exists at all — setting that to Inactive is how a
// branch is decommissioned, and the staff console reads it that way. A
// shopkeeper closing for an afternoon is saying something else entirely,
// and sharing one column would make a day off look like a shop that shut
// down.
//
// Default TRUE, so every branch trading the moment this ships keeps
// trading. There is no backfill and there must never be one.
if err := db.DB.Exec(
`ALTER TABLE tenantlocations ADD COLUMN IF NOT EXISTS isopen boolean NOT NULL DEFAULT true`).Error; err != nil {
log.Println("⚠️ could not add tenantlocations.isopen, every branch will keep reporting as open:", err)
}
// The day it opens again, when the shop knows it.
//
// Nullable, because a power cut has no end date. Nothing flips isopen back
// on a timer — models.StoreIsOpen works the answer out on read, so a branch
// that said "back on Monday" is open on Monday whether or not a job ran.
if err := db.DB.Exec(
`ALTER TABLE tenantlocations ADD COLUMN IF NOT EXISTS closeduntil DATE`).Error; err != nil {
log.Println("⚠️ could not add tenantlocations.closeduntil, branches will not reopen on their own:", err)
}
// When a product became visible to a store, and the only thing that decides
// whether it is.
//