How can we help you today? How can we help you today?
ChrisGStevens

Activity overview

Latest activity by ChrisGStevens

I am able to Sync-DlmDatabaseSchema for a single schema from my repository using the Filters. The first schema contains "Shared" objects which are used by other schemas but not all. I went ahead and created a second filter for a different schema, "Customer", which has dependency on the first schema. I have successfully created 2 power shell scripts and this seems to work great.  So right now besides the .nuget  containing all of the objects I thought this was going to work... My new issue in my attempt is Migrations. Once I added a new Mirgration to my Shared schema I was no longer able to deploy the Customer shema. Basically my migration does this.                /* Add new Column */                ALTER TABLE Shared.ADRole ADD                NeedMirgrationForThisField varchar(50) NULL                GO                /* Populate your field */                UPDATE ad SET NeedMirgrationForThisField = 'This is Initial'                FROM Shared.ADRole ad                 GO I can't get passed the validation when I am running for the Customer schema; it is comparing the Shared schema as I get the following error. Invoke-DlmDatabaseSchemaValidation : Schema validation failed: 2 batches failed. The first error is 'Column names in each table must be unique. Column name 'NeedMirgrationForThisField' in table 'Shared.ADRole' is specified more than once.'. I can go back remove the field and remove my migrations history for the Shared sync and rerun Shared.ps1. It runs fine as well as the next run with no change.   But some reason once I added the migrations the Customer.ps1 which only looks at customer schema based on the Filter is looking at the Shared objects and those objects migrations. / comments
I am able to Sync-DlmDatabaseSchema for a single schema from my repository using the Filters.The first schema contains "Shared" objects which are used by other schemas but not all.I went ahead and ...
0 votes
Hi Sergio! Thanks for getting back with me. When I do the following the Invoke-DlmDatabaseSchemaValidation will use my Filter and CompareOptions.                    $validatedSchema = Invoke-DlmDatabaseSchemaValidation $myScriptPath -Filter $myFilterFile -SQLCompareOptions $compareOption But the output of the $validatedSchema includes ALL objects. Am I missing a flag or something? I would expect it to only contain the objects which are not filtered out.  In my case a single schema. I found that I have to use the Filter and CompareOptions when creating the Documentation even though I am only passing it the $validatedSchema results. If not it will use the whole repo and try to document it.                   $documentation = New-DlmDatabaseDocumentation $validatedSchema -FilterPath $myFilterFile -SQLCompareOptions $compareOption I did notice that if I don't include the filter when creating the documentation I get an error because of a synonym pointing to a linked server. But even though I received this error it still creating the documentation based on the what was validated. So it is almost like, yes it is correct that the New-DlmDatabaseDocumentation uses the $validatedSchema when creating the documentation but if I don't filter this cmdlet wants to validate objects which should not be checked or whatever is happening under the covers.    Now using the New-DlmDatabasePackage.  It doesn't allow me to use the Filter or CompareOptions so I get all of the repo and then the filtered documentation that doesn't match.                  $databasePackage = New-DlmDatabasePackage $validatedSchema -PackageId "MyDatabaseName" -PackageVersion "2.11" -Documentation $documentation                   Export-DlmDatabasePackage $databasePackage -Path "C:\Dev\Packages"  So right now I don't see a way for me to create a package based on what has been validated or filtered down to. I have tried the following using the Package and ValidateSchema results.  When I sync I can use the ValidateSchema and unless I use the filter I will get objects that should have been filtered out.                   Sync-DlmDatabaseSchema -Source $validatedSchema -Target $myTempDB #-FilterPath $myFilterFile -SQLCompareOptions $compareOption  Thank you for the info for the Data.  I have been working on a way to do that using the SQLDataCompare.exe.   But first I would love to get my nuget package created with the objects that I want. Basically our apps are separated by schema and I want to be able to create an automated single schema and dependencies.  / comments
Hi Sergio!Thanks for getting back with me.When I do the following the Invoke-DlmDatabaseSchemaValidation will use my Filter and CompareOptions.                   $validatedSchema = Invoke-DlmDataba...
0 votes
Differences between Cmdlets
My goal is create specific objects and then deploy the static data.  I have a few different static data scenarios.I have a database with several different schemas. My goal is to start small with ju...
2 followers 4 comments 0 votes
Be sure to add your SQL Monitor Service Account to the MSDB Database and add it to the DatabaseMailUserRole. / comments
Be sure to add your SQL Monitor Service Account to the MSDB Database and add it to the DatabaseMailUserRole.
0 votes
[SQLCop].[test Tables without a primary key]
Need to handle the SQL Version differences. This is the perfect example. [SQLCop].[test Tables without a primary key] When reviewing the SQLCop failures I noticed that I had Database Users instead ...
2 followers 2 comments 0 votes
Right now I am using 13.0.2.5109. Taking the below script and doing the compare I am actually ending up with a change script does have any changes in it now; goes from BEGIN TRANSACTION and then the next batch is COMMIT TRANSACTION. Reviewing the differences in SQL Compare I can see that the LOGINs are different because of the qa vs dev and the Database User is the same. This is actually a little bit different than the original issue I had and trying to figure out what state I was in. Hopefully not Kansas [image] Here is what I have accomplished by doing it this way. When we create a new app I have a stored procedure which creates the LOGIN, DatabaseUser for all needs database and in each of the databases it creates the ROLE, SCHEMA and sets up the permissions for the securables within the schema. Then in the compare for the Role I only have a single DatabaseUser. When we deploy I have a script that updates the DatabaseUser with the correct enviornments login. -- DEV Instance -- CREATE SCRIPT IF NOT EXISTS (SELECT * FROM master.dbo.syslogins WHERE loginname = N'MyDomain\svc_devTest') CREATE LOGIN [MyDomain\svc_devTest] FROM WINDOWS GO IF NOT EXISTS(SELECT * FROM sys.database_principals WHERE name = N'Svc_Test') CREATE USER [Svc_Test] FOR LOGIN [MyDomain\svc_devTest] GO -- QA Instance -- CREATE SCRIPT IF NOT EXISTS (SELECT * FROM master.dbo.syslogins WHERE loginname = N'MyDomain\svc_qaTest') CREATE LOGIN [MyDomain\svc_qaTest] FROM WINDOWS GO IF NOT EXISTS(SELECT * FROM sys.database_principals WHERE name = N'Svc_Test') CREATE USER [Svc_Test] FOR LOGIN [MyDomain\svc_qaTest] GO / comments
Right now I am using 13.0.2.5109. Taking the below script and doing the compare I am actually ending up with a change script does have any changes in it now; goes from BEGIN TRANSACTION and then th...
0 votes
CREATE USER should have IF NOT EXISTS
The following code is generated when doing my compare and will generate an error since my user does exist.-- User IF NOT EXISTS (SELECT * FROM master.dbo.syslogins WHERE loginname = N'MyDomain\svc...
3 followers 3 comments 0 votes