Church.Net.API/Church.Net.WebAPI/DAL/Migrations/20220907195903_AddMissingColumn.cs
2025-11-02 17:05:06 -08:00

168 lines
5.8 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Church.Net.DAL.EFCoreDBF.Migrations
{
public partial class AddMissingColumn : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "LogoImage",
table: "PastoralDomains",
type: "text",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "ServiceAddressId",
table: "PastoralDomains",
type: "text",
nullable: true);
migrationBuilder.AlterColumn<string>(
name: "Password",
table: "FamilyMembers",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "Email",
table: "FamilyMembers",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<DateTime>(
name: "DateOfWalkIn",
table: "FamilyMembers",
type: "timestamp with time zone",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone");
migrationBuilder.AlterColumn<DateTime>(
name: "Birthday",
table: "FamilyMembers",
type: "timestamp with time zone",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone");
migrationBuilder.AddColumn<bool>(
name: "Baptized",
table: "FamilyMembers",
type: "boolean",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<string>(
name: "Comment",
table: "FamilyMembers",
type: "text",
nullable: true);
migrationBuilder.CreateTable(
name: "AddressInfos",
columns: table => new
{
Id = table.Column<string>(type: "text", nullable: false),
Address = table.Column<string>(type: "text", nullable: true),
City = table.Column<string>(type: "text", nullable: true),
State = table.Column<string>(type: "text", nullable: true),
Zip = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AddressInfos", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_PastoralDomains_ServiceAddressId",
table: "PastoralDomains",
column: "ServiceAddressId");
migrationBuilder.AddForeignKey(
name: "FK_PastoralDomains_AddressInfos_ServiceAddressId",
table: "PastoralDomains",
column: "ServiceAddressId",
principalTable: "AddressInfos",
principalColumn: "Id");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_PastoralDomains_AddressInfos_ServiceAddressId",
table: "PastoralDomains");
migrationBuilder.DropTable(
name: "AddressInfos");
migrationBuilder.DropIndex(
name: "IX_PastoralDomains_ServiceAddressId",
table: "PastoralDomains");
migrationBuilder.DropColumn(
name: "LogoImage",
table: "PastoralDomains");
migrationBuilder.DropColumn(
name: "ServiceAddressId",
table: "PastoralDomains");
migrationBuilder.DropColumn(
name: "Baptized",
table: "FamilyMembers");
migrationBuilder.DropColumn(
name: "Comment",
table: "FamilyMembers");
migrationBuilder.AlterColumn<string>(
name: "Password",
table: "FamilyMembers",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Email",
table: "FamilyMembers",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "DateOfWalkIn",
table: "FamilyMembers",
type: "timestamp with time zone",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "Birthday",
table: "FamilyMembers",
type: "timestamp with time zone",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone",
oldNullable: true);
}
}
}