@ -288,8 +288,10 @@ async function validateMigrationApplication<T>(
` SELECT name FROM sqlite_master WHERE type='table' AND name='active_identity' ` ,
) ;
const hasActiveIdentityTable =
( activeIdentityResult as unknown as { values : unknown [ ] [ ] } ) ? . values ? . length > 0 ||
( Array . isArray ( activeIdentityResult ) && activeIdentityResult . length > 0 ) ;
( activeIdentityResult as unknown as { values : unknown [ ] [ ] } ) ? . values
? . length > 0 ||
( Array . isArray ( activeIdentityResult ) &&
activeIdentityResult . length > 0 ) ;
if ( ! hasActiveIdentityTable ) {
validation . isValid = false ;
@ -298,17 +300,23 @@ async function validateMigrationApplication<T>(
// Check that active_identity has the expected structure
try {
await sqlQuery ( ` SELECT id, activeDid, lastUpdated FROM active_identity LIMIT 1 ` ) ;
await sqlQuery (
` SELECT id, activeDid, lastUpdated FROM active_identity LIMIT 1 ` ,
) ;
validation . hasExpectedColumns = true ;
} catch ( error ) {
validation . isValid = false ;
validation . errors . push ( ` active_identity table missing expected columns ` ) ;
validation . errors . push (
` active_identity table missing expected columns ` ,
) ;
}
validation . tableExists = hasActiveIdentityTable ;
} catch ( error ) {
validation . isValid = false ;
validation . errors . push ( ` Validation error for active_did_separation: ${ error } ` ) ;
validation . errors . push (
` Validation error for active_did_separation: ${ error } ` ,
) ;
logger . error (
` ❌ [Migration-Validation] Validation failed for ${ migration . name } : ` ,
error ,
@ -385,8 +393,10 @@ async function isSchemaAlreadyPresent<T>(
` SELECT name FROM sqlite_master WHERE type='table' AND name='active_identity' ` ,
) ;
const hasActiveIdentityTable =
( activeIdentityResult as unknown as { values : unknown [ ] [ ] } ) ? . values ? . length > 0 ||
( Array . isArray ( activeIdentityResult ) && activeIdentityResult . length > 0 ) ;
( activeIdentityResult as unknown as { values : unknown [ ] [ ] } ) ? . values
? . length > 0 ||
( Array . isArray ( activeIdentityResult ) &&
activeIdentityResult . length > 0 ) ;
if ( ! hasActiveIdentityTable ) {
return false ;
@ -394,7 +404,9 @@ async function isSchemaAlreadyPresent<T>(
// Check that active_identity has the expected structure
try {
await sqlQuery ( ` SELECT id, activeDid, lastUpdated FROM active_identity LIMIT 1 ` ) ;
await sqlQuery (
` SELECT id, activeDid, lastUpdated FROM active_identity LIMIT 1 ` ,
) ;
return true ;
} catch ( error ) {
return false ;