Refactor code structure for improved readability and maintainability
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,142 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Microsoft.SelfService.Portal.Core.API.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class SyncEnvironmentStageAndHostingType : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "TenantId",
|
||||
table: "Environments",
|
||||
type: "nvarchar(max)",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "nvarchar(max)",
|
||||
oldNullable: true)
|
||||
.Annotation("Relational:ColumnOrder", 5)
|
||||
.OldAnnotation("Relational:ColumnOrder", 4);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "SubscriptionId",
|
||||
table: "Environments",
|
||||
type: "nvarchar(max)",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "nvarchar(max)",
|
||||
oldNullable: true)
|
||||
.Annotation("Relational:ColumnOrder", 6)
|
||||
.OldAnnotation("Relational:ColumnOrder", 5);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "ProviderType",
|
||||
table: "Environments",
|
||||
type: "nvarchar(max)",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "nvarchar(max)",
|
||||
oldNullable: true)
|
||||
.Annotation("Relational:ColumnOrder", 4)
|
||||
.OldAnnotation("Relational:ColumnOrder", 3);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "MetadataJson",
|
||||
table: "Environments",
|
||||
type: "nvarchar(max)",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "nvarchar(max)",
|
||||
oldNullable: true)
|
||||
.Annotation("Relational:ColumnOrder", 7)
|
||||
.OldAnnotation("Relational:ColumnOrder", 6);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "HostingType",
|
||||
table: "Environments",
|
||||
type: "nvarchar(max)",
|
||||
nullable: false,
|
||||
defaultValue: "OnPrem")
|
||||
.Annotation("Relational:ColumnOrder", 3);
|
||||
|
||||
migrationBuilder.Sql(@"
|
||||
UPDATE [Environments]
|
||||
SET [HostingType] = CASE
|
||||
WHEN [EnvironmentType] IN ('OnPrem','AzureTenant','M365Tenant') THEN [EnvironmentType]
|
||||
ELSE 'OnPrem'
|
||||
END
|
||||
");
|
||||
|
||||
migrationBuilder.Sql(@"
|
||||
UPDATE [Environments]
|
||||
SET [EnvironmentType] = CASE
|
||||
WHEN [EnvironmentType] IN ('Development','Test','QA','Production') THEN [EnvironmentType]
|
||||
ELSE 'Test'
|
||||
END
|
||||
");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.Sql(@"
|
||||
UPDATE [Environments]
|
||||
SET [EnvironmentType] = CASE
|
||||
WHEN [HostingType] IN ('OnPrem','AzureTenant','M365Tenant') THEN [HostingType]
|
||||
ELSE 'OnPrem'
|
||||
END
|
||||
");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "HostingType",
|
||||
table: "Environments");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "TenantId",
|
||||
table: "Environments",
|
||||
type: "nvarchar(max)",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "nvarchar(max)",
|
||||
oldNullable: true)
|
||||
.Annotation("Relational:ColumnOrder", 4)
|
||||
.OldAnnotation("Relational:ColumnOrder", 5);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "SubscriptionId",
|
||||
table: "Environments",
|
||||
type: "nvarchar(max)",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "nvarchar(max)",
|
||||
oldNullable: true)
|
||||
.Annotation("Relational:ColumnOrder", 5)
|
||||
.OldAnnotation("Relational:ColumnOrder", 6);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "ProviderType",
|
||||
table: "Environments",
|
||||
type: "nvarchar(max)",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "nvarchar(max)",
|
||||
oldNullable: true)
|
||||
.Annotation("Relational:ColumnOrder", 3)
|
||||
.OldAnnotation("Relational:ColumnOrder", 4);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "MetadataJson",
|
||||
table: "Environments",
|
||||
type: "nvarchar(max)",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "nvarchar(max)",
|
||||
oldNullable: true)
|
||||
.Annotation("Relational:ColumnOrder", 6)
|
||||
.OldAnnotation("Relational:ColumnOrder", 7);
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,22 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Microsoft.SelfService.Portal.Core.API.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class LinkDeploymentBatchToDeploymentRule : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
+1599
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,128 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Microsoft.SelfService.Portal.Core.API.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddTemplateVersions : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "DeploymentRuleId",
|
||||
table: "DeploymentBatches",
|
||||
type: "uniqueidentifier",
|
||||
nullable: true)
|
||||
.Annotation("Relational:ColumnOrder", 3);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TemplateVersions",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false, defaultValueSql: "NEWID()"),
|
||||
TemplateId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
Version = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
|
||||
JsonData = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
JsonHash = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
|
||||
SchemaVersion = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: false),
|
||||
IsPublished = table.Column<bool>(type: "bit", nullable: false),
|
||||
PublishedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||
PublishedBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
Modified = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETDATE()"),
|
||||
ModifiedBy = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Created = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETDATE()"),
|
||||
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TemplateVersions", x => x.Id);
|
||||
table.CheckConstraint("CK_TemplateVersions_JsonData_IsJson", "ISJSON([JsonData]) = 1");
|
||||
table.ForeignKey(
|
||||
name: "FK_TemplateVersions_Templates_TemplateId",
|
||||
column: x => x.TemplateId,
|
||||
principalTable: "Templates",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.Sql("""
|
||||
INSERT INTO [TemplateVersions]
|
||||
([Id], [TemplateId], [Version], [JsonData], [JsonHash], [SchemaVersion], [IsPublished], [PublishedAt], [PublishedBy], [Modified], [ModifiedBy], [Created], [CreatedBy])
|
||||
SELECT
|
||||
NEWID(),
|
||||
[Id],
|
||||
CASE
|
||||
WHEN [Version] IS NULL OR LTRIM(RTRIM([Version])) = '' THEN '1.0.0'
|
||||
ELSE [Version]
|
||||
END,
|
||||
CASE
|
||||
WHEN ISJSON([JSONData]) = 1 THEN [JSONData]
|
||||
ELSE '{}'
|
||||
END,
|
||||
CONVERT(varchar(64), HASHBYTES('SHA2_256', CONVERT(varbinary(max), CASE WHEN ISJSON([JSONData]) = 1 THEN [JSONData] ELSE '{}' END)), 2),
|
||||
'1.0',
|
||||
1,
|
||||
SYSUTCDATETIME(),
|
||||
[CreatedBy],
|
||||
[Modified],
|
||||
[ModifiedBy],
|
||||
[Created],
|
||||
[CreatedBy]
|
||||
FROM [Templates]
|
||||
WHERE NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM [TemplateVersions]
|
||||
WHERE [TemplateVersions].[TemplateId] = [Templates].[Id]
|
||||
);
|
||||
""");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_DeploymentBatches_DeploymentRuleId",
|
||||
table: "DeploymentBatches",
|
||||
column: "DeploymentRuleId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TemplateVersions_TemplateId",
|
||||
table: "TemplateVersions",
|
||||
column: "TemplateId",
|
||||
unique: true,
|
||||
filter: "[IsPublished] = 1");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TemplateVersions_TemplateId_Version",
|
||||
table: "TemplateVersions",
|
||||
columns: new[] { "TemplateId", "Version" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_DeploymentBatches_DeploymentRules_DeploymentRuleId",
|
||||
table: "DeploymentBatches",
|
||||
column: "DeploymentRuleId",
|
||||
principalTable: "DeploymentRules",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_DeploymentBatches_DeploymentRules_DeploymentRuleId",
|
||||
table: "DeploymentBatches");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "TemplateVersions");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_DeploymentBatches_DeploymentRuleId",
|
||||
table: "DeploymentBatches");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "DeploymentRuleId",
|
||||
table: "DeploymentBatches");
|
||||
}
|
||||
}
|
||||
}
|
||||
+2123
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,370 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
||||
|
||||
namespace Microsoft.SelfService.Portal.Core.API.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class ResetAndSeedDemoData : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.Sql("""
|
||||
DELETE FROM [DeploymentJobTargets];
|
||||
DELETE FROM [DeploymentJobSteps];
|
||||
DELETE FROM [DeploymentJobs];
|
||||
DELETE FROM [Jobs];
|
||||
DELETE FROM [Events];
|
||||
DELETE FROM [DeploymentExecutions];
|
||||
DELETE FROM [DeploymentBatches];
|
||||
DELETE FROM [TemplateVersions];
|
||||
DELETE FROM [TemplateOptions];
|
||||
DELETE FROM [Templates];
|
||||
DELETE FROM [DeploymentRuleSteps];
|
||||
DELETE FROM [DeploymentRules];
|
||||
DELETE FROM [ServiceRoleDefinitions];
|
||||
DELETE FROM [TemplateCategories];
|
||||
DELETE FROM [Options];
|
||||
DELETE FROM [OptionCategories];
|
||||
DELETE FROM [Services];
|
||||
DELETE FROM [VirtualMachines];
|
||||
DELETE FROM [EnvironmentDomains];
|
||||
DELETE FROM [Domains];
|
||||
DELETE FROM [Environments];
|
||||
""");
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "DeploymentRules",
|
||||
columns: new[] { "Id", "Created", "CreatedBy", "Description", "IsActive", "Modified", "ModifiedBy", "Name" },
|
||||
values: new object[] { new Guid("60000000-0000-0000-0000-000000000001"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "Validate input, wait for approval, then provision targets.", true, new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "Standard Provisioning" });
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "Domains",
|
||||
columns: new[] { "Id", "Created", "CreatedBy", "FQDN", "Modified", "ModifiedBy", "Name", "NetBIOS" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("20000000-0000-0000-0000-000000000001"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "corp.contoso.com", new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "Central Management", "CONTOSO" },
|
||||
{ new Guid("20000000-0000-0000-0000-000000000002"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "resource.contoso.com", new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "Resource Domain", "RESOURCE" }
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "Environments",
|
||||
columns: new[] { "Id", "Created", "CreatedBy", "EnvironmentType", "HostingType", "MetadataJson", "Modified", "ModifiedBy", "Name", "ProviderType", "SubscriptionId", "TenantId" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("10000000-0000-0000-0000-000000000001"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "Test", "OnPrem", "{\"location\":\"Datacenter A\"}", new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "Contoso Test", null, null, null },
|
||||
{ new Guid("10000000-0000-0000-0000-000000000002"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "Production", "OnPrem", "{\"location\":\"Datacenter A\"}", new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "Contoso Production", null, null, null },
|
||||
{ new Guid("10000000-0000-0000-0000-000000000003"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "Production", "M365Tenant", "{\"tenant\":\"contoso.onmicrosoft.com\"}", new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "Contoso M365", "Microsoft365", null, "11111111-1111-1111-1111-111111111111" }
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "Services",
|
||||
columns: new[] { "Id", "Created", "CreatedBy", "Description", "IconKey", "IsCloudService", "Modified", "ModifiedBy", "Name" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("40000000-0000-0000-0000-000000000001"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "On-premises directory and identity service.", "network", false, new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "Active Directory" },
|
||||
{ new Guid("40000000-0000-0000-0000-000000000002"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "Database platform for application workloads.", "database", false, new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "SQL Server" },
|
||||
{ new Guid("40000000-0000-0000-0000-000000000003"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "Collaboration platform for on-premises workloads.", "sharepoint", false, new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "SharePoint Server" },
|
||||
{ new Guid("40000000-0000-0000-0000-000000000004"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "Cloud collaboration workload in Microsoft 365.", "messages-square", true, new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "Microsoft Teams" }
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "DeploymentRuleSteps",
|
||||
columns: new[] { "Id", "Created", "CreatedBy", "DeploymentRuleId", "MetadataJson", "Modified", "ModifiedBy", "Name", "RequiresApproval", "SortOrder", "StepType" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("60000000-0000-0000-0000-000000000101"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", new Guid("60000000-0000-0000-0000-000000000001"), "{\"action\":\"validate\"}", new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "Validate configuration", false, 10, "Provision" },
|
||||
{ new Guid("60000000-0000-0000-0000-000000000102"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", new Guid("60000000-0000-0000-0000-000000000001"), "{\"approverGroup\":\"Platform Owners\"}", new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "Approve deployment", true, 20, "Approval" },
|
||||
{ new Guid("60000000-0000-0000-0000-000000000103"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", new Guid("60000000-0000-0000-0000-000000000001"), "{\"action\":\"deploy\"}", new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "Provision workload", false, 30, "Provision" }
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "EnvironmentDomains",
|
||||
columns: new[] { "DomainId", "EnvironmentId", "Created", "CreatedBy", "Modified", "ModifiedBy" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("20000000-0000-0000-0000-000000000001"), new Guid("10000000-0000-0000-0000-000000000001"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed" },
|
||||
{ new Guid("20000000-0000-0000-0000-000000000001"), new Guid("10000000-0000-0000-0000-000000000002"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed" },
|
||||
{ new Guid("20000000-0000-0000-0000-000000000002"), new Guid("10000000-0000-0000-0000-000000000002"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed" }
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "ServiceRoleDefinitions",
|
||||
columns: new[] { "Id", "Created", "CreatedBy", "Description", "Key", "Modified", "ModifiedBy", "Name", "ServiceId" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("41000000-0000-0000-0000-000000000001"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "SharePoint farm role.", "Farm", new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "Farm", new Guid("40000000-0000-0000-0000-000000000003") },
|
||||
{ new Guid("41000000-0000-0000-0000-000000000002"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "SharePoint web front-end role.", "WebFrontEnd", new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "Web Front End", new Guid("40000000-0000-0000-0000-000000000003") },
|
||||
{ new Guid("41000000-0000-0000-0000-000000000003"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "SharePoint service application role.", "Application", new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "Application", new Guid("40000000-0000-0000-0000-000000000003") },
|
||||
{ new Guid("41000000-0000-0000-0000-000000000004"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "SQL Server database role.", "Database", new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "Database", new Guid("40000000-0000-0000-0000-000000000002") }
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "TemplateCategories",
|
||||
columns: new[] { "Id", "Color", "Created", "CreatedBy", "Description", "IsActive", "Modified", "ModifiedBy", "Name", "ServiceId" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("50000000-0000-0000-0000-000000000001"), "#2563EB", new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "Templates for domain controller and domain configuration.", true, new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "Domain Services", new Guid("40000000-0000-0000-0000-000000000001") },
|
||||
{ new Guid("50000000-0000-0000-0000-000000000002"), "#16A34A", new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "Templates for SQL Server workloads.", true, new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "Database Platform", new Guid("40000000-0000-0000-0000-000000000002") },
|
||||
{ new Guid("50000000-0000-0000-0000-000000000003"), "#0F766E", new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "Templates for SharePoint Server farms.", true, new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "Collaboration Farm", new Guid("40000000-0000-0000-0000-000000000003") },
|
||||
{ new Guid("50000000-0000-0000-0000-000000000004"), "#7C3AED", new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "Templates for Teams policy configuration.", true, new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "Teams Policies", new Guid("40000000-0000-0000-0000-000000000004") }
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "VirtualMachines",
|
||||
columns: new[] { "Id", "Created", "CreatedBy", "DomainID", "ExternalId", "MetadataJson", "Modified", "ModifiedBy", "Name" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("30000000-0000-0000-0000-000000000001"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", new Guid("20000000-0000-0000-0000-000000000001"), null, "{\"role\":\"DomainController\",\"environment\":\"Test\"}", new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "CT-DC-01" },
|
||||
{ new Guid("30000000-0000-0000-0000-000000000002"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", new Guid("20000000-0000-0000-0000-000000000001"), null, "{\"role\":\"DomainController\",\"environment\":\"Production\"}", new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "CT-DC-02" },
|
||||
{ new Guid("30000000-0000-0000-0000-000000000003"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", new Guid("20000000-0000-0000-0000-000000000001"), null, "{\"role\":\"SqlServer\",\"environment\":\"Test\"}", new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "CT-SQL-01" },
|
||||
{ new Guid("30000000-0000-0000-0000-000000000004"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", new Guid("20000000-0000-0000-0000-000000000001"), null, "{\"role\":\"SharePoint\",\"environment\":\"Test\"}", new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "CT-SHP-01" },
|
||||
{ new Guid("30000000-0000-0000-0000-000000000005"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", new Guid("20000000-0000-0000-0000-000000000001"), null, "{\"role\":\"SharePoint\",\"environment\":\"Test\"}", new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "CT-SHP-02" }
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "Templates",
|
||||
columns: new[] { "Id", "Created", "CreatedBy", "DeploymentRuleId", "Description", "JSONData", "Modified", "ModifiedBy", "Name", "TemplateCategoryId", "Version" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("70000000-0000-0000-0000-000000000001"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", new Guid("60000000-0000-0000-0000-000000000001"), "Creates a reusable Active Directory domain baseline.", "{\n \"schemaVersion\": \"1.0\",\n \"templateType\": \"Service\",\n \"parameters\": {\n \"DomainName\": { \"type\": \"string\", \"defaultValue\": \"corp.contoso.com\" },\n \"NetBIOSName\": { \"type\": \"string\", \"defaultValue\": \"CONTOSO\" }\n },\n \"variables\": {\n \"DefaultSiteName\": \"[concat(parameters('DomainName'), '-DefaultSite')]\"\n },\n \"resources\": {\n \"AllNodes\": [\n { \"NodeName\": \"*\", \"PSDscAllowPlainTextPassword\": true }\n ],\n \"NonNodeData\": {\n \"Services\": {\n \"ActiveDirectory\": {\n \"DomainName\": \"[parameters('DomainName')]\",\n \"NetBIOSName\": \"[parameters('NetBIOSName')]\"\n }\n }\n }\n }\n}", new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "Contoso Active Directory Domain", new Guid("50000000-0000-0000-0000-000000000001"), "1.0.0" },
|
||||
{ new Guid("70000000-0000-0000-0000-000000000002"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", new Guid("60000000-0000-0000-0000-000000000001"), "Creates a SQL Server baseline for application workloads.", "{\n \"schemaVersion\": \"1.0\",\n \"templateType\": \"Service\",\n \"parameters\": {\n \"InstanceName\": { \"type\": \"string\", \"defaultValue\": \"MSSQLSERVER\" },\n \"DatabasePrefix\": { \"type\": \"string\", \"defaultValue\": \"Contoso\" }\n },\n \"variables\": {\n \"ConfigDatabase\": \"[concat(parameters('DatabasePrefix'), '_Config')]\"\n },\n \"resources\": {\n \"NonNodeData\": {\n \"Services\": {\n \"SqlServer\": {\n \"InstanceName\": \"[parameters('InstanceName')]\",\n \"ConfigDatabase\": \"[variables('ConfigDatabase')]\"\n }\n }\n }\n }\n}", new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "Contoso SQL Server", new Guid("50000000-0000-0000-0000-000000000002"), "1.0.0" },
|
||||
{ new Guid("70000000-0000-0000-0000-000000000003"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", new Guid("60000000-0000-0000-0000-000000000001"), "Creates a SharePoint Server farm baseline.", "{\n \"schemaVersion\": \"1.0\",\n \"templateType\": \"Service\",\n \"parameters\": {\n \"DatabasePrefix\": { \"type\": \"string\", \"defaultValue\": \"SharePoint_Contoso_Test\" },\n \"FarmAccount\": { \"type\": \"credential\", \"metadata\": { \"description\": \"Farm account resolved by the credential provider.\" } }\n },\n \"variables\": {\n \"ConfigDbName\": \"[concat(parameters('DatabasePrefix'), '_Farm_Config')]\",\n \"AdminContentDbName\": \"[concat(parameters('DatabasePrefix'), '_AdminContent')]\"\n },\n \"resources\": {\n \"NonNodeData\": {\n \"Services\": {\n \"SharePoint\": {\n \"Farm\": {\n \"ConfigDatabase\": \"[variables('ConfigDbName')]\",\n \"AdminContentDatabase\": \"[variables('AdminContentDbName')]\",\n \"ManagedAccounts\": {\n \"FarmAccount\": \"[parameters('FarmAccount')]\"\n }\n }\n }\n }\n }\n }\n}", new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "Contoso SharePoint Server", new Guid("50000000-0000-0000-0000-000000000003"), "1.0.0" },
|
||||
{ new Guid("70000000-0000-0000-0000-000000000004"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", new Guid("60000000-0000-0000-0000-000000000001"), "Creates a Microsoft Teams policy baseline.", "{\n \"schemaVersion\": \"1.0\",\n \"templateType\": \"Service\",\n \"parameters\": {\n \"CallingPolicyName\": { \"type\": \"string\", \"defaultValue\": \"Contoso-Standard-Calling\" },\n \"MeetingPolicyName\": { \"type\": \"string\", \"defaultValue\": \"Contoso-Standard-Meetings\" }\n },\n \"variables\": {},\n \"resources\": {\n \"NonNodeData\": {\n \"Services\": {\n \"Teams\": {\n \"CallingPolicy\": \"[parameters('CallingPolicyName')]\",\n \"MeetingPolicy\": \"[parameters('MeetingPolicyName')]\"\n }\n }\n }\n }\n}", new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "Contoso Teams Policies", new Guid("50000000-0000-0000-0000-000000000004"), "1.0.0" }
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "DeploymentBatches",
|
||||
columns: new[] { "Id", "Created", "CreatedBy", "DeploymentRuleId", "Modified", "ModifiedBy", "Status", "TemplateId" },
|
||||
values: new object[] { new Guid("80000000-0000-0000-0000-000000000001"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", new Guid("60000000-0000-0000-0000-000000000001"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "Pending", new Guid("70000000-0000-0000-0000-000000000003") });
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "TemplateVersions",
|
||||
columns: new[] { "Id", "Created", "CreatedBy", "IsPublished", "JsonData", "JsonHash", "Modified", "ModifiedBy", "PublishedAt", "PublishedBy", "SchemaVersion", "TemplateId", "Version" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("71000000-0000-0000-0000-000000000001"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", true, "{\n \"schemaVersion\": \"1.0\",\n \"templateType\": \"Service\",\n \"parameters\": {\n \"DomainName\": { \"type\": \"string\", \"defaultValue\": \"corp.contoso.com\" },\n \"NetBIOSName\": { \"type\": \"string\", \"defaultValue\": \"CONTOSO\" }\n },\n \"variables\": {\n \"DefaultSiteName\": \"[concat(parameters('DomainName'), '-DefaultSite')]\"\n },\n \"resources\": {\n \"AllNodes\": [\n { \"NodeName\": \"*\", \"PSDscAllowPlainTextPassword\": true }\n ],\n \"NonNodeData\": {\n \"Services\": {\n \"ActiveDirectory\": {\n \"DomainName\": \"[parameters('DomainName')]\",\n \"NetBIOSName\": \"[parameters('NetBIOSName')]\"\n }\n }\n }\n }\n}", "C05CBEF91131C75DE53B9609D9C2709D680AFC9559EE8D998318A132490F79A7", new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "1.0", new Guid("70000000-0000-0000-0000-000000000001"), "1.0.0" },
|
||||
{ new Guid("71000000-0000-0000-0000-000000000002"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", true, "{\n \"schemaVersion\": \"1.0\",\n \"templateType\": \"Service\",\n \"parameters\": {\n \"InstanceName\": { \"type\": \"string\", \"defaultValue\": \"MSSQLSERVER\" },\n \"DatabasePrefix\": { \"type\": \"string\", \"defaultValue\": \"Contoso\" }\n },\n \"variables\": {\n \"ConfigDatabase\": \"[concat(parameters('DatabasePrefix'), '_Config')]\"\n },\n \"resources\": {\n \"NonNodeData\": {\n \"Services\": {\n \"SqlServer\": {\n \"InstanceName\": \"[parameters('InstanceName')]\",\n \"ConfigDatabase\": \"[variables('ConfigDatabase')]\"\n }\n }\n }\n }\n}", "F376737E82CB6B729F7B9960CB9988897C16D90A1C454ED2F594B28EB86ECA11", new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "1.0", new Guid("70000000-0000-0000-0000-000000000002"), "1.0.0" },
|
||||
{ new Guid("71000000-0000-0000-0000-000000000003"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", true, "{\n \"schemaVersion\": \"1.0\",\n \"templateType\": \"Service\",\n \"parameters\": {\n \"DatabasePrefix\": { \"type\": \"string\", \"defaultValue\": \"SharePoint_Contoso_Test\" },\n \"FarmAccount\": { \"type\": \"credential\", \"metadata\": { \"description\": \"Farm account resolved by the credential provider.\" } }\n },\n \"variables\": {\n \"ConfigDbName\": \"[concat(parameters('DatabasePrefix'), '_Farm_Config')]\",\n \"AdminContentDbName\": \"[concat(parameters('DatabasePrefix'), '_AdminContent')]\"\n },\n \"resources\": {\n \"NonNodeData\": {\n \"Services\": {\n \"SharePoint\": {\n \"Farm\": {\n \"ConfigDatabase\": \"[variables('ConfigDbName')]\",\n \"AdminContentDatabase\": \"[variables('AdminContentDbName')]\",\n \"ManagedAccounts\": {\n \"FarmAccount\": \"[parameters('FarmAccount')]\"\n }\n }\n }\n }\n }\n }\n}", "FD5F0FD3C13538FAC70646972DC364DFCEAAF85BBE91B0F50FDFF9FD3A3748B4", new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "1.0", new Guid("70000000-0000-0000-0000-000000000003"), "1.0.0" },
|
||||
{ new Guid("71000000-0000-0000-0000-000000000004"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", true, "{\n \"schemaVersion\": \"1.0\",\n \"templateType\": \"Service\",\n \"parameters\": {\n \"CallingPolicyName\": { \"type\": \"string\", \"defaultValue\": \"Contoso-Standard-Calling\" },\n \"MeetingPolicyName\": { \"type\": \"string\", \"defaultValue\": \"Contoso-Standard-Meetings\" }\n },\n \"variables\": {},\n \"resources\": {\n \"NonNodeData\": {\n \"Services\": {\n \"Teams\": {\n \"CallingPolicy\": \"[parameters('CallingPolicyName')]\",\n \"MeetingPolicy\": \"[parameters('MeetingPolicyName')]\"\n }\n }\n }\n }\n}", "32A902FE1A871D4CE2C877EBC5542F7562856532F09BA7F53597B21270586241", new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "1.0", new Guid("70000000-0000-0000-0000-000000000004"), "1.0.0" }
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "DeploymentExecutions",
|
||||
columns: new[] { "DeploymentBatchId", "VirtualMachineId", "Created", "CreatedBy", "Id", "JSONData", "Modified", "ModifiedBy", "Status" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("80000000-0000-0000-0000-000000000001"), new Guid("30000000-0000-0000-0000-000000000004"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", new Guid("81000000-0000-0000-0000-000000000001"), "{\"role\":\"WebFrontEnd\"}", new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "Pending" },
|
||||
{ new Guid("80000000-0000-0000-0000-000000000001"), new Guid("30000000-0000-0000-0000-000000000005"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", new Guid("81000000-0000-0000-0000-000000000002"), "{\"role\":\"Application\"}", new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "Pending" }
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DeleteData(
|
||||
table: "DeploymentExecutions",
|
||||
keyColumns: new[] { "DeploymentBatchId", "VirtualMachineId" },
|
||||
keyValues: new object[] { new Guid("80000000-0000-0000-0000-000000000001"), new Guid("30000000-0000-0000-0000-000000000004") });
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "DeploymentExecutions",
|
||||
keyColumns: new[] { "DeploymentBatchId", "VirtualMachineId" },
|
||||
keyValues: new object[] { new Guid("80000000-0000-0000-0000-000000000001"), new Guid("30000000-0000-0000-0000-000000000005") });
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "DeploymentRuleSteps",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("60000000-0000-0000-0000-000000000101"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "DeploymentRuleSteps",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("60000000-0000-0000-0000-000000000102"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "DeploymentRuleSteps",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("60000000-0000-0000-0000-000000000103"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "EnvironmentDomains",
|
||||
keyColumns: new[] { "DomainId", "EnvironmentId" },
|
||||
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000001"), new Guid("10000000-0000-0000-0000-000000000001") });
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "EnvironmentDomains",
|
||||
keyColumns: new[] { "DomainId", "EnvironmentId" },
|
||||
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000001"), new Guid("10000000-0000-0000-0000-000000000002") });
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "EnvironmentDomains",
|
||||
keyColumns: new[] { "DomainId", "EnvironmentId" },
|
||||
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000002"), new Guid("10000000-0000-0000-0000-000000000002") });
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Environments",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("10000000-0000-0000-0000-000000000003"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "ServiceRoleDefinitions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("41000000-0000-0000-0000-000000000001"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "ServiceRoleDefinitions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("41000000-0000-0000-0000-000000000002"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "ServiceRoleDefinitions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("41000000-0000-0000-0000-000000000003"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "ServiceRoleDefinitions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("41000000-0000-0000-0000-000000000004"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "TemplateVersions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("71000000-0000-0000-0000-000000000001"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "TemplateVersions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("71000000-0000-0000-0000-000000000002"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "TemplateVersions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("71000000-0000-0000-0000-000000000003"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "TemplateVersions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("71000000-0000-0000-0000-000000000004"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "VirtualMachines",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("30000000-0000-0000-0000-000000000001"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "VirtualMachines",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("30000000-0000-0000-0000-000000000002"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "VirtualMachines",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("30000000-0000-0000-0000-000000000003"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "DeploymentBatches",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("80000000-0000-0000-0000-000000000001"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Domains",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("20000000-0000-0000-0000-000000000002"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Environments",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("10000000-0000-0000-0000-000000000001"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Environments",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("10000000-0000-0000-0000-000000000002"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Templates",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("70000000-0000-0000-0000-000000000001"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Templates",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("70000000-0000-0000-0000-000000000002"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Templates",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("70000000-0000-0000-0000-000000000004"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "VirtualMachines",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("30000000-0000-0000-0000-000000000004"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "VirtualMachines",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("30000000-0000-0000-0000-000000000005"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Domains",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("20000000-0000-0000-0000-000000000001"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "TemplateCategories",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("50000000-0000-0000-0000-000000000001"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "TemplateCategories",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("50000000-0000-0000-0000-000000000002"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "TemplateCategories",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("50000000-0000-0000-0000-000000000004"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Templates",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("70000000-0000-0000-0000-000000000003"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "DeploymentRules",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("60000000-0000-0000-0000-000000000001"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Services",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("40000000-0000-0000-0000-000000000001"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Services",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("40000000-0000-0000-0000-000000000002"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Services",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("40000000-0000-0000-0000-000000000004"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "TemplateCategories",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("50000000-0000-0000-0000-000000000003"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Services",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("40000000-0000-0000-0000-000000000003"));
|
||||
}
|
||||
}
|
||||
}
|
||||
+1929
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,119 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Microsoft.SelfService.Portal.Core.API.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class RemoveSmaRunbooks : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Events");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Jobs");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Runbooks");
|
||||
|
||||
migrationBuilder.DropUniqueConstraint(
|
||||
name: "AK_DeploymentExecutions_Id",
|
||||
table: "DeploymentExecutions");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddUniqueConstraint(
|
||||
name: "AK_DeploymentExecutions_Id",
|
||||
table: "DeploymentExecutions",
|
||||
column: "Id");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Runbooks",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false, defaultValueSql: "NEWID()"),
|
||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Description = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Modified = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETDATE()"),
|
||||
ModifiedBy = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Created = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETDATE()"),
|
||||
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Runbooks", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Events",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false, defaultValueSql: "NEWID()"),
|
||||
RunbookId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
Class = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Method = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
RestEndpointMethod = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
RestEndpointOperation = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Modified = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETDATE()"),
|
||||
ModifiedBy = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Created = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETDATE()"),
|
||||
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Events", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Events_Runbooks_RunbookId",
|
||||
column: x => x.RunbookId,
|
||||
principalTable: "Runbooks",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Jobs",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false, defaultValueSql: "NEWID()"),
|
||||
DeploymentId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
RunbookId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
Modified = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETDATE()"),
|
||||
ModifiedBy = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Created = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETDATE()"),
|
||||
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Jobs", x => new { x.RunbookId, x.DeploymentId });
|
||||
table.ForeignKey(
|
||||
name: "FK_Jobs_DeploymentExecutions_DeploymentId",
|
||||
column: x => x.DeploymentId,
|
||||
principalTable: "DeploymentExecutions",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_Jobs_Runbooks_RunbookId",
|
||||
column: x => x.RunbookId,
|
||||
principalTable: "Runbooks",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Events_RunbookId",
|
||||
table: "Events",
|
||||
column: "RunbookId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Jobs_DeploymentId",
|
||||
table: "Jobs",
|
||||
column: "DeploymentId");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,192 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
||||
|
||||
namespace Microsoft.SelfService.Portal.Core.API.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddDeploymentComposition : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "DeploymentTargetAssignments",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false, defaultValueSql: "NEWID()"),
|
||||
DeploymentGroupId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
VirtualMachineId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
RoleKey = table.Column<string>(type: "nvarchar(450)", nullable: false),
|
||||
SortOrder = table.Column<int>(type: "int", nullable: false),
|
||||
NodeDataJson = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Modified = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETDATE()"),
|
||||
ModifiedBy = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Created = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETDATE()"),
|
||||
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_DeploymentTargetAssignments", x => x.Id);
|
||||
table.CheckConstraint("CK_DeploymentTargetAssignments_NodeDataJson_IsJson", "ISJSON([NodeDataJson]) = 1");
|
||||
table.ForeignKey(
|
||||
name: "FK_DeploymentTargetAssignments_DeploymentBatches_DeploymentGroupId",
|
||||
column: x => x.DeploymentGroupId,
|
||||
principalTable: "DeploymentBatches",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_DeploymentTargetAssignments_VirtualMachines_VirtualMachineId",
|
||||
column: x => x.VirtualMachineId,
|
||||
principalTable: "VirtualMachines",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "DeploymentTemplateSelections",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false, defaultValueSql: "NEWID()"),
|
||||
DeploymentGroupId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
TemplateVersionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
TemplateRole = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
SortOrder = table.Column<int>(type: "int", nullable: false),
|
||||
Alias = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
Modified = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETDATE()"),
|
||||
ModifiedBy = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Created = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETDATE()"),
|
||||
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_DeploymentTemplateSelections", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_DeploymentTemplateSelections_DeploymentBatches_DeploymentGroupId",
|
||||
column: x => x.DeploymentGroupId,
|
||||
principalTable: "DeploymentBatches",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_DeploymentTemplateSelections_TemplateVersions_TemplateVersionId",
|
||||
column: x => x.TemplateVersionId,
|
||||
principalTable: "TemplateVersions",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "DeploymentParameterValues",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false, defaultValueSql: "NEWID()"),
|
||||
DeploymentGroupId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
DeploymentTemplateSelectionId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
||||
Name = table.Column<string>(type: "nvarchar(450)", nullable: false),
|
||||
ValueJson = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
IsSecretReference = table.Column<bool>(type: "bit", nullable: false),
|
||||
IsOverride = table.Column<bool>(type: "bit", nullable: false),
|
||||
Modified = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETDATE()"),
|
||||
ModifiedBy = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Created = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETDATE()"),
|
||||
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_DeploymentParameterValues", x => x.Id);
|
||||
table.CheckConstraint("CK_DeploymentParameterValues_ValueJson_IsJson", "ISJSON([ValueJson]) = 1");
|
||||
table.ForeignKey(
|
||||
name: "FK_DeploymentParameterValues_DeploymentBatches_DeploymentGroupId",
|
||||
column: x => x.DeploymentGroupId,
|
||||
principalTable: "DeploymentBatches",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_DeploymentParameterValues_DeploymentTemplateSelections_DeploymentTemplateSelectionId",
|
||||
column: x => x.DeploymentTemplateSelectionId,
|
||||
principalTable: "DeploymentTemplateSelections",
|
||||
principalColumn: "Id");
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "DeploymentTargetAssignments",
|
||||
columns: new[] { "Id", "Created", "CreatedBy", "DeploymentGroupId", "Modified", "ModifiedBy", "NodeDataJson", "RoleKey", "SortOrder", "VirtualMachineId" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("84000000-0000-0000-0000-000000000001"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", new Guid("80000000-0000-0000-0000-000000000001"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "{\"nodeName\":\"CT-SHP-01\"}", "WebFrontEnd", 10, new Guid("30000000-0000-0000-0000-000000000004") },
|
||||
{ new Guid("84000000-0000-0000-0000-000000000002"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", new Guid("80000000-0000-0000-0000-000000000001"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "{\"nodeName\":\"CT-SHP-02\"}", "Application", 20, new Guid("30000000-0000-0000-0000-000000000005") }
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "DeploymentTemplateSelections",
|
||||
columns: new[] { "Id", "Alias", "Created", "CreatedBy", "DeploymentGroupId", "Modified", "ModifiedBy", "SortOrder", "TemplateRole", "TemplateVersionId" },
|
||||
values: new object[] { new Guid("82000000-0000-0000-0000-000000000001"), "SharePoint", new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", new Guid("80000000-0000-0000-0000-000000000001"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", 10, "Service", new Guid("71000000-0000-0000-0000-000000000003") });
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "DeploymentParameterValues",
|
||||
columns: new[] { "Id", "Created", "CreatedBy", "DeploymentGroupId", "DeploymentTemplateSelectionId", "IsOverride", "IsSecretReference", "Modified", "ModifiedBy", "Name", "ValueJson" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("83000000-0000-0000-0000-000000000001"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", new Guid("80000000-0000-0000-0000-000000000001"), new Guid("82000000-0000-0000-0000-000000000001"), true, false, new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "DatabasePrefix", "{\"value\":\"SharePoint_Contoso_Test\"}" },
|
||||
{ new Guid("83000000-0000-0000-0000-000000000002"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", new Guid("80000000-0000-0000-0000-000000000001"), new Guid("82000000-0000-0000-0000-000000000001"), true, true, new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "FarmAccount", "{\"provider\":\"SecretManagement\",\"vault\":\"ContosoDemo\",\"name\":\"Windows/SharePoint/FarmAccount\"}" }
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_DeploymentParameterValues_DeploymentGroupId_DeploymentTemplateSelectionId_Name",
|
||||
table: "DeploymentParameterValues",
|
||||
columns: new[] { "DeploymentGroupId", "DeploymentTemplateSelectionId", "Name" },
|
||||
unique: true,
|
||||
filter: "[DeploymentTemplateSelectionId] IS NOT NULL");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_DeploymentParameterValues_DeploymentGroupId_Name",
|
||||
table: "DeploymentParameterValues",
|
||||
columns: new[] { "DeploymentGroupId", "Name" },
|
||||
unique: true,
|
||||
filter: "[DeploymentTemplateSelectionId] IS NULL");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_DeploymentParameterValues_DeploymentTemplateSelectionId",
|
||||
table: "DeploymentParameterValues",
|
||||
column: "DeploymentTemplateSelectionId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_DeploymentTargetAssignments_DeploymentGroupId_VirtualMachineId_RoleKey",
|
||||
table: "DeploymentTargetAssignments",
|
||||
columns: new[] { "DeploymentGroupId", "VirtualMachineId", "RoleKey" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_DeploymentTargetAssignments_VirtualMachineId",
|
||||
table: "DeploymentTargetAssignments",
|
||||
column: "VirtualMachineId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_DeploymentTemplateSelections_DeploymentGroupId_SortOrder",
|
||||
table: "DeploymentTemplateSelections",
|
||||
columns: new[] { "DeploymentGroupId", "SortOrder" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_DeploymentTemplateSelections_TemplateVersionId",
|
||||
table: "DeploymentTemplateSelections",
|
||||
column: "TemplateVersionId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "DeploymentParameterValues");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "DeploymentTargetAssignments");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "DeploymentTemplateSelections");
|
||||
}
|
||||
}
|
||||
}
|
||||
+2312
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,220 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
||||
|
||||
namespace Microsoft.SelfService.Portal.Core.API.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddGenericTargetModel : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_DeploymentExecutions_VirtualMachines_VirtualMachineId",
|
||||
table: "DeploymentExecutions");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_DeploymentTargetAssignments_VirtualMachines_VirtualMachineId",
|
||||
table: "DeploymentTargetAssignments");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_VirtualMachines_Domains_DomainID",
|
||||
table: "VirtualMachines");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_VirtualMachines",
|
||||
table: "VirtualMachines");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "VirtualMachines",
|
||||
newName: "Targets");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "VirtualMachineId",
|
||||
table: "DeploymentTargetAssignments",
|
||||
newName: "TargetId");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_DeploymentTargetAssignments_VirtualMachineId",
|
||||
table: "DeploymentTargetAssignments",
|
||||
newName: "IX_DeploymentTargetAssignments_TargetId");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_DeploymentTargetAssignments_DeploymentGroupId_VirtualMachineId_RoleKey",
|
||||
table: "DeploymentTargetAssignments",
|
||||
newName: "IX_DeploymentTargetAssignments_DeploymentGroupId_TargetId_RoleKey");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "VirtualMachineId",
|
||||
table: "DeploymentJobTargets",
|
||||
newName: "TargetId");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "VirtualMachineId",
|
||||
table: "DeploymentExecutions",
|
||||
newName: "TargetId");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_VirtualMachines_DomainID",
|
||||
table: "Targets",
|
||||
newName: "IX_Targets_DomainID");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "ProviderType",
|
||||
table: "Targets",
|
||||
type: "nvarchar(64)",
|
||||
maxLength: 64,
|
||||
nullable: false,
|
||||
defaultValue: "OnPrem");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "TargetType",
|
||||
table: "Targets",
|
||||
type: "nvarchar(64)",
|
||||
maxLength: 64,
|
||||
nullable: false,
|
||||
defaultValue: "VirtualMachine");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_Targets",
|
||||
table: "Targets",
|
||||
column: "Id");
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "Targets",
|
||||
columns: new[] { "Id", "Created", "CreatedBy", "DomainID", "ExternalId", "MetadataJson", "Modified", "ModifiedBy", "Name", "ProviderType", "TargetType" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("30000000-0000-0000-0000-000000000006"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", null, "11111111-1111-1111-1111-111111111111", "{\"environment\":\"Production\",\"workload\":\"M365\"}", new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "contoso.onmicrosoft.com", "Microsoft365", "Tenant" },
|
||||
{ new Guid("30000000-0000-0000-0000-000000000007"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", null, "Teams.StandardUsers", "{\"workload\":\"Teams\",\"scope\":\"StandardUsers\"}", new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "Teams - Standard Users", "Microsoft365", "PolicyScope" }
|
||||
});
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Targets_Domains_DomainID",
|
||||
table: "Targets",
|
||||
column: "DomainID",
|
||||
principalTable: "Domains",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_DeploymentExecutions_Targets_TargetId",
|
||||
table: "DeploymentExecutions",
|
||||
column: "TargetId",
|
||||
principalTable: "Targets",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_DeploymentTargetAssignments_Targets_TargetId",
|
||||
table: "DeploymentTargetAssignments",
|
||||
column: "TargetId",
|
||||
principalTable: "Targets",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_DeploymentExecutions_Targets_TargetId",
|
||||
table: "DeploymentExecutions");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_DeploymentTargetAssignments_Targets_TargetId",
|
||||
table: "DeploymentTargetAssignments");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Targets_Domains_DomainID",
|
||||
table: "Targets");
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Targets",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("30000000-0000-0000-0000-000000000006"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Targets",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("30000000-0000-0000-0000-000000000007"));
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_Targets",
|
||||
table: "Targets");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ProviderType",
|
||||
table: "Targets");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "TargetType",
|
||||
table: "Targets");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "Targets",
|
||||
newName: "VirtualMachines");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "TargetId",
|
||||
table: "DeploymentTargetAssignments",
|
||||
newName: "VirtualMachineId");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_DeploymentTargetAssignments_TargetId",
|
||||
table: "DeploymentTargetAssignments",
|
||||
newName: "IX_DeploymentTargetAssignments_VirtualMachineId");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_DeploymentTargetAssignments_DeploymentGroupId_TargetId_RoleKey",
|
||||
table: "DeploymentTargetAssignments",
|
||||
newName: "IX_DeploymentTargetAssignments_DeploymentGroupId_VirtualMachineId_RoleKey");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "TargetId",
|
||||
table: "DeploymentJobTargets",
|
||||
newName: "VirtualMachineId");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "TargetId",
|
||||
table: "DeploymentExecutions",
|
||||
newName: "VirtualMachineId");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_Targets_DomainID",
|
||||
table: "VirtualMachines",
|
||||
newName: "IX_VirtualMachines_DomainID");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_VirtualMachines",
|
||||
table: "VirtualMachines",
|
||||
column: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_VirtualMachines_Domains_DomainID",
|
||||
table: "VirtualMachines",
|
||||
column: "DomainID",
|
||||
principalTable: "Domains",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_DeploymentExecutions_VirtualMachines_VirtualMachineId",
|
||||
table: "DeploymentExecutions",
|
||||
column: "VirtualMachineId",
|
||||
principalTable: "VirtualMachines",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_DeploymentTargetAssignments_VirtualMachines_VirtualMachineId",
|
||||
table: "DeploymentTargetAssignments",
|
||||
column: "VirtualMachineId",
|
||||
principalTable: "VirtualMachines",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
}
|
||||
}
|
||||
}
|
||||
+1054
-226
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user