qb
qb copied to clipboard
computed columns break on sql server
The following code yields this error on SQL Server: Incorrect syntax near the keyword 'AS' - ALTER TABLE [rpt].[afterTaxBase] ALTER COLUMN [taxAlpha] AS ((portAfterTax-benchAfterTax)-(portPreTax-benchPreTax)) PERSISTED
schema.alter( "rpt.afterTaxBase", function( table ) {
table.addColumn( table.smallinteger( "benchmarkID" ).nullable() );
table.addColumn( table.tinyinteger( "bmChange" ).nullable() );
table.addColumn( table.date( "inceptionDate" ).nullable() );
table.modifyColumn( 'taxAlpha', table.float( "taxAlpha" ).storedAs( "(portAfterTax-benchAfterTax)-(portPreTax-benchPreTax)" ) );
} );