@@ -251,6 +251,42 @@ describe('Discover model generated columns', function() {
251
251
done ( ) ;
252
252
} ) ;
253
253
} ) ;
254
+ it ( 'should mark STORED column as generated' , function ( done ) {
255
+ db . discoverModelProperties ( 'testgen' , function ( err , models ) {
256
+ if ( err ) return done ( err ) ;
257
+ models . forEach ( function ( model ) {
258
+ assert ( model . tableName . toLowerCase ( ) === 'testgen' ) ;
259
+ if ( model . columnName === 'TOKEN' ) {
260
+ assert ( model . generated , 'STRONGLOOP.TESTGEN.TOKEN should be a generated (identity) column' ) ;
261
+ }
262
+ } ) ;
263
+ done ( ) ;
264
+ } ) ;
265
+ } ) ;
266
+ it ( 'should mark STORED column as generated' , function ( done ) {
267
+ db . discoverModelProperties ( 'testgen' , function ( err , models ) {
268
+ if ( err ) return done ( err ) ;
269
+ models . forEach ( function ( model ) {
270
+ assert ( model . tableName . toLowerCase ( ) === 'testgen' ) ;
271
+ if ( model . columnName === 'TOKEN' ) {
272
+ assert ( model . generated , 'STRONGLOOP.TESTGEN.TOKEN should be a generated (identity) column' ) ;
273
+ }
274
+ } ) ;
275
+ done ( ) ;
276
+ } ) ;
277
+ } ) ;
278
+ it ( 'should mark VIRTUAL column as generated' , function ( done ) {
279
+ db . discoverModelProperties ( 'testgen' , function ( err , models ) {
280
+ if ( err ) return done ( err ) ;
281
+ models . forEach ( function ( model ) {
282
+ assert ( model . tableName . toLowerCase ( ) === 'testgen' ) ;
283
+ if ( model . columnName === 'VIRTUAL_TOKEN' ) {
284
+ assert ( model . generated , 'STRONGLOOP.TESTGEN.VIRTUAL_TOKEN should be a generated (identity) column' ) ;
285
+ }
286
+ } ) ;
287
+ done ( ) ;
288
+ } ) ;
289
+ } ) ;
254
290
} ) ;
255
291
256
292
describe ( 'Discover LDL schema from a table' , function ( ) {
0 commit comments