checkpoint ISAC registries and system monitoring
This commit is contained in:
@@ -619,6 +619,31 @@ for (const [name, definition] of [
|
||||
await database.exec(`ALTER TABLE stat_attributes ADD COLUMN ${name} ${definition}`);
|
||||
}
|
||||
}
|
||||
const nameOnlyAttributeIndex = await (await database.prepare(
|
||||
"SELECT 1 AS present FROM sqlite_master WHERE type='index' AND name='stat_attributes_name_nocase_idx'"
|
||||
)).get();
|
||||
if (nameOnlyAttributeIndex) {
|
||||
console.log('Allowing Attribute names to repeat when their units differ.');
|
||||
await database.exec('DROP INDEX stat_attributes_name_nocase_idx');
|
||||
}
|
||||
for (const [previousName, currentName] of [
|
||||
['Engineering %', 'Engineering'],
|
||||
['Firepower %', 'Firepower'],
|
||||
['Toughness %', 'Toughness'],
|
||||
['Weapon Damage %', 'Weapon Damage']
|
||||
]) {
|
||||
const previous = await (await database.prepare(
|
||||
'SELECT id FROM stat_attributes WHERE name=? COLLATE NOCASE AND unit=?'
|
||||
)).get(previousName, '%');
|
||||
const current = await (await database.prepare(
|
||||
'SELECT id FROM stat_attributes WHERE name=? COLLATE NOCASE AND unit=?'
|
||||
)).get(currentName, '%');
|
||||
if (previous && !current) {
|
||||
await (await database.prepare('UPDATE stat_attributes SET name=?,updated_at=? WHERE id=?'))
|
||||
.run(currentName, new Date().toISOString(), previous.id);
|
||||
}
|
||||
}
|
||||
await database.exec('CREATE UNIQUE INDEX IF NOT EXISTS stat_attributes_name_unit_nocase_idx ON stat_attributes(name COLLATE NOCASE,unit)');
|
||||
|
||||
const talentColumns = await (await database.prepare("PRAGMA table_info('talents')")).all();
|
||||
for (const [name, definition] of [
|
||||
|
||||
Reference in New Issue
Block a user