Church.Net.API/Church.Net.DAL.EFCoreDBF/Migrations/20221002114621_RemoveHappinessGroup.cs
2022-10-02 09:50:42 -07:00

108 lines
4.1 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Church.Net.DAL.EFCoreDBF.Migrations
{
public partial class RemoveHappinessGroup : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_HappinessBESTs_HappinessGroups_HappinessGroupId",
table: "HappinessBESTs");
migrationBuilder.DropForeignKey(
name: "FK_HappinessWeeks_HappinessGroups_HappinessGroupId",
table: "HappinessWeeks");
migrationBuilder.DropTable(
name: "HappinessGroups");
migrationBuilder.DropIndex(
name: "IX_HappinessWeeks_HappinessGroupId",
table: "HappinessWeeks");
migrationBuilder.DropIndex(
name: "IX_HappinessBESTs_HappinessGroupId",
table: "HappinessBESTs");
migrationBuilder.DropColumn(
name: "HappinessGroupId",
table: "HappinessWeeks");
migrationBuilder.DropColumn(
name: "HappinessGroupId",
table: "HappinessBESTs");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "HappinessGroupId",
table: "HappinessWeeks",
type: "text",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "HappinessGroupId",
table: "HappinessBESTs",
type: "text",
nullable: true);
migrationBuilder.CreateTable(
name: "HappinessGroups",
columns: table => new
{
Id = table.Column<string>(type: "text", nullable: false),
LineAccountId = table.Column<string>(type: "text", nullable: true),
Address = table.Column<string>(type: "text", nullable: true),
BeginTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
CityAndZipCode = table.Column<string>(type: "text", nullable: true),
InvitationText = table.Column<string>(type: "text", nullable: true),
LineGroupId = table.Column<string>(type: "text", nullable: true),
Name = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_HappinessGroups", x => x.Id);
table.ForeignKey(
name: "FK_HappinessGroups_LineMessagingAccounts_LineAccountId",
column: x => x.LineAccountId,
principalTable: "LineMessagingAccounts",
principalColumn: "Id");
});
migrationBuilder.CreateIndex(
name: "IX_HappinessWeeks_HappinessGroupId",
table: "HappinessWeeks",
column: "HappinessGroupId");
migrationBuilder.CreateIndex(
name: "IX_HappinessBESTs_HappinessGroupId",
table: "HappinessBESTs",
column: "HappinessGroupId");
migrationBuilder.CreateIndex(
name: "IX_HappinessGroups_LineAccountId",
table: "HappinessGroups",
column: "LineAccountId");
migrationBuilder.AddForeignKey(
name: "FK_HappinessBESTs_HappinessGroups_HappinessGroupId",
table: "HappinessBESTs",
column: "HappinessGroupId",
principalTable: "HappinessGroups",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_HappinessWeeks_HappinessGroups_HappinessGroupId",
table: "HappinessWeeks",
column: "HappinessGroupId",
principalTable: "HappinessGroups",
principalColumn: "Id");
}
}
}