Migrate ingest and API paths to string IDs

This commit is contained in:
2026-02-14 20:10:23 +03:00
parent 6df92b7a69
commit 3ffdf9b0e1
42 changed files with 1958 additions and 437 deletions

View File

@@ -0,0 +1,53 @@
-- Rollback Phase 2: Remove string ID (sid) columns
-- Drop sid from failure_events and foreign key sid columns
DROP INDEX idx_failure_events_asset_sid ON failure_events;
DROP INDEX idx_failure_events_component_sid ON failure_events;
ALTER TABLE failure_events DROP COLUMN asset_sid;
ALTER TABLE failure_events DROP COLUMN component_sid;
ALTER TABLE failure_events DROP COLUMN sid;
-- Drop sid from ticket_links and foreign key sid columns
DROP INDEX idx_ticket_links_asset_sid ON ticket_links;
DROP INDEX idx_ticket_links_ticket_sid ON ticket_links;
ALTER TABLE ticket_links DROP COLUMN asset_sid;
ALTER TABLE ticket_links DROP COLUMN ticket_sid;
ALTER TABLE ticket_links DROP COLUMN sid;
-- Drop sid from tickets
ALTER TABLE tickets DROP COLUMN sid;
-- Drop sid from installations and foreign key sid columns
DROP INDEX idx_installations_component_sid ON installations;
DROP INDEX idx_installations_asset_sid ON installations;
ALTER TABLE installations DROP COLUMN component_sid;
ALTER TABLE installations DROP COLUMN asset_sid;
ALTER TABLE installations DROP COLUMN sid;
-- Drop sid from components and foreign key sid columns
DROP INDEX idx_components_lot_sid ON components;
ALTER TABLE components DROP COLUMN lot_sid;
ALTER TABLE components DROP COLUMN sid;
-- Drop sid from assets and foreign key sid columns
DROP INDEX idx_assets_location_sid ON assets;
DROP INDEX idx_assets_project_sid ON assets;
ALTER TABLE assets DROP COLUMN location_sid;
ALTER TABLE assets DROP COLUMN project_sid;
ALTER TABLE assets DROP COLUMN sid;
-- Drop sid from lots
ALTER TABLE lots DROP COLUMN sid;
-- Drop sid from locations and foreign key sid columns
DROP INDEX idx_locations_customer_sid ON locations;
ALTER TABLE locations DROP COLUMN customer_sid;
ALTER TABLE locations DROP COLUMN sid;
-- Drop sid from projects and foreign key sid columns
DROP INDEX idx_projects_customer_sid ON projects;
ALTER TABLE projects DROP COLUMN customer_sid;
ALTER TABLE projects DROP COLUMN sid;
-- Drop sid from customers
ALTER TABLE customers DROP COLUMN sid;

View File

@@ -0,0 +1,2 @@
-- This migration is now obsolete as 0011 recreates all tables from scratch with string IDs
-- Keeping this file to maintain migration numbering sequence