Initial
This commit is contained in:
		
							
								
								
									
										181
									
								
								Repositories/Migrations/20210706081036_v1.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										181
									
								
								Repositories/Migrations/20210706081036_v1.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,181 @@ | ||||
| using System; | ||||
| using Microsoft.EntityFrameworkCore.Metadata; | ||||
| using Microsoft.EntityFrameworkCore.Migrations; | ||||
|  | ||||
| namespace Repositories.Migrations | ||||
| { | ||||
|     public partial class v1 : Migration | ||||
|     { | ||||
|         protected override void Up(MigrationBuilder migrationBuilder) | ||||
|         { | ||||
|             migrationBuilder.CreateTable( | ||||
|                 name: "LookupCategories", | ||||
|                 columns: table => new | ||||
|                 { | ||||
|                     Id = table.Column<long>(nullable: false) | ||||
|                         .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), | ||||
|                     CategoryName = table.Column<string>(nullable: true), | ||||
|                     IsActive = table.Column<bool>(nullable: false) | ||||
|                 }, | ||||
|                 constraints: table => | ||||
|                 { | ||||
|                     table.PrimaryKey("PK_LookupCategories", x => x.Id); | ||||
|                 }); | ||||
|  | ||||
|             migrationBuilder.CreateTable( | ||||
|                 name: "LookupValues", | ||||
|                 columns: table => new | ||||
|                 { | ||||
|                     Id = table.Column<long>(nullable: false) | ||||
|                         .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), | ||||
|                     Value = table.Column<string>(nullable: true), | ||||
|                     IsActive = table.Column<bool>(nullable: false), | ||||
|                     LookupCategoryId = table.Column<long>(nullable: true) | ||||
|                 }, | ||||
|                 constraints: table => | ||||
|                 { | ||||
|                     table.PrimaryKey("PK_LookupValues", x => x.Id); | ||||
|                     table.ForeignKey( | ||||
|                         name: "FK_LookupValues_LookupCategories_LookupCategoryId", | ||||
|                         column: x => x.LookupCategoryId, | ||||
|                         principalTable: "LookupCategories", | ||||
|                         principalColumn: "Id", | ||||
|                         onDelete: ReferentialAction.Restrict); | ||||
|                 }); | ||||
|  | ||||
|             migrationBuilder.CreateTable( | ||||
|                 name: "Person", | ||||
|                 columns: table => new | ||||
|                 { | ||||
|                     Id = table.Column<long>(nullable: false) | ||||
|                         .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), | ||||
|                     LastName = table.Column<string>(nullable: true), | ||||
|                     FirstName = table.Column<string>(nullable: true), | ||||
|                     Birthday = table.Column<DateTime>(nullable: true), | ||||
|                     IsActive = table.Column<bool>(nullable: false), | ||||
|                     CreatedAt = table.Column<DateTime>(nullable: false), | ||||
|                     ChangedAt = table.Column<DateTime>(nullable: false), | ||||
|                     GenderId = table.Column<long>(nullable: true) | ||||
|                 }, | ||||
|                 constraints: table => | ||||
|                 { | ||||
|                     table.PrimaryKey("PK_Person", x => x.Id); | ||||
|                     table.ForeignKey( | ||||
|                         name: "FK_Person_LookupValues_GenderId", | ||||
|                         column: x => x.GenderId, | ||||
|                         principalTable: "LookupValues", | ||||
|                         principalColumn: "Id", | ||||
|                         onDelete: ReferentialAction.Restrict); | ||||
|                 }); | ||||
|  | ||||
|             migrationBuilder.CreateTable( | ||||
|                 name: "Address", | ||||
|                 columns: table => new | ||||
|                 { | ||||
|                     Id = table.Column<long>(nullable: false) | ||||
|                         .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), | ||||
|                     StreetName = table.Column<string>(nullable: true), | ||||
|                     StreetNumber = table.Column<int>(nullable: false), | ||||
|                     Zip = table.Column<string>(nullable: true), | ||||
|                     City = table.Column<string>(nullable: true), | ||||
|                     CreatedAt = table.Column<DateTime>(nullable: false), | ||||
|                     ChangedAt = table.Column<DateTime>(nullable: false), | ||||
|                     AddressTypeId = table.Column<long>(nullable: true), | ||||
|                     PersonId = table.Column<long>(nullable: true) | ||||
|                 }, | ||||
|                 constraints: table => | ||||
|                 { | ||||
|                     table.PrimaryKey("PK_Address", x => x.Id); | ||||
|                     table.ForeignKey( | ||||
|                         name: "FK_Address_LookupValues_AddressTypeId", | ||||
|                         column: x => x.AddressTypeId, | ||||
|                         principalTable: "LookupValues", | ||||
|                         principalColumn: "Id", | ||||
|                         onDelete: ReferentialAction.Restrict); | ||||
|                     table.ForeignKey( | ||||
|                         name: "FK_Address_Person_PersonId", | ||||
|                         column: x => x.PersonId, | ||||
|                         principalTable: "Person", | ||||
|                         principalColumn: "Id", | ||||
|                         onDelete: ReferentialAction.Restrict); | ||||
|                 }); | ||||
|  | ||||
|             migrationBuilder.CreateTable( | ||||
|                 name: "Communication", | ||||
|                 columns: table => new | ||||
|                 { | ||||
|                     Id = table.Column<long>(nullable: false) | ||||
|                         .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), | ||||
|                     CommunicationValue = table.Column<string>(nullable: true), | ||||
|                     CommunicationTypeId = table.Column<long>(nullable: true), | ||||
|                     CreatedAt = table.Column<DateTime>(nullable: false), | ||||
|                     ChangedAt = table.Column<DateTime>(nullable: false), | ||||
|                     PersonId = table.Column<long>(nullable: true) | ||||
|                 }, | ||||
|                 constraints: table => | ||||
|                 { | ||||
|                     table.PrimaryKey("PK_Communication", x => x.Id); | ||||
|                     table.ForeignKey( | ||||
|                         name: "FK_Communication_LookupValues_CommunicationTypeId", | ||||
|                         column: x => x.CommunicationTypeId, | ||||
|                         principalTable: "LookupValues", | ||||
|                         principalColumn: "Id", | ||||
|                         onDelete: ReferentialAction.Restrict); | ||||
|                     table.ForeignKey( | ||||
|                         name: "FK_Communication_Person_PersonId", | ||||
|                         column: x => x.PersonId, | ||||
|                         principalTable: "Person", | ||||
|                         principalColumn: "Id", | ||||
|                         onDelete: ReferentialAction.Restrict); | ||||
|                 }); | ||||
|  | ||||
|             migrationBuilder.CreateIndex( | ||||
|                 name: "IX_Address_AddressTypeId", | ||||
|                 table: "Address", | ||||
|                 column: "AddressTypeId"); | ||||
|  | ||||
|             migrationBuilder.CreateIndex( | ||||
|                 name: "IX_Address_PersonId", | ||||
|                 table: "Address", | ||||
|                 column: "PersonId"); | ||||
|  | ||||
|             migrationBuilder.CreateIndex( | ||||
|                 name: "IX_Communication_CommunicationTypeId", | ||||
|                 table: "Communication", | ||||
|                 column: "CommunicationTypeId"); | ||||
|  | ||||
|             migrationBuilder.CreateIndex( | ||||
|                 name: "IX_Communication_PersonId", | ||||
|                 table: "Communication", | ||||
|                 column: "PersonId"); | ||||
|  | ||||
|             migrationBuilder.CreateIndex( | ||||
|                 name: "IX_LookupValues_LookupCategoryId", | ||||
|                 table: "LookupValues", | ||||
|                 column: "LookupCategoryId"); | ||||
|  | ||||
|             migrationBuilder.CreateIndex( | ||||
|                 name: "IX_Person_GenderId", | ||||
|                 table: "Person", | ||||
|                 column: "GenderId"); | ||||
|         } | ||||
|  | ||||
|         protected override void Down(MigrationBuilder migrationBuilder) | ||||
|         { | ||||
|             migrationBuilder.DropTable( | ||||
|                 name: "Address"); | ||||
|  | ||||
|             migrationBuilder.DropTable( | ||||
|                 name: "Communication"); | ||||
|  | ||||
|             migrationBuilder.DropTable( | ||||
|                 name: "Person"); | ||||
|  | ||||
|             migrationBuilder.DropTable( | ||||
|                 name: "LookupValues"); | ||||
|  | ||||
|             migrationBuilder.DropTable( | ||||
|                 name: "LookupCategories"); | ||||
|         } | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user