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( name: "HappinessGroupId", table: "HappinessWeeks", type: "text", nullable: true); migrationBuilder.AddColumn( name: "HappinessGroupId", table: "HappinessBESTs", type: "text", nullable: true); migrationBuilder.CreateTable( name: "HappinessGroups", columns: table => new { Id = table.Column(type: "text", nullable: false), LineAccountId = table.Column(type: "text", nullable: true), Address = table.Column(type: "text", nullable: true), BeginTime = table.Column(type: "timestamp with time zone", nullable: false), CityAndZipCode = table.Column(type: "text", nullable: true), InvitationText = table.Column(type: "text", nullable: true), LineGroupId = table.Column(type: "text", nullable: true), Name = table.Column(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"); } } }