File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,10 @@ const {
3333 manageTransaction
3434} = require ( './helpers' )
3535
36+ const {
37+ isUpdatable
38+ } = require ( '../schema/utils' )
39+
3640const {
3741 DbVersionTypeError,
3842 SqlCorrectnessError,
@@ -511,6 +515,7 @@ class BetterSqliteDAO extends DAO {
511515 }
512516
513517 await this . _beginTrans ( async ( ) => {
518+ const methodCollMap = [ ...this . _getMethodCollMap ( ) ]
514519 const tableNames = await this . getTablesNames ( { doNotQueueQuery } )
515520 const filteredTempTableNames = tableNames . filter ( ( name ) => (
516521 name . includes ( namePrefix )
@@ -524,11 +529,19 @@ class BetterSqliteDAO extends DAO {
524529 continue
525530 }
526531
532+ const syncSchema = methodCollMap . find ( ( [ key , schema ] ) => (
533+ schema . getModelField ( 'NAME' ) === name
534+ ) ) ?. [ 1 ]
535+ const type = syncSchema ?. getModelField ( 'TYPE' ) ?? ''
536+
527537 const projection = model . getModelFieldKeys ( )
528538 . filter ( ( fieldName ) => fieldName !== Model . UID_FIELD_NAME )
529539 . join ( ', ' )
530540
531- if ( isStrictEqual ) {
541+ if (
542+ isStrictEqual ||
543+ isUpdatable ( type )
544+ ) {
532545 await this . query ( {
533546 action : MAIN_DB_WORKER_ACTIONS . RUN ,
534547 sql : `DELETE FROM ${ name } `
You can’t perform that action at this time.
0 commit comments