You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

266 lines
9.8 KiB

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace X1.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class UpdateNetworkStackConfigAndBindings : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Stack_CoreIMS_Bindings_CoreNetworkConfigs_CnId",
table: "Stack_CoreIMS_Bindings");
migrationBuilder.DropForeignKey(
name: "FK_Stack_CoreIMS_Bindings_IMS_Configurations_ImsId",
table: "Stack_CoreIMS_Bindings");
migrationBuilder.DropForeignKey(
name: "FK_Stack_CoreIMS_Bindings_NetworkStackConfigs_StackId",
table: "Stack_CoreIMS_Bindings");
migrationBuilder.DropIndex(
name: "IX_Stack_CoreIMS_Bindings_StackId",
table: "Stack_CoreIMS_Bindings");
migrationBuilder.DropIndex(
name: "IX_Stack_CoreIMS_Bindings_StackId_Index",
table: "Stack_CoreIMS_Bindings");
migrationBuilder.DropUniqueConstraint(
name: "AK_NetworkStackConfigs_StackId",
table: "NetworkStackConfigs");
migrationBuilder.DropIndex(
name: "IX_NetworkStackConfigs_StackId",
table: "NetworkStackConfigs");
migrationBuilder.DropColumn(
name: "CreatedAt",
table: "Stack_CoreIMS_Bindings");
migrationBuilder.DropColumn(
name: "CreatedBy",
table: "Stack_CoreIMS_Bindings");
migrationBuilder.DropColumn(
name: "IsDeleted",
table: "Stack_CoreIMS_Bindings");
migrationBuilder.DropColumn(
name: "StackId",
table: "Stack_CoreIMS_Bindings");
migrationBuilder.DropColumn(
name: "UpdatedAt",
table: "Stack_CoreIMS_Bindings");
migrationBuilder.DropColumn(
name: "UpdatedBy",
table: "Stack_CoreIMS_Bindings");
migrationBuilder.DropColumn(
name: "StackId",
table: "NetworkStackConfigs");
migrationBuilder.AddColumn<string>(
name: "NetworkStackConfigId",
table: "Stack_CoreIMS_Bindings",
type: "character varying(50)",
maxLength: 50,
nullable: false,
defaultValue: "",
comment: "网络栈配置ID");
migrationBuilder.AddColumn<string>(
name: "NetworkStackName",
table: "NetworkStackConfigs",
type: "character varying(100)",
maxLength: 100,
nullable: false,
defaultValue: "",
comment: "网络栈名称");
migrationBuilder.CreateIndex(
name: "IX_Stack_CoreIMS_Bindings_NetworkStackConfigId",
table: "Stack_CoreIMS_Bindings",
column: "NetworkStackConfigId");
migrationBuilder.CreateIndex(
name: "IX_Stack_CoreIMS_Bindings_NetworkStackConfigId_Index",
table: "Stack_CoreIMS_Bindings",
columns: new[] { "NetworkStackConfigId", "Index" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_NetworkStackConfigs_NetworkStackName",
table: "NetworkStackConfigs",
column: "NetworkStackName",
unique: true);
migrationBuilder.AddForeignKey(
name: "FK_Stack_CoreIMS_Bindings_CoreNetworkConfigs_CnId",
table: "Stack_CoreIMS_Bindings",
column: "CnId",
principalTable: "CoreNetworkConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Stack_CoreIMS_Bindings_IMS_Configurations_ImsId",
table: "Stack_CoreIMS_Bindings",
column: "ImsId",
principalTable: "IMS_Configurations",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Stack_CoreIMS_Bindings_NetworkStackConfigs_NetworkStackConf~",
table: "Stack_CoreIMS_Bindings",
column: "NetworkStackConfigId",
principalTable: "NetworkStackConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Stack_CoreIMS_Bindings_CoreNetworkConfigs_CnId",
table: "Stack_CoreIMS_Bindings");
migrationBuilder.DropForeignKey(
name: "FK_Stack_CoreIMS_Bindings_IMS_Configurations_ImsId",
table: "Stack_CoreIMS_Bindings");
migrationBuilder.DropForeignKey(
name: "FK_Stack_CoreIMS_Bindings_NetworkStackConfigs_NetworkStackConf~",
table: "Stack_CoreIMS_Bindings");
migrationBuilder.DropIndex(
name: "IX_Stack_CoreIMS_Bindings_NetworkStackConfigId",
table: "Stack_CoreIMS_Bindings");
migrationBuilder.DropIndex(
name: "IX_Stack_CoreIMS_Bindings_NetworkStackConfigId_Index",
table: "Stack_CoreIMS_Bindings");
migrationBuilder.DropIndex(
name: "IX_NetworkStackConfigs_NetworkStackName",
table: "NetworkStackConfigs");
migrationBuilder.DropColumn(
name: "NetworkStackConfigId",
table: "Stack_CoreIMS_Bindings");
migrationBuilder.DropColumn(
name: "NetworkStackName",
table: "NetworkStackConfigs");
migrationBuilder.AddColumn<DateTime>(
name: "CreatedAt",
table: "Stack_CoreIMS_Bindings",
type: "timestamp with time zone",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
comment: "创建时间");
migrationBuilder.AddColumn<string>(
name: "CreatedBy",
table: "Stack_CoreIMS_Bindings",
type: "text",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<bool>(
name: "IsDeleted",
table: "Stack_CoreIMS_Bindings",
type: "boolean",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<string>(
name: "StackId",
table: "Stack_CoreIMS_Bindings",
type: "character varying(50)",
maxLength: 50,
nullable: false,
defaultValue: "",
comment: "栈ID");
migrationBuilder.AddColumn<DateTime>(
name: "UpdatedAt",
table: "Stack_CoreIMS_Bindings",
type: "timestamp with time zone",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
comment: "更新时间");
migrationBuilder.AddColumn<string>(
name: "UpdatedBy",
table: "Stack_CoreIMS_Bindings",
type: "text",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "StackId",
table: "NetworkStackConfigs",
type: "character varying(50)",
maxLength: 50,
nullable: false,
defaultValue: "",
comment: "栈ID");
migrationBuilder.AddUniqueConstraint(
name: "AK_NetworkStackConfigs_StackId",
table: "NetworkStackConfigs",
column: "StackId");
migrationBuilder.CreateIndex(
name: "IX_Stack_CoreIMS_Bindings_StackId",
table: "Stack_CoreIMS_Bindings",
column: "StackId");
migrationBuilder.CreateIndex(
name: "IX_Stack_CoreIMS_Bindings_StackId_Index",
table: "Stack_CoreIMS_Bindings",
columns: new[] { "StackId", "Index" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_NetworkStackConfigs_StackId",
table: "NetworkStackConfigs",
column: "StackId",
unique: true);
migrationBuilder.AddForeignKey(
name: "FK_Stack_CoreIMS_Bindings_CoreNetworkConfigs_CnId",
table: "Stack_CoreIMS_Bindings",
column: "CnId",
principalTable: "CoreNetworkConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Stack_CoreIMS_Bindings_IMS_Configurations_ImsId",
table: "Stack_CoreIMS_Bindings",
column: "ImsId",
principalTable: "IMS_Configurations",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Stack_CoreIMS_Bindings_NetworkStackConfigs_StackId",
table: "Stack_CoreIMS_Bindings",
column: "StackId",
principalTable: "NetworkStackConfigs",
principalColumn: "StackId",
onDelete: ReferentialAction.Cascade);
}
}
}