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(type: "text", nullable: false), Name = table.Column(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(type: "text", nullable: false), Time = table.Column(type: "timestamp with time zone", nullable: false), Address = table.Column(type: "text", nullable: true) }, constraints: table => { table.PrimaryKey("PK_CellGroupRoutineEvents", x => x.Id); }); migrationBuilder.CreateTable( name: "HappinessGroups", columns: table => new { Id = table.Column(type: "text", nullable: false), Name = table.Column(type: "text", nullable: true), BeginTime = table.Column(type: "timestamp with time zone", nullable: false), Address = table.Column(type: "text", nullable: true), CityAndZipCode = table.Column(type: "text", nullable: true), InvitationText = table.Column(type: "text", nullable: true) }, constraints: table => { table.PrimaryKey("PK_HappinessGroups", x => x.Id); }); migrationBuilder.CreateTable( name: "Religions", columns: table => new { ReligionId = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Name = table.Column(type: "text", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Religions", x => x.ReligionId); }); migrationBuilder.CreateTable( name: "Vocabulary", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Word = table.Column(type: "text", nullable: false), DefinitionEn = table.Column(type: "text", nullable: false), DefinitionCh = table.Column(type: "text", nullable: false), NounPlural = table.Column(type: "text", nullable: true), VerbPast = table.Column(type: "text", nullable: true), VerbParticiple = table.Column(type: "text", nullable: true), PartOfSpeech = table.Column(type: "integer", nullable: false), ImagesUrl = table.Column(type: "text", nullable: true), InsertDate = table.Column(type: "timestamp with time zone", nullable: false), PracticeDate = table.Column(type: "timestamp with time zone", nullable: false), PracticeStage = table.Column(type: "integer", nullable: false), PracticeSelect = table.Column(type: "boolean", nullable: false), PracticeMemorized = table.Column(type: "boolean", nullable: false), PracticeVisualize = table.Column(type: "boolean", nullable: false), PracticeApply = table.Column(type: "boolean", nullable: false), PracticeReview = table.Column(type: "boolean", nullable: false), PracticeSentence = table.Column(type: "text", nullable: true), FlashCardTimes = table.Column(type: "integer", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Vocabulary", x => x.Id); }); migrationBuilder.CreateTable( name: "WhoIsSpy", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Answer1Cht = table.Column(type: "text", nullable: true), Answer1Chs = table.Column(type: "text", nullable: true), Answer1En = table.Column(type: "text", nullable: true), Answer2Cht = table.Column(type: "text", nullable: true), Answer2Chs = table.Column(type: "text", nullable: true), Answer2En = table.Column(type: "text", nullable: true) }, constraints: table => { table.PrimaryKey("PK_WhoIsSpy", x => x.Id); }); migrationBuilder.CreateTable( name: "FamilyMembers", columns: table => new { Id = table.Column(type: "text", nullable: false), Email = table.Column(type: "text", nullable: false), Password = table.Column(type: "text", nullable: false), AvatarImage = table.Column(type: "text", nullable: true), FirstName = table.Column(type: "character varying(50)", maxLength: 50, nullable: true), LastName = table.Column(type: "character varying(50)", maxLength: 50, nullable: true), Gender = table.Column(type: "integer", nullable: false), Birthday = table.Column(type: "timestamp with time zone", nullable: false), Married = table.Column(type: "boolean", nullable: false), DateOfBaptized = table.Column(type: "timestamp with time zone", nullable: true), DateOfWalkIn = table.Column(type: "timestamp with time zone", nullable: false), Address = table.Column(type: "character varying(500)", maxLength: 500, nullable: true), ComunityAppId = table.Column(type: "character varying(50)", maxLength: 50, nullable: true), CareerId = table.Column(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(type: "text", nullable: false), Id = table.Column(type: "text", nullable: false), Name = table.Column(type: "text", nullable: true), JoinPotluck = table.Column(type: "boolean", nullable: false), PotluckItem = table.Column(type: "text", nullable: true), Comment = table.Column(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(type: "text", nullable: false), GroupId = table.Column(type: "text", nullable: true), Name = table.Column(type: "text", nullable: false), Email = table.Column(type: "text", nullable: true), Phone = table.Column(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(type: "text", nullable: false), GroupId = table.Column(type: "text", nullable: true), Date = table.Column(type: "timestamp with time zone", nullable: false), InvitationText = table.Column(type: "text", nullable: true), Address = table.Column(type: "text", nullable: true), CityAndZipCode = table.Column(type: "text", nullable: true), SEQ = table.Column(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(type: "text", nullable: false), FirstName = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), LastName = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), Gender = table.Column(type: "integer", nullable: false), Address = table.Column(type: "character varying(500)", maxLength: 500, nullable: true), Phone = table.Column(type: "character varying(150)", maxLength: 150, nullable: false), Email = table.Column(type: "character varying(150)", maxLength: 150, nullable: true), ComunityAppId = table.Column(type: "character varying(50)", maxLength: 50, nullable: true), VisitingDate = table.Column(type: "timestamp with time zone", nullable: false), BirthDate = table.Column(type: "timestamp with time zone", nullable: true), Note = table.Column(type: "text", nullable: true), ReligionId = table.Column(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(type: "text", nullable: false), OAuthType = table.Column(type: "text", nullable: false), OAuthAccessToken = table.Column(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(type: "text", nullable: false), Name = table.Column(type: "text", nullable: true), Description = table.Column(type: "text", nullable: true), Image1 = table.Column(type: "text", nullable: true), Image2 = table.Column(type: "text", nullable: true), Image3 = table.Column(type: "text", nullable: true), Image4 = table.Column(type: "text", nullable: true), Image5 = table.Column(type: "text", nullable: true), LeaderMemberId = table.Column(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(type: "text", nullable: false), PastoralDomainId = table.Column(type: "text", nullable: true), FamilyMemberId = table.Column(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"); } } }