Migrate ingest and API paths to string IDs
This commit is contained in:
53
migrations/0010_add_string_ids/down.sql
Normal file
53
migrations/0010_add_string_ids/down.sql
Normal 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;
|
||||
2
migrations/0010_add_string_ids/up.sql
Normal file
2
migrations/0010_add_string_ids/up.sql
Normal 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
|
||||
Reference in New Issue
Block a user