Skip to content

Commit

Permalink
JobStats_60MIN partition switching fix
Browse files Browse the repository at this point in the history
Fix issue with partition switching for JobStats_60MIN.  The previous fix for this issue didn't resolve the problem for existing DBA Dash repository databases. #411
  • Loading branch information
DavidWiseman committed May 9, 2023
1 parent 01762f1 commit 21a70eb
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions DBADashDB/DBADashDB.sqlproj
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,9 @@
<Link>Properties\GlobalAssemblyInfo.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<PreDeploy Include="Script.PreDeployment1.sql" />
</ItemGroup>
<Target Name="SetDacVersionToAssemblyVersion" AfterTargets="CoreCompile">
<GetAssemblyIdentity AssemblyFiles="$(IntermediateTargetFullFileName)">
<Output TaskParameter="Assemblies" PropertyName="IntermediateTargetAssembly" />
Expand Down
19 changes: 19 additions & 0 deletions DBADashDB/Script.PreDeployment1.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/* Remove partitioning from Switch.JobStats_60MIN table. #411 */
IF EXISTS(
SELECT 1
FROM sys.partitions
WHERE object_id = OBJECT_ID('Switch.JobStats_60MIN')
AND index_id IN(0,1)
HAVING COUNT(*) > 1
)
BEGIN
PRINT 'Remove partitioning from Switch.JobStats_60MIN'
ALTER TABLE [Switch].[JobStats_60MIN] DROP CONSTRAINT [PK_JobStats_60MIN]
ALTER TABLE [Switch].[JobStats_60MIN] ADD CONSTRAINT [PK_JobStats_60MIN] PRIMARY KEY CLUSTERED
(
[InstanceID] ASC,
[job_id] ASC,
[step_id] ASC,
[RunDateTime] ASC
) ON [PRIMARY]
END

0 comments on commit 21a70eb

Please sign in to comment.