Name

sn_cmdb_ci_class.OTAssetsMigrationUtils

Description

No description available

Script

var OTAssetsMigrationUtils = Class.create();
OTAssetsMigrationUtils.prototype = {
  MIGRATION_MAP: {
  	'cmdb_ci_manufacturing': 'cmdb_ci_ot',
  	'cmdb_ci_plc': 'cmdb_ci_ot_plc',
  	'cmdb_ci_hmi': 'cmdb_ci_ot_hmi'
  },
  
  initialize: function() {
  },

  migrateRecords: function() {
  	for (var sourceTable in this.MIGRATION_MAP) {
  		var targetTable = this.MIGRATION_MAP[sourceTable];
  		var record = new GlideRecord(sourceTable);
  		record.addQuery('sys_class_name', sourceTable);
  		record.query();
  		var count = record.getRowCount();
  		record.setValue('sys_class_name', targetTable);
  		record.updateMultiple();
  		gs.info('Migrated ' + count + ' record(s) from ' +  sourceTable + ' to ' + targetTable);
  	}
  },
  
  type: 'OTAssetsMigrationUtils'
};

Sys ID

ab11d428c39520108ce867340440dd1c

Offical Documentation

Official Docs: