2025-11-02 17:05:06 -08:00

383 lines
19 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace Church.Net.DAL.EFCoreDBF.Migrations
{
public partial class Init : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Careers",
columns: table => new
{
Id = table.Column<string>(type: "text", nullable: false),
Name = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Careers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "CellGroupRoutineEvents",
columns: table => new
{
Id = table.Column<string>(type: "text", nullable: false),
Time = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
Address = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_CellGroupRoutineEvents", x => x.Id);
});
migrationBuilder.CreateTable(
name: "HappinessGroups",
columns: table => new
{
Id = table.Column<string>(type: "text", nullable: false),
Name = table.Column<string>(type: "text", nullable: true),
BeginTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
Address = table.Column<string>(type: "text", nullable: true),
CityAndZipCode = table.Column<string>(type: "text", nullable: true),
InvitationText = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_HappinessGroups", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Religions",
columns: table => new
{
ReligionId = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Name = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Religions", x => x.ReligionId);
});
migrationBuilder.CreateTable(
name: "Vocabulary",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Word = table.Column<string>(type: "text", nullable: false),
DefinitionEn = table.Column<string>(type: "text", nullable: false),
DefinitionCh = table.Column<string>(type: "text", nullable: false),
NounPlural = table.Column<string>(type: "text", nullable: true),
VerbPast = table.Column<string>(type: "text", nullable: true),
VerbParticiple = table.Column<string>(type: "text", nullable: true),
PartOfSpeech = table.Column<int>(type: "integer", nullable: false),
ImagesUrl = table.Column<string>(type: "text", nullable: true),
InsertDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
PracticeDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
PracticeStage = table.Column<int>(type: "integer", nullable: false),
PracticeSelect = table.Column<bool>(type: "boolean", nullable: false),
PracticeMemorized = table.Column<bool>(type: "boolean", nullable: false),
PracticeVisualize = table.Column<bool>(type: "boolean", nullable: false),
PracticeApply = table.Column<bool>(type: "boolean", nullable: false),
PracticeReview = table.Column<bool>(type: "boolean", nullable: false),
PracticeSentence = table.Column<string>(type: "text", nullable: true),
FlashCardTimes = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Vocabulary", x => x.Id);
});
migrationBuilder.CreateTable(
name: "WhoIsSpy",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Answer1Cht = table.Column<string>(type: "text", nullable: true),
Answer1Chs = table.Column<string>(type: "text", nullable: true),
Answer1En = table.Column<string>(type: "text", nullable: true),
Answer2Cht = table.Column<string>(type: "text", nullable: true),
Answer2Chs = table.Column<string>(type: "text", nullable: true),
Answer2En = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_WhoIsSpy", x => x.Id);
});
migrationBuilder.CreateTable(
name: "FamilyMembers",
columns: table => new
{
Id = table.Column<string>(type: "text", nullable: false),
Email = table.Column<string>(type: "text", nullable: false),
Password = table.Column<string>(type: "text", nullable: false),
AvatarImage = table.Column<string>(type: "text", nullable: true),
FirstName = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: true),
LastName = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: true),
Gender = table.Column<int>(type: "integer", nullable: false),
Birthday = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
Married = table.Column<bool>(type: "boolean", nullable: false),
DateOfBaptized = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
DateOfWalkIn = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
Address = table.Column<string>(type: "character varying(500)", maxLength: 500, nullable: true),
ComunityAppId = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: true),
CareerId = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_FamilyMembers", x => x.Id);
table.ForeignKey(
name: "FK_FamilyMembers_Careers_CareerId",
column: x => x.CareerId,
principalTable: "Careers",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "CellGroupRoutineEventAttendees",
columns: table => new
{
EventId = table.Column<string>(type: "text", nullable: false),
Id = table.Column<string>(type: "text", nullable: false),
Name = table.Column<string>(type: "text", nullable: true),
JoinPotluck = table.Column<bool>(type: "boolean", nullable: false),
PotluckItem = table.Column<string>(type: "text", nullable: true),
Comment = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_CellGroupRoutineEventAttendees", x => new { x.EventId, x.Id });
table.ForeignKey(
name: "FK_CellGroupRoutineEventAttendees_CellGroupRoutineEvents_Event~",
column: x => x.EventId,
principalTable: "CellGroupRoutineEvents",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "HappinessBESTs",
columns: table => new
{
Id = table.Column<string>(type: "text", nullable: false),
GroupId = table.Column<string>(type: "text", nullable: true),
Name = table.Column<string>(type: "text", nullable: false),
Email = table.Column<string>(type: "text", nullable: true),
Phone = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_HappinessBESTs", x => x.Id);
table.ForeignKey(
name: "FK_HappinessBESTs_HappinessGroups_GroupId",
column: x => x.GroupId,
principalTable: "HappinessGroups",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "HappinessWeeks",
columns: table => new
{
Id = table.Column<string>(type: "text", nullable: false),
GroupId = table.Column<string>(type: "text", nullable: true),
Date = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
InvitationText = table.Column<string>(type: "text", nullable: true),
Address = table.Column<string>(type: "text", nullable: true),
CityAndZipCode = table.Column<string>(type: "text", nullable: true),
SEQ = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_HappinessWeeks", x => x.Id);
table.ForeignKey(
name: "FK_HappinessWeeks_HappinessGroups_GroupId",
column: x => x.GroupId,
principalTable: "HappinessGroups",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "NewVisitors",
columns: table => new
{
Id = table.Column<string>(type: "text", nullable: false),
FirstName = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
LastName = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
Gender = table.Column<int>(type: "integer", nullable: false),
Address = table.Column<string>(type: "character varying(500)", maxLength: 500, nullable: true),
Phone = table.Column<string>(type: "character varying(150)", maxLength: 150, nullable: false),
Email = table.Column<string>(type: "character varying(150)", maxLength: 150, nullable: true),
ComunityAppId = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: true),
VisitingDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
BirthDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
Note = table.Column<string>(type: "text", nullable: true),
ReligionId = table.Column<int>(type: "integer", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_NewVisitors", x => x.Id);
table.ForeignKey(
name: "FK_NewVisitors_Religions_ReligionId",
column: x => x.ReligionId,
principalTable: "Religions",
principalColumn: "ReligionId");
});
migrationBuilder.CreateTable(
name: "FamilyMemberOAuths",
columns: table => new
{
FamilyMemberId = table.Column<string>(type: "text", nullable: false),
OAuthType = table.Column<string>(type: "text", nullable: false),
OAuthAccessToken = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_FamilyMemberOAuths", x => new { x.FamilyMemberId, x.OAuthType });
table.ForeignKey(
name: "FK_FamilyMemberOAuths_FamilyMembers_FamilyMemberId",
column: x => x.FamilyMemberId,
principalTable: "FamilyMembers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "PastoralDomains",
columns: table => new
{
PastoralDomainId = table.Column<string>(type: "text", nullable: false),
Name = table.Column<string>(type: "text", nullable: true),
Description = table.Column<string>(type: "text", nullable: true),
Image1 = table.Column<string>(type: "text", nullable: true),
Image2 = table.Column<string>(type: "text", nullable: true),
Image3 = table.Column<string>(type: "text", nullable: true),
Image4 = table.Column<string>(type: "text", nullable: true),
Image5 = table.Column<string>(type: "text", nullable: true),
LeaderMemberId = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_PastoralDomains", x => x.PastoralDomainId);
table.ForeignKey(
name: "FK_PastoralDomains_FamilyMembers_LeaderMemberId",
column: x => x.LeaderMemberId,
principalTable: "FamilyMembers",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "PastoralDomainMembers",
columns: table => new
{
PastoralDomainMembersId = table.Column<string>(type: "text", nullable: false),
PastoralDomainId = table.Column<string>(type: "text", nullable: true),
FamilyMemberId = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_PastoralDomainMembers", x => x.PastoralDomainMembersId);
table.ForeignKey(
name: "FK_PastoralDomainMembers_FamilyMembers_FamilyMemberId",
column: x => x.FamilyMemberId,
principalTable: "FamilyMembers",
principalColumn: "Id");
table.ForeignKey(
name: "FK_PastoralDomainMembers_PastoralDomains_PastoralDomainId",
column: x => x.PastoralDomainId,
principalTable: "PastoralDomains",
principalColumn: "PastoralDomainId");
});
migrationBuilder.CreateIndex(
name: "IX_FamilyMembers_CareerId",
table: "FamilyMembers",
column: "CareerId");
migrationBuilder.CreateIndex(
name: "IX_HappinessBESTs_GroupId",
table: "HappinessBESTs",
column: "GroupId");
migrationBuilder.CreateIndex(
name: "IX_HappinessWeeks_GroupId",
table: "HappinessWeeks",
column: "GroupId");
migrationBuilder.CreateIndex(
name: "IX_NewVisitors_ReligionId",
table: "NewVisitors",
column: "ReligionId");
migrationBuilder.CreateIndex(
name: "IX_PastoralDomainMembers_FamilyMemberId",
table: "PastoralDomainMembers",
column: "FamilyMemberId");
migrationBuilder.CreateIndex(
name: "IX_PastoralDomainMembers_PastoralDomainId",
table: "PastoralDomainMembers",
column: "PastoralDomainId");
migrationBuilder.CreateIndex(
name: "IX_PastoralDomains_LeaderMemberId",
table: "PastoralDomains",
column: "LeaderMemberId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "CellGroupRoutineEventAttendees");
migrationBuilder.DropTable(
name: "FamilyMemberOAuths");
migrationBuilder.DropTable(
name: "HappinessBESTs");
migrationBuilder.DropTable(
name: "HappinessWeeks");
migrationBuilder.DropTable(
name: "NewVisitors");
migrationBuilder.DropTable(
name: "PastoralDomainMembers");
migrationBuilder.DropTable(
name: "Vocabulary");
migrationBuilder.DropTable(
name: "WhoIsSpy");
migrationBuilder.DropTable(
name: "CellGroupRoutineEvents");
migrationBuilder.DropTable(
name: "HappinessGroups");
migrationBuilder.DropTable(
name: "Religions");
migrationBuilder.DropTable(
name: "PastoralDomains");
migrationBuilder.DropTable(
name: "FamilyMembers");
migrationBuilder.DropTable(
name: "Careers");
}
}
}