varigence / BimlPit

Public Issue Tracker for all Varigence Biml products
6 stars 0 forks source link

GetDatabaseSchema GetDropAndCreateDDL Genenerating Incorrect Clustering Type #120

Open TravisKale opened 5 years ago

TravisKale commented 5 years ago

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ x] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead go to https://varigence.com/Forums?forumName=Biml or email support@varigence.com
[ ] Other... Please describe:

Current behavior

For all tables in my database, GetDropAndCreateDdl is generating incorrect clustering types for the primary key, the tables in the database are defined as clustered, the BIML generated code defines the key as nonclustered.

var destTableResults = targetConnection.GetDatabaseSchema(); var destTable = destTableResults.TableNodes.First(); var inccorectCreateTableSql= destTable.GetDropAndCreateDdl();

Table Def in SQL:

CREATE TABLE [bi].[HierachySites]( [Code] [UNIQUEIDENTIFIER] NOT NULL, [Name] VARCHAR NOT NULL, [EnterDateTime] [SMALLDATETIME] NOT NULL, CONSTRAINT [PK_HierachySites] PRIMARY KEY CLUSTERED ( [Code] ASC )WITH (STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY]

GetDropAndCreateDdl generated code for same table:

CREATE TABLE [bi].[HierachySites] ( -- Columns Definition [Code] uniqueidentifier NOT NULL , [Name] varchar(21) NOT NULL , [EnterDateTime] smalldatetime NOT NULL

-- Constraints ,CONSTRAINT [PK_HierachySites] PRIMARY KEY NONCLUSTERED ( [Code] Asc) WITH(PAD_INDEX = OFF,IGNORE_DUP_KEY = OFF) ON "default"

) ON "default" WITH (DATA_COMPRESSION = NONE)

Expected behavior

For the clustering type generated by GetDatabaseSchema().TableNodes.ElementAt(x).GetDropAndCreateDdl to match the source table clustering type.

Minimal reproduction of the problem with instructions

var destTableResults = targetConnection.GetDatabaseSchema(); var destTable = destTableResults.TableNodes.First(); var inccorectCreateTableSql= destTable.GetDropAndCreateDdl();

What is the motivation / use case for changing the behavior?

When building my staging environment I do not want to drop and create the tables if the definition is the same. When I compare the DropAndCreateDdl statement that is generated from my in memory model where I manually code the clustering type, it does not equal the DropAndCreateDdl statment of the GetDatabaseSchema generated model because of the incorrect clustering definition. The same table was created using the in memory model GetDropAndCreateDdl.

Environment


BimlExpress version: 5.0.64108.0

5.0.64108.0

Visual Studio Version:

- [ ] 2005
- [ ] 2008
- [ ] 2010
- [ ] 2012
- [ ] 2013
- [ ] 2015
- [ ] 2017
- [X ] 2019

Target SSIS Version:

- [ ] 2005
- [ ] 2008
- [ ] 2008 R2
- [ ] 2012
- [ ] 2014
- [X ] 2016
- [ ] 2017

Others:

Database: Azure SQL DB.  
OS: Windows 10.