mirror of
https://github.com/bitbaum/evig.git
synced 2026-12-04 05:37:00 +01:00
User-approved 1-commit scope to finish the schema cleanups that previously shipped at the TS layer only. Two distinct removals batched in migration 073 because both are pure deletion + were verified non-consumer in prior commits: 1. helper_profiles table + helper_profiles_v view. TS declaration removed in0b410106after Phase 2 migration 061 unified into repairer_profiles (profile_tier='community'). Verified zero production consumers at TS-removal time; the DB column stayed until now for historical preservation. 2. Five Medusa integration columns. TS declarations removed in6f0852d8after grep verified zero consumers anywhere in src/ (Medusa was an e-commerce framework integration that never shipped): - ai_extracted_products.medusa_product_id - inventory_items.medusa_product_id - inventory_items.medusa_variant_id - orders.medusa_order_id - orders.medusa_cart_id - order_items.medusa_variant_id Migration uses DROP IF EXISTS for both view and columns so it's idempotent — safe to re-run if a prior partial application happened. Also removed the now-obsolete tombstone comments that explained the "TS removed but DB column still present" half-state: - src/db/schema/inventory.ts: 3 medusa tombstones, 1 platform-values aspirational note - src/db/schema/payments.ts: 2 medusa tombstones (orders + order_items) - src/db/schema/itHilfe.ts: HELPER PROFILES header block Migration 073's commit message + git history serve as documentation of what was dropped; tombstone comments in the live schema added noise. The two remaining helper_profiles mentions in the codebase (services.ts:197 "merged from helper_profiles", technicians/[id]/route.ts:5 "formerly helper_profiles") are past-tense historical context and useful — they stay. After migration 073 runs: - schema, TS code, and DB are all consistent - helper_profiles, helper_profiles_v, and the 5 Medusa columns are fully gone - no behavior change (already verified zero consumers) 59 tests pass across schema-touched suites (db, admin/inventory, payment-webhook, marketplace); tsc clean. The 072 migration (token_version add) and 073 migration (this commit's drops) should both run as part of the same deploy window — 072 is required for the JWT-stale-permissions code added in commitsae52f739/0be0f55f/85f6a1f2to function, and 073 is safe to run any time since prior commits already removed the TS references. 31 commits this thread. Roadmap's dead-code-deletes section is now truly complete: 8 false-positives audited, 2 real-positives shipped (helperProfiles + Medusa), 1 verified-orphan-kept (jobRuns), and the DB layer now matches. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
55 lines
2.3 KiB
SQL
55 lines
2.3 KiB
SQL
-- Migration 073: Drop schema objects already removed at the TypeScript layer
|
|
--
|
|
-- Two distinct removals batched into one migration because they're
|
|
-- both pure-deletion + were verified non-consumer in prior commits:
|
|
--
|
|
-- 1. helper_profiles table + helper_profiles_v view (TS removed 2efa25e2).
|
|
-- Phase 2 migration 061 unified helper_profiles into repairer_profiles
|
|
-- (profile_tier='community'). The Drizzle definition was kept as a
|
|
-- deprecated stub "so existing Drizzle migrations compile" — but
|
|
-- Drizzle migrations are SQL files that don't reference the TS
|
|
-- schema, so the justification didn't hold. Removed at the TS layer
|
|
-- in 2efa25e2 after grep verification (only 7 self-references in
|
|
-- comments + the schema file itself; no production code, no API
|
|
-- routes, no tests imported the symbol).
|
|
--
|
|
-- 2. Five Medusa integration columns (TS removed 15e443fb). Medusa was
|
|
-- an e-commerce framework integration that never fully shipped; the
|
|
-- columns sat unused. Removed at the TS layer in 15e443fb after
|
|
-- grep verified zero consumers.
|
|
--
|
|
-- All TS-layer removals already shipped without DB drops because:
|
|
-- - Removing the Drizzle declaration doesn't generate a DROP COLUMN.
|
|
-- - The columns/tables stayed in the DB as historical preservation.
|
|
-- This migration finishes the cleanup at the DB layer. After it runs,
|
|
-- the schema is fully consistent with the TS code.
|
|
|
|
-- ============================================================================
|
|
-- helper_profiles (and its read-only view)
|
|
-- ============================================================================
|
|
|
|
DROP VIEW IF EXISTS helper_profiles_v;
|
|
DROP TABLE IF EXISTS helper_profiles;
|
|
|
|
-- ============================================================================
|
|
-- Medusa columns
|
|
-- ============================================================================
|
|
|
|
-- ai_extracted_products
|
|
ALTER TABLE ai_extracted_products
|
|
DROP COLUMN IF EXISTS medusa_product_id;
|
|
|
|
-- inventory_items
|
|
ALTER TABLE inventory_items
|
|
DROP COLUMN IF EXISTS medusa_product_id,
|
|
DROP COLUMN IF EXISTS medusa_variant_id;
|
|
|
|
-- orders
|
|
ALTER TABLE orders
|
|
DROP COLUMN IF EXISTS medusa_order_id,
|
|
DROP COLUMN IF EXISTS medusa_cart_id;
|
|
|
|
-- order_items
|
|
ALTER TABLE order_items
|
|
DROP COLUMN IF EXISTS medusa_variant_id;
|