status updated
This commit is contained in:
26
main.go
26
main.go
@@ -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.
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user