Update all SQL queries, query result references, and ColdFusion code to match
the renamed database schema. Tables use plural CamelCase, PKs are all `ID`,
column prefixes stripped (e.g. BusinessName→Name, UserFirstName→FirstName).
Key changes:
- Strip table-name prefixes from all column references (Businesses, Users,
Addresses, Hours, Menus, Categories, Items, Stations, Orders,
OrderLineItems, Tasks, TaskCategories, TaskRatings, QuickTaskTemplates,
ScheduledTaskDefinitions, ChatMessages, Beacons, ServicePoints, Employees,
VisitorTrackings, ApiPerfLogs, tt_States, tt_Days, tt_AddressTypes,
tt_OrderTypes, tt_TaskTypes)
- Rename PK references from {TableName}ID to ID in all queries
- Rewrite 7 admin beacon files to use ServicePoints.BeaconID instead of
dropped lt_Beacon_Businesses_ServicePoints link table
- Rewrite beacon assignment files (list, save, delete) for new schema
- Fix FK references incorrectly changed to ID (OrderLineItems.OrderID,
Categories.MenuID, Tasks.CategoryID, ServicePoints.BeaconID)
- Update Addresses: AddressLat→Latitude, AddressLng→Longitude
- Update Users: UserPassword→Password, UserIsEmailVerified→IsEmailVerified,
UserIsActive→IsActive, UserBalance→Balance, etc.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
74 lines
1.9 KiB
Text
74 lines
1.9 KiB
Text
<cfsetting showdebugoutput="false">
|
|
<cfsetting enablecfoutputonly="true">
|
|
<cfcontent type="application/json; charset=utf-8" reset="true">
|
|
|
|
<cfscript>
|
|
response = {};
|
|
|
|
try {
|
|
// Get all businesses with items
|
|
qBusinesses = queryExecute("
|
|
SELECT DISTINCT i.BusinessID, COUNT(*) as ItemCount
|
|
FROM Items i
|
|
WHERE i.BusinessID > 0
|
|
GROUP BY i.BusinessID
|
|
", {}, { datasource: "payfrit" });
|
|
|
|
response["businesses_with_items"] = [];
|
|
for (b in qBusinesses) {
|
|
arrayAppend(response["businesses_with_items"], {
|
|
"businessID": b.ID,
|
|
"itemCount": b.ItemCount
|
|
});
|
|
}
|
|
|
|
// Get categories
|
|
qCategories = queryExecute("
|
|
SELECT ID, COUNT(*) as cnt
|
|
FROM Categories
|
|
GROUP BY BusinessID
|
|
", {}, { datasource: "payfrit" });
|
|
|
|
response["categories_by_business"] = [];
|
|
for (c in qCategories) {
|
|
arrayAppend(response["categories_by_business"], {
|
|
"businessID": c.BusinessID,
|
|
"count": c.cnt
|
|
});
|
|
}
|
|
|
|
// Get sample items
|
|
qItems = queryExecute("
|
|
SELECT ID, BusinessID, CategoryID, ParentItemID, Name, IsActive
|
|
FROM Items
|
|
WHERE IsActive = 1
|
|
LIMIT 20
|
|
", {}, { datasource: "payfrit" });
|
|
|
|
response["sample_items"] = [];
|
|
for (i in qItems) {
|
|
arrayAppend(response["sample_items"], {
|
|
"id": i.ID,
|
|
"businessID": i.BusinessID,
|
|
"categoryID": i.CategoryID,
|
|
"parentID": i.ParentItemID,
|
|
"name": i.Name,
|
|
"active": i.IsActive
|
|
});
|
|
}
|
|
|
|
// Get template links
|
|
qLinks = queryExecute("
|
|
SELECT COUNT(*) as cnt FROM lt_ItemID_TemplateItemID
|
|
", {}, { datasource: "payfrit" });
|
|
response["template_link_count"] = qLinks.cnt;
|
|
|
|
response["OK"] = true;
|
|
|
|
} catch (any e) {
|
|
response["ERROR"] = e.message;
|
|
response["DETAIL"] = e.detail ?: "";
|
|
}
|
|
|
|
writeOutput(serializeJSON(response));
|
|
</cfscript>
|