Sp_changeIndex (procedure)
- Type: PROCEDURE
- Deterministic: NO
- SQL data access: CONTAINS SQL
Parameters
No parameters.
Body
Body is not pre-cached. To inspect: mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURESpchangeIndex'._
Narrative
Business context: Schema-maintenance utility. Idempotent index-recreation script — drops then re-adds a fixed set of unique/non-unique indexes on sisproductclassifyprocessclassify, mftproductionplan, and mftproductionplanslave. Run during upgrades to bring an older tenant's index layout up to current expectations.
What it does: For each target table the proc checks information_schema.statistics for the named index, drops it if present, then ALTER TABLE ... ADD UNIQUE/INDEX. Reshapes sisproductclassifyprocessclassify to use (sParentId, sProcessClassifyId, sPartsName, sBrandsId, sSubsidiaryId) as the unique key and (sId, sBrandsId, sSubsidiaryId) as another unique. On mftproductionplan(slave) adds indexes covering (sState, sWorkOrderId, sWorkOrderNo), (sSrcId, sWorkOrderControlId), (sSrcSlaveId, sWorkOrderControlId), (sWorkOrderProcessTbId), and the standard (sId, sBrandsId, sSubsidiaryId) unique. A commented mftproductslave block is left disabled with a TODO noting existing duplicates block the unique constraint.
Invocation: Status: appears orphaned at runtime. No form-master, gdsmodule hook, other-routine caller, or Java caller — only the install script xly-src/script/index/Sp_changeIndex.sql. Operates as a manually-invoked DBA helper run during upgrade rollouts; flag any automated scheduler that calls it.