-- Migration number: 0006 2024-07-01T08:24:03.736Z CREATE TABLE IF NOT EXISTS userAuditLog ( changeId INTEGER PRIMARY KEY, userId INTEGER NOT NULL, newName TEXT NULL, newUrl TEXT NULL, timestamp INTEGER NOT NULL ) STRICT; CREATE INDEX IF NOT EXISTS userUpdateTimestamp ON userAuditLog (userId, timestamp DESC); CREATE TABLE IF NOT EXISTS setAuditLog ( changeId INTEGER PRIMARY KEY, userId INTEGER NOT NULL, setId INTEGER NOT NULL, newName TEXT NULL, newDescription TEXT NULL, updateType INTEGER NOT NULL, timestamp INTEGER NOT NULL ) STRICT; CREATE INDEX IF NOT EXISTS setUpdateTimestamp ON setAuditLog (setId, timestamp DESC); CREATE INDEX IF NOT EXISTS setUpdateTimestampByUser ON setAuditLog (userId, timestamp DESC); CREATE TABLE IF NOT EXISTS resultAuditLog ( changeId INTEGER PRIMARY KEY, mappingId INTEGER NOT NULL, userId INTEGER NOT NULL, setId INTEGER NOT NULL, newResultId INTEGER NULL, updateType INTEGER NOT NULL, timestamp INTEGER NOT NULL ) STRICT; CREATE INDEX IF NOT EXISTS resultUpdateTimestampByMapping ON resultAuditLog (mappingId, timestamp DESC); CREATE INDEX IF NOT EXISTS resultUpdateTimestampBySet ON resultAuditLog (setId, timestamp DESC); CREATE INDEX IF NOT EXISTS resultUpdateTimestampByUser ON resultAuditLog (userId, timestamp DESC);