@@ -105,7 +105,7 @@ const mapColumnCheckConstraintsToChangeHistory = collection => {
105105 * */
106106const getDropColumnCheckConstraintScriptDtos = ( constraintHistory , fullTableName ) => {
107107 return constraintHistory
108- . filter ( historyEntry => historyEntry . old && ! historyEntry . new )
108+ . filter ( historyEntry => historyEntry . old ?. expression && ! historyEntry . new ?. expression )
109109 . map ( historyEntry => {
110110 const wrappedConstraintName = getConstraintName (
111111 historyEntry . old . name ,
@@ -124,7 +124,7 @@ const getDropColumnCheckConstraintScriptDtos = (constraintHistory, fullTableName
124124 * */
125125const getAddColumnCheckConstraintScriptDtos = ( constraintHistory , fullTableName ) => {
126126 return constraintHistory
127- . filter ( historyEntry => historyEntry . new && ! historyEntry . old )
127+ . filter ( historyEntry => historyEntry . new ?. expression && ! historyEntry . old ?. expression )
128128 . map ( historyEntry => {
129129 const { name, expression, noInherit } = historyEntry . new ;
130130 const constraintName = getConstraintName ( name , historyEntry . columnName , fullTableName ) ;
@@ -142,7 +142,7 @@ const getAddColumnCheckConstraintScriptDtos = (constraintHistory, fullTableName)
142142const getUpdateColumnCheckConstraintScriptDtos = ( constraintHistory , fullTableName ) => {
143143 return constraintHistory
144144 . filter ( historyEntry => {
145- if ( historyEntry . old && historyEntry . new ) {
145+ if ( historyEntry . old ?. expression && historyEntry . new ?. expression ) {
146146 const oldExpression = historyEntry . old . expression ;
147147 const newExpression = historyEntry . new . expression ;
148148 const oldNoInherit = historyEntry . old . noInherit ;
0 commit comments