@@ -13,6 +13,7 @@ const {
13
13
getAddedIndexesScriptDtos,
14
14
getAdditionalDataForDdlProvider,
15
15
} = require ( './entityHelpers/indexesHelper' ) ;
16
+ const { getModifiedDefaultColumnValueScriptDtos } = require ( './columnHelpers/defaultValueHelper' ) ;
16
17
17
18
/**
18
19
* @return {(collection: AlterCollectionDto) => AlterScriptDto | undefined }
@@ -21,7 +22,7 @@ const getAddCollectionScriptDto =
21
22
( { app, dbVersion, modelDefinitions, internalDefinitions, externalDefinitions } ) =>
22
23
collection => {
23
24
const _ = app . require ( 'lodash' ) ;
24
- const { getEntityName } = require ( '../../utils/general' ) ( _ ) ;
25
+ const { getEntityName } = require ( '../../utils/general' ) ;
25
26
const { createColumnDefinitionBySchema } = require ( './createColumnDefinition' ) ( app ) ;
26
27
const ddlProvider = require ( '../../ddlProvider/ddlProvider' ) ( null , null , app ) ;
27
28
const { getDefinitionByReference } = app . require ( '@hackolade/ddl-fe-utils' ) ;
@@ -76,7 +77,7 @@ const getAddCollectionScriptDto =
76
77
const getDeleteCollectionScriptDto = app => collection => {
77
78
const _ = app . require ( 'lodash' ) ;
78
79
const ddlProvider = require ( '../../ddlProvider/ddlProvider' ) ( null , null , app ) ;
79
- const { getFullTableName } = require ( '../../utils/general' ) ( _ ) ;
80
+ const { getFullTableName } = require ( '../../utils/general' ) ;
80
81
81
82
const fullName = getFullTableName ( collection ) ;
82
83
const script = ddlProvider . dropTable ( fullName ) ;
@@ -116,7 +117,7 @@ const getAddColumnsByConditionScriptDtos =
116
117
( { app, dbVersion, modelDefinitions, internalDefinitions, externalDefinitions } ) =>
117
118
( collection , predicate ) => {
118
119
const _ = app . require ( 'lodash' ) ;
119
- const { getEntityName, getNamePrefixedWithSchemaName } = require ( '../../utils/general' ) ( _ ) ;
120
+ const { getEntityName, getNamePrefixedWithSchemaName } = require ( '../../utils/general' ) ;
120
121
const { createColumnDefinitionBySchema } = require ( './createColumnDefinition' ) ( app ) ;
121
122
const ddlProvider = require ( '../../ddlProvider/ddlProvider' ) ( null , null , app ) ;
122
123
const { getDefinitionByReference } = app . require ( '@hackolade/ddl-fe-utils' ) ;
@@ -204,7 +205,7 @@ const getAddColumnScriptDtos =
204
205
const getDeleteColumnsByConditionScriptDtos = app => ( collection , predicate ) => {
205
206
const _ = app . require ( 'lodash' ) ;
206
207
const ddlProvider = require ( '../../ddlProvider/ddlProvider' ) ( null , null , app ) ;
207
- const { getEntityName, getNamePrefixedWithSchemaName, wrapInQuotes } = require ( '../../utils/general' ) ( _ ) ;
208
+ const { getEntityName, getNamePrefixedWithSchemaName, wrapInQuotes } = require ( '../../utils/general' ) ;
208
209
209
210
const collectionSchema = { ...collection , ...( _ . omit ( collection ?. role , 'properties' ) || { } ) } ;
210
211
const tableName = getEntityName ( collectionSchema ) ;
@@ -294,12 +295,17 @@ const getModifyColumnScriptDtos =
294
295
const updateTypeScriptDtos = getUpdateTypesScriptDtos ( _ , ddlProvider ) ( collection ) ;
295
296
const modifyNotNullScriptDtos = getModifyNonNullColumnsScriptDtos ( _ , ddlProvider ) ( collection ) ;
296
297
const modifyCommentScriptDtos = getModifiedCommentOnColumnScriptDtos ( _ , ddlProvider ) ( collection ) ;
298
+ const modifyDefaultColumnValueScriptDtos = getModifiedDefaultColumnValueScriptDtos ( {
299
+ ddlProvider,
300
+ collection,
301
+ } ) ;
297
302
298
303
return [
299
304
...renameColumnScriptDtos ,
300
305
...updateTypeScriptDtos ,
301
306
...modifyNotNullScriptDtos ,
302
307
...modifyCommentScriptDtos ,
308
+ ...modifyDefaultColumnValueScriptDtos ,
303
309
] . filter ( Boolean ) ;
304
310
} ;
305
311
0 commit comments