using System; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; namespace Cicm.Database.Migrations { public partial class AddPerson : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable("People", table => new { Id = table.Column() .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), Name = table.Column(), Surname = table.Column(), BirthDate = table.Column(), DeathDate = table.Column(nullable: true), Webpage = table.Column(nullable: true), Twitter = table.Column(nullable: true), Facebook = table.Column(nullable: true), Photo = table.Column(), CountryOfBirthId = table.Column(nullable: true) }, constraints: table => { table.PrimaryKey("PK_People", x => x.Id); table.ForeignKey("FK_People_iso3166_1_numeric_CountryOfBirthId", x => x.CountryOfBirthId, "iso3166_1_numeric", "id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateIndex("IX_People_BirthDate", "People", "BirthDate"); migrationBuilder.CreateIndex("IX_People_CountryOfBirthId", "People", "CountryOfBirthId"); migrationBuilder.CreateIndex("IX_People_DeathDate", "People", "DeathDate"); migrationBuilder.CreateIndex("IX_People_Facebook", "People", "Facebook"); migrationBuilder.CreateIndex("IX_People_Name", "People", "Name"); migrationBuilder.CreateIndex("IX_People_Photo", "People", "Photo"); migrationBuilder.CreateIndex("IX_People_Surname", "People", "Surname"); migrationBuilder.CreateIndex("IX_People_Twitter", "People", "Twitter"); migrationBuilder.CreateIndex("IX_People_Webpage", "People", "Webpage"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable("People"); } } }