salix/db/versions/.archive/10631-yellowBamboo/00-firstScript.sql

19 lines
631 B
MySQL
Raw Permalink Normal View History

ALTER TABLE account.roleLog
MODIFY COLUMN changedModel enum('Role', 'RoleInherit')
CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT 'Role' NOT NULL;
UPDATE account.roleLog SET changedModel = 'RoleInherit'
WHERE changedModel = '';
UPDATE account.roleLog
SET oldInstance = JSON_REMOVE(oldInstance, '$.modified'),
newInstance = JSON_REMOVE(newInstance, '$.modified')
WHERE changedModel = 'Role'
AND (JSON_VALUE(oldInstance, '$.modified') IS NOT NULL
OR JSON_VALUE(newInstance, '$.modified') IS NOT NULL);
DELETE FROM account.roleLog
WHERE oldInstance = '{}'
AND newInstance = '{}'
AND description IS NULL;