chore(comments): re-point dangling supabase/migrations breadcrumbs

The Supabase purge deleted the archived supabase/migrations/.archived/
directory, but 12 src/ files still referenced its files by path in
JSDoc / TODO comments. The references were misleading (pointing to
deleted files), so re-point them at the canonical location of those
RPCs in db/migrations/0001_init.sql. No code or behavior changes.

Also fixed a stray 'supabase shim returns empty results' comment in
src/app/admin/page.tsx (the shim was already removed in Step 3 of
the refactor).
This commit is contained in:
Nora
2026-06-25 17:52:54 -06:00
parent 49b8e27219
commit b018f2be5b
13 changed files with 55 additions and 48 deletions
+4 -3
View File
@@ -68,9 +68,10 @@ export type ConversionFunnel = {
/**
* Aggregate KPIs over a date window. Replaces the
* `get_reports_summary` SECURITY DEFINER RPC from
* `supabase/migrations/031_reports_v1_rpcs.sql`. Returns zeroed metrics
* if the caller is unauthenticated or no orders exist in the window.
* `get_reports_summary` SECURITY DEFINER RPC (originally from the now-
* archived supabase migrations; consolidated into
* `db/migrations/0001_init.sql`). Returns zeroed metrics if the caller
* is unauthenticated or no orders exist in the window.
*/
async function getReportsSummary(
brandId: string | null,
+3 -2
View File
@@ -11,8 +11,9 @@ export type ImportOrdersResult =
/**
* Bulk-import orders. Replaces the legacy `create_order_with_items` SECURITY
* DEFINER RPC (`supabase/migrations/021_shipping_only_brand.sql`). The new
* `orders` schema doesn't have `subtotal`, `customer_name`, `customer_email`,
* DEFINER RPC (originally from the now-archived supabase migrations;
* consolidated into `db/migrations/0001_init.sql`). The new `orders`
* schema doesn't have `subtotal`, `customer_name`, `customer_email`,
* `customer_phone`, or `stop_id` columns — totals are stored in
* `total_cents` and customers are referenced by `customer_id`. For each
* imported order we upsert a `customers` row keyed on email+tenant, then
+2 -1
View File
@@ -73,7 +73,8 @@ export type CampaignActivityRow = {
// ── Helpers ──────────────────────────────────────────────────────────────────
//
// The reports V1 RPCs (`get_reports_summary`, `get_orders_by_stop_report`, etc.)
// from `supabase/migrations/031_reports_v1_rpcs.sql` reference legacy columns
// (originally from the now-archived supabase migrations; consolidated
// into `db/migrations/0001_init.sql`) reference legacy columns
// (`orders.subtotal`, `stops.city/state/date`, `communication_contacts`).
// The SaaS rebuild has a different `orders` schema (`total_cents`, no
// `stop_id`/`city`/`state` columns on `stops`) and a different contacts table
+7 -6
View File
@@ -4,12 +4,13 @@ import { getAdminUser } from "@/lib/admin-permissions";
import { getActiveBrandId, assertBrandAccess } from "@/lib/brand-scope";
// TODO(migration): the `harvest_lots` / `harvest_lot_events` / `lot_orders`
// tables from the route-trace feature (defined across
// supabase/migrations/143_enable_route_trace.sql and friends) were retired
// from the SaaS rebuild — they don't exist in `db/schema/`. The functions
// below all return empty results so the public trace page and FSMA reports
// 404 gracefully. If route-trace comes back, re-introduce the tables in
// `db/schema/` and replace these stubs with real Drizzle queries.
// tables from the route-trace feature (originally defined in the now-
// archived supabase migrations; consolidated into
// `db/migrations/0001_init.sql`) were retired from the SaaS rebuild —
// they don't exist in `db/schema/`. The functions below all return empty
// results so the public trace page and FSMA reports 404 gracefully. If
// route-trace comes back, re-introduce the tables in `db/schema/` and
// replace these stubs with real Drizzle queries.
export interface HarvestLot {
id: string;
+4 -4
View File
@@ -10,10 +10,10 @@ export type UpdateShippingStatusResult =
// TODO(migration): shipping is dormant in the SaaS rebuild. The legacy
// `shipments` table (with `tracking_number`, `fedex_shipment_id`, etc.),
// the `shipping_status` column on `orders`, and the `update_shipping_order`
// RPC from `supabase/migrations/040_shipping_fulfillment_rpcs.sql` are
// gone. The functions below stub to "not configured" so the admin
// shipping tab renders gracefully. Re-introduce shipping in
// `db/schema/` when the feature is reactivated.
// RPC (originally from the now-archived supabase migrations) are gone.
// The functions below stub to "not configured" so the admin shipping
// tab renders gracefully. Re-introduce shipping in `db/schema/` when
// the feature is reactivated.
export async function updateShippingStatus(
_orderId: string,
+3 -2
View File
@@ -93,8 +93,9 @@ async function loadShippingSettingsForBrand(brandId: string): Promise<ShippingSe
/**
* Calls the legacy `get_order_items_perishable` SECURITY DEFINER RPC
* via `pool.query`. The function still lives in the database (see
* supabase/migrations/083_shipping_settings.sql).
* via `pool.query`. The function still lives in the database
* (originally from the now-archived supabase migrations; consolidated
* into `db/migrations/0001_init.sql`).
*/
async function isShipmentPerishable(orderId: string): Promise<boolean> {
try {
+6 -6
View File
@@ -11,12 +11,12 @@
*
* TODO(migration): shipping is dormant in the SaaS rebuild. The
* legacy `shipping_settings` table (with the FedEx credential columns
* this file needs) is still present in the database — see
* supabase/migrations/083_shipping_settings.sql — but the new
* `db/schema/` does not declare it. The data reads below hit the
* legacy table directly via `pool.query`. When shipping comes back,
* declare the table in `db/schema/shipping.ts` and switch the reads
* to Drizzle.
* this file needs) is still present in the database — originally from
* the now-archived supabase migrations, consolidated into
* `db/migrations/0001_init.sql` — but the new `db/schema/` does not
* declare it. The data reads below hit the legacy table directly via
* `pool.query`. When shipping comes back, declare the table in
* `db/schema/shipping.ts` and switch the reads to Drizzle.
*/
import { getAdminUser } from "@/lib/admin-permissions";
+6 -6
View File
@@ -4,12 +4,12 @@
* Shipping settings CRUD + FedEx connection test.
*
* TODO(migration): shipping is dormant in the SaaS rebuild. The
* `shipping_settings` table is still part of the legacy schema (see
* supabase/migrations/083_shipping_settings.sql) — the FedEx integration
* continues to read/write it via raw `pool.query` SQL rather than the
* Supabase REST gateway or Drizzle. When shipping is reactivated, move
* the table declaration into `db/schema/shipping.ts` and switch the
* reads to typed Drizzle queries.
* `shipping_settings` table is still part of the legacy schema
* (originally from the now-archived supabase migrations; consolidated
* into `db/migrations/0001_init.sql`) — the FedEx integration continues
* to read/write it via raw `pool.query` SQL rather than Drizzle. When
* shipping is reactivated, move the table declaration into
* `db/schema/shipping.ts` and switch the reads to typed Drizzle queries.
*/
import { getAdminUser } from "@/lib/admin-permissions";
+7 -6
View File
@@ -4,12 +4,13 @@
* Assign / unassign a product to a stop.
*
* TODO(migration): the `assign_product_to_stop` and
* `unassign_product_from_stop` SECURITY DEFINER RPCs live in
* supabase/migrations/030. The RPCs still exist in the database and
* are called via `pool.query` rather than the Supabase REST gateway.
* When stops/products are re-platformed on the SaaS rebuild, replace
* these with direct inserts/deletes on the new `db/schema/stops.ts`
* `stopProducts` table.
* `unassign_product_from_stop` SECURITY DEFINER RPCs (originally from
* the now-archived supabase migrations; consolidated into
* `db/migrations/0001_init.sql`). The RPCs still exist in the
* database and are called via `pool.query`. When stops/products are
* re-platformed on the SaaS rebuild, replace these with direct
* inserts/deletes on the new `db/schema/stops.ts` `stopProducts`
* table.
*/
import { getAdminUser } from "@/lib/admin-permissions";
+6 -6
View File
@@ -152,12 +152,12 @@ async function getBrandTaxSettings(brandId: string): Promise<BrandTaxSettings |
//
// TODO(migration): the tax dashboard reads from the legacy `orders`
// table via the `get_tax_summary` and `get_taxable_orders` SECURITY
// DEFINER RPCs (supabase/migrations/095). Both the table and the RPCs
// still exist; we call the RPCs through `pool.query` rather than the
// Supabase REST gateway. When the SaaS rebuild's orders table grows a
// `tax_amount` column or the tax dashboard is rebuilt against the new
// schema, these helpers should be rewritten against the Drizzle
// `orders` table directly.
// DEFINER RPCs (originally from the now-archived supabase migrations;
// consolidated into `db/migrations/0001_init.sql`). Both the table and
// the RPCs still exist; we call the RPCs through `pool.query`. When the
// SaaS rebuild's orders table grows a `tax_amount` column or the tax
// dashboard is rebuilt against the new schema, these helpers should be
// rewritten against the Drizzle `orders` table directly.
export type TaxByStateRow = {
state: string;
+1 -1
View File
@@ -32,7 +32,7 @@ export default async function AdminPage() {
// so a transient DB/network failure can't crash the whole admin page.
let dashboardBrandId: string | null = adminUser ? await getActiveBrandId(adminUser) : null;
if (!dashboardBrandId && adminUser?.role === "platform_admin") {
// Direct pg query (the supabase shim returns empty results).
// Direct pg query (the legacy query-builder shim returned empty results).
// This ensures a platform_admin sees real dashboard stats even on first login
// before they have chosen an active brand.
try {
+2 -1
View File
@@ -4,7 +4,8 @@
* TODO(migration): wholesale_orders is part of the legacy schema and
* is read/written via raw `pool.query` SQL. The `get_wholesale_settings`
* and `get_payment_settings` SECURITY DEFINER RPCs still live in the
* database (see supabase/migrations/046 and 045) and are also called
* database (originally from the now-archived supabase migrations;
* consolidated into `db/migrations/0001_init.sql`) and are also called
* via `pool.query`. When wholesale is reactivated, declare the tables
* in `db/schema/wholesale.ts` and switch the reads to typed Drizzle.
*/
+4 -4
View File
@@ -5,10 +5,10 @@
* `enqueue_wholesale_notification` SECURITY DEFINER RPC live in the
* legacy schema. Reads are converted to `pool.query`; the
* `enqueue_wholesale_notification` RPC is still in the database
* (supabase/migrations/054) and is called via `pool.query` rather
* than the Supabase REST gateway. When wholesale is reactivated,
* move the tables into `db/schema/wholesale.ts` and switch reads to
* typed Drizzle.
* (originally from the now-archived supabase migrations; consolidated
* into `db/migrations/0001_init.sql`) and is called via `pool.query`.
* When wholesale is reactivated, move the tables into
* `db/schema/wholesale.ts` and switch reads to typed Drizzle.
*/
import { NextRequest, NextResponse } from "next/server";