Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 34 additions & 12 deletions Migration-Scripts/Legacy-IIS/DeleteIISStores.sql
Original file line number Diff line number Diff line change
Expand Up @@ -27,41 +27,59 @@ BEGIN TRY
INNER JOIN [cms_agents].[CertStores] [cs] ON [csii].[CertStoreId] = [cs].[Id]
INNER JOIN @IISStoreTypeIds [sti] ON [sti].[Id] = [cs].[CertStoreType];

DELETE [csmj]
FROM [cms_agents].[CertStoreManagementJobs] [csmj]
INNER JOIN [cms_agents].[AgentSchedules] [as] ON [csmj].[JobId] = [as].[JobId]
INNER JOIN @IISJobTypeIds [jti] ON [jti].[Id] = [as].[JobTypeId];

DELETE [csms]
FROM [dbo].[CertStoreManagementStaging] [csms]
INNER JOIN [cms_agents].[CertStores] [cs] ON [csms].[CertStoreId] = [cs].[Id]
INNER JOIN @IISStoreTypeIds [sti] ON [sti].[Id] = [cs].[CertStoreType];

DELETE [csmjs]
FROM [cms_agents].[CertStoreManagementJobStaging] [csmjs]
INNER JOIN [cms_agents].[CertStores] [cs] ON [csmjs].[StoreId] = [cs].[Id]
INNER JOIN @IISStoreTypeIds [st] ON [st].[Id] = [cs].[CertStoreType];

DELETE [csrj]
FROM [cms_agents].[CertStoreReenrollmentJobs] [csrj]
INNER JOIN [cms_agents].[AgentSchedules] [as] ON [csrj].[JobId] = [as].[JobId]
INNER JOIN @IISJobTypeIds [jti] ON [jti].[Id] = [as].[JobTypeId];

DELETE [cs]
FROM [cms_agents].[CertStores] [cs]
INNER JOIN @IISStoreTypeIds [st] ON [cs].[CertStoreType] = [st].[Id];

DELETE [csc]
FROM [cms_agents].[CertStoreContainers] [csc]
INNER JOIN @IISStoreTypeIds [st] ON [csc].[CertStoreType] = [st].[Id];
INNER JOIN @IISStoreTypeIds [st] ON [csc].[CertStoreType] = [st].[Id];

DELETE [csij]
FROM [cms_agents].[CertStoreInventoryJobs] [csij]
INNER JOIN [cms_agents].[AgentSchedules] [as] ON [csij].[JobId] = [as].[JobId]
INNER JOIN @IISJobTypeIds [jti] ON [jti].[Id] = [as].[JobTypeId];

DELETE [csrj]
FROM [cms_agents].[CertStoreReenrollmentJobs] [csrj]
INNER JOIN [cms_agents].[AgentSchedules] [as] ON [csrj].[JobId] = [as].[JobId]
INNER JOIN @IISJobTypeIds [jti] ON [jti].[Id] = [as].[JobTypeId];

DELETE [csmj]
FROM [cms_agents].[CertStoreManagementJobs] [csmj]
INNER JOIN [cms_agents].[AgentSchedules] [as] ON [csmj].[JobId] = [as].[JobId]
INNER JOIN @IISJobTypeIds [jti] ON [jti].[Id] = [as].[JobTypeId];

DELETE [as]
FROM [cms_agents].[AgentSchedules] [as]
INNER JOIN @IISJobTypeIds [jt] ON [jt].[Id] = [as].[JobTypeId];

DELETE [cstp]
FROM [cms_agents].[CertStoreTypeProperties] [cstp]
INNER JOIN @IISStoreTypeIds [st] ON [cstp].[StoreTypeId] = [st].[id];
INNER JOIN @IISStoreTypeIds [st] ON [cstp].[StoreTypeId] = [st].[Id];

DELETE [cstep]
FROM [cms_agents].[CertStoreTypeEntryParameters] [cstep]
INNER JOIN @IISStoreTypeIds [st] ON [cstep].[StoreTypeId] = [st].[Id];

DELETE [cst]
FROM [cms_agents].[CertStoreTypes] [cst]
INNER JOIN @IISStoreTypeIds [st] ON [cst].[StoreType] = [st].[id];

DELETE [arg]
FROM [cms_agents].[AgentRegistrationGroups] [arg]
INNER JOIN @IISJobTypeIds [jt] ON [arg].[JobTypeId] = [jt].[Id];

DELETE [ars]
FROM [cms_agents].[AgentRegistrationSettings] [ars]
INNER JOIN @IISJobTypeIds [jt] ON [ars].[JobTypeId] = [jt].[Id];
Expand All @@ -70,6 +88,10 @@ BEGIN TRY
FROM [cms_agents].[AgentCapabilities] [ac]
INNER JOIN @IISJobTypeIds [jt] ON [ac].[JobTypeId] = [jt].[Id];

DELETE [jtf]
FROM [cms_agents].[JobTypeFields] [jtf]
INNER JOIN @IISJobTypeIds [jt] ON [jtf].[JobTypeId] = [jt].[Id];

DELETE [jt]
FROM [cms_agents].[JobTypes] [jt]
INNER JOIN @IISJobTypeIds [jti] ON [jt].[Id] = [jti].[Id];
Expand Down