Refactor code structure for improved readability and maintainability
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Microsoft.SelfService.Portal.Core.API.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddServiceCloudFlagAndRoleDefinitionsV2 : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "IsCloudService",
|
||||
table: "Services",
|
||||
type: "bit",
|
||||
nullable: false,
|
||||
defaultValue: false)
|
||||
.Annotation("Relational:ColumnOrder", 3);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ServiceRoleDefinitions",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false, defaultValueSql: "NEWID()"),
|
||||
ServiceId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
Key = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Description = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
MinCount = table.Column<int>(type: "int", nullable: false),
|
||||
MaxCount = table.Column<int>(type: "int", nullable: false),
|
||||
DefaultStageOrder = table.Column<int>(type: "int", 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_ServiceRoleDefinitions", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ServiceRoleDefinitions_Services_ServiceId",
|
||||
column: x => x.ServiceId,
|
||||
principalTable: "Services",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ServiceRoleDefinitions_ServiceId",
|
||||
table: "ServiceRoleDefinitions",
|
||||
column: "ServiceId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "ServiceRoleDefinitions");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "IsCloudService",
|
||||
table: "Services");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user