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>
47 lines
1.4 KiB
Text
47 lines
1.4 KiB
Text
<cfsetting showdebugoutput="false">
|
|
<cfsetting enablecfoutputonly="true">
|
|
<cfcontent type="application/json; charset=utf-8" reset="true">
|
|
|
|
<cfscript>
|
|
// Check lt_ItemID_TemplateItemID for Big Dean's (BusinessID 27)
|
|
bizId = 27;
|
|
|
|
// Count total links
|
|
qCount = queryExecute("SELECT COUNT(*) as cnt FROM lt_ItemID_TemplateItemID", {}, { datasource: "payfrit" });
|
|
|
|
// Get template item IDs for this business
|
|
qTemplates = queryExecute("
|
|
SELECT DISTINCT tl.TemplateItemID, i.Name
|
|
FROM lt_ItemID_TemplateItemID tl
|
|
JOIN Items i ON i.ID = tl.TemplateItemID
|
|
WHERE i.BusinessID = :bizId
|
|
", { bizId: bizId }, { datasource: "payfrit" });
|
|
|
|
templates = [];
|
|
for (row in qTemplates) {
|
|
arrayAppend(templates, { "TemplateItemID": row.TemplateItemID, "Name": row.Name });
|
|
}
|
|
|
|
// Get items that should be categories (ParentItemID=0, not templates)
|
|
qCategories = queryExecute("
|
|
SELECT i.ID, i.Name, i.ParentItemID, i.IsCollapsible
|
|
FROM Items i
|
|
WHERE i.BusinessID = :bizId
|
|
AND i.ParentItemID = 0
|
|
AND i.IsCollapsible = 0
|
|
AND NOT EXISTS (SELECT 1 FROM lt_ItemID_TemplateItemID tl WHERE tl.TemplateItemID = i.ID)
|
|
ORDER BY i.SortOrder
|
|
", { bizId: bizId }, { datasource: "payfrit" });
|
|
|
|
categories = [];
|
|
for (row in qCategories) {
|
|
arrayAppend(categories, { "ItemID": row.ID, "Name": row.Name });
|
|
}
|
|
|
|
writeOutput(serializeJSON({
|
|
"OK": true,
|
|
"totalTemplateLinks": qCount.cnt,
|
|
"templatesForBusiness": templates,
|
|
"categoriesForBusiness": categories
|
|
}));
|
|
</cfscript>
|