@@ -14,7 +14,7 @@ import {
1414} from './action-utils' ;
1515import { consolidateEnums , syncEnums , syncRelation , syncTable , type Relation } from './pull' ;
1616import { providers as pullProviders } from './pull/provider' ;
17- import { getDatasource , getDbName , getRelationFieldsKey , getRelationFkName } from './pull/utils' ;
17+ import { getDatasource , getDbName , getRelationFieldsKey , getRelationFkName , isDatabaseManagedAttribute } from './pull/utils' ;
1818import type { DataSourceProviderType } from '@zenstackhq/schema' ;
1919import { CliError } from '../cli-error' ;
2020
@@ -461,12 +461,13 @@ async function runPull(options: PullOptions) {
461461 }
462462 return ;
463463 }
464+
464465 // Track deleted attributes (in original but not in new)
465466 originalField . attributes
466467 . filter (
467468 ( attr ) =>
468- ! f . attributes . find ( ( d ) => d . decl . $refText === attr . decl . $refText ) &&
469- ( [ '@relation' ] . includes ( attr . decl . $refText ) || attr . decl . $refText . startsWith ( '@db.' ) ) ,
469+ ! f . attributes . find ( ( d ) => d . decl . $refText === attr . decl . $refText ) &&
470+ isDatabaseManagedAttribute ( attr . decl . $refText ) ,
470471 )
471472 . forEach ( ( attr ) => {
472473 const field = attr . $container ;
@@ -482,7 +483,7 @@ async function runPull(options: PullOptions) {
482483 . filter (
483484 ( attr ) =>
484485 ! originalField . attributes . find ( ( d ) => d . decl . $refText === attr . decl . $refText ) &&
485- ( [ '@relation' ] . includes ( attr . decl . $refText ) || attr . decl . $refText . startsWith ( '@db.' ) ) ,
486+ isDatabaseManagedAttribute ( attr . decl . $refText ) ,
486487 )
487488 . forEach ( ( attr ) => {
488489 // attach the new attribute to the original field
0 commit comments