85 lines
3.3 KiB
C#
85 lines
3.3 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace Church.Net.DAL.EFCoreDBF.Migrations
|
|
{
|
|
public partial class AddAppId : Migration
|
|
{
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "CommunityAppId",
|
|
table: "PastoralDomains",
|
|
type: "text",
|
|
nullable: false,
|
|
defaultValue: "");
|
|
|
|
migrationBuilder.AddUniqueConstraint(
|
|
name: "AK_PastoralDomains_CommunityAppId",
|
|
table: "PastoralDomains",
|
|
column: "CommunityAppId");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "AutoReplyItems",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<string>(type: "text", nullable: false),
|
|
Command = table.Column<string>(type: "text", nullable: true),
|
|
Description = table.Column<string>(type: "text", nullable: true),
|
|
Content = table.Column<string>(type: "text", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_AutoReplyItems", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "PastoralDomainAutoReplys",
|
|
columns: table => new
|
|
{
|
|
PastoralDomainCommunityAppId = table.Column<string>(type: "text", nullable: false),
|
|
AutoReplyItemId = table.Column<string>(type: "text", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_PastoralDomainAutoReplys", x => new { x.PastoralDomainCommunityAppId, x.AutoReplyItemId });
|
|
table.ForeignKey(
|
|
name: "FK_PastoralDomainAutoReplys_AutoReplyItems_AutoReplyItemId",
|
|
column: x => x.AutoReplyItemId,
|
|
principalTable: "AutoReplyItems",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_PastoralDomainAutoReplys_PastoralDomains_PastoralDomainComm~",
|
|
column: x => x.PastoralDomainCommunityAppId,
|
|
principalTable: "PastoralDomains",
|
|
principalColumn: "CommunityAppId",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_PastoralDomainAutoReplys_AutoReplyItemId",
|
|
table: "PastoralDomainAutoReplys",
|
|
column: "AutoReplyItemId");
|
|
}
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "PastoralDomainAutoReplys");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "AutoReplyItems");
|
|
|
|
migrationBuilder.DropUniqueConstraint(
|
|
name: "AK_PastoralDomains_CommunityAppId",
|
|
table: "PastoralDomains");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "CommunityAppId",
|
|
table: "PastoralDomains");
|
|
}
|
|
}
|
|
}
|