File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -645,7 +645,7 @@ export class SqlDriver implements Driver {
645645 [ tableName ]
646646 ) ;
647647
648- if ( ! tableExistsResult || tableExistsResult . length === 0 ) {
648+ if ( ! Array . isArray ( tableExistsResult ) || tableExistsResult . length === 0 ) {
649649 // If the table does not exist, there are no foreign keys to introspect.
650650 return foreignKeys ;
651651 }
@@ -708,10 +708,10 @@ export class SqlDriver implements Driver {
708708
709709 // Validate that the sanitized table name exists in the database before using it in PRAGMA
710710 const tablesResult = await this . knex . raw ( "SELECT name FROM sqlite_master WHERE type = 'table'" ) ;
711- const tableNames = tablesResult . map ( ( row : any ) => row . name ) ;
711+ const tableNames = Array . isArray ( tablesResult ) ? tablesResult . map ( ( row : any ) => row . name ) : [ ] ;
712712
713713 if ( ! tableNames . includes ( safeTableName ) ) {
714- console . warn ( 'Could not introspect primary keys for SQLite table: table does not exist after sanitization .' ) ;
714+ console . warn ( 'Could not introspect primary keys: table name contains invalid characters or table does not exist.' ) ;
715715 return primaryKeys ;
716716 }
717717
You can’t perform that action at this time.
0 commit comments