@@ -143,7 +143,7 @@ module.exports = (baseProvider, options, app) => {
143143 const emptyLineSeparator = '\n\n' ;
144144 const statementTerminator = ';' ;
145145
146- const annotations = getAnnotationsString ( prepareName ) ( schemaAnnotations ) ;
146+ const annotations = getAnnotationsString ( prepareName , dbVersion ) ( schemaAnnotations ) ;
147147 const finalAnnotationsClause = annotations ? ' ' + annotations : '' ;
148148 const preparedSchemaName = prepareName ( schemaName ) ;
149149 const usingTryCatchWrapper = shouldUseTryCatchIfNotExistsWrapper ( dbVersion ) ;
@@ -226,8 +226,9 @@ module.exports = (baseProvider, options, app) => {
226226 } ,
227227
228228 convertColumnDefinition ( columnDefinition , template = templates . columnDefinition ) {
229- const type = replaceTypeByVersion ( columnDefinition . type , columnDefinition . dbVersion ) ;
230- const annotations = getAnnotationsString ( prepareName ) ( columnDefinition . columnAnnotations ) ;
229+ const dbVersion = columnDefinition ?. dbVersion ;
230+ const type = replaceTypeByVersion ( columnDefinition . type , dbVersion ) ;
231+ const annotations = getAnnotationsString ( prepareName , dbVersion ) ( columnDefinition . columnAnnotations ) ;
231232 const finalAnnotationsClause = annotations ? ' ' + annotations : '' ;
232233
233234 return commentIfDeactivated (
@@ -484,6 +485,7 @@ module.exports = (baseProvider, options, app) => {
484485 selectStatement,
485486 tableProperties,
486487 tableAnnotations,
488+ dbVersion,
487489 } ) ,
488490 } ) ;
489491 if ( usingTryCatchWrapper ) {
@@ -514,7 +516,7 @@ module.exports = (baseProvider, options, app) => {
514516 const dbVersion = options . dbVersion || '' ;
515517 const usingTryCatchWrapper = shouldUseTryCatchIfNotExistsWrapper ( dbVersion ) ;
516518
517- const annotations = getAnnotationsString ( prepareName ) ( index . indexAnnotations ) ;
519+ const annotations = getAnnotationsString ( prepareName , dbVersion ) ( index . indexAnnotations ) ;
518520 const finalAnnotationsClause = annotations ? ' ' + annotations : '' ;
519521
520522 const shouldInsertIfNotExistsStatement = index . ifNotExist && ! usingTryCatchWrapper ;
@@ -668,7 +670,7 @@ module.exports = (baseProvider, options, app) => {
668670 const dbVersion = _ . get ( viewData , 'modelInfo.dbVersion' , '' ) ;
669671 const usingTryCatchWrapper = shouldUseTryCatchIfNotExistsWrapper ( dbVersion ) ;
670672
671- const annotations = getAnnotationsString ( prepareName ) ( viewData . viewAnnotations ) ;
673+ const annotations = getAnnotationsString ( prepareName , dbVersion ) ( viewData . viewAnnotations ) ;
672674
673675 let createViewDdl = assignTemplates ( templates . createView , {
674676 name : viewName ,
0 commit comments