Files
marechai/Cicm.Database/Migrations/20190602021943_AddPerson.cs
2019-06-02 03:29:43 +01:00

58 lines
3.0 KiB
C#

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<int>()
.Annotation("MySql:ValueGenerationStrategy",
MySqlValueGenerationStrategy.IdentityColumn),
Name = table.Column<string>(),
Surname = table.Column<string>(),
BirthDate = table.Column<DateTime>(),
DeathDate = table.Column<DateTime>(nullable: true),
Webpage = table.Column<string>(nullable: true),
Twitter = table.Column<string>(nullable: true),
Facebook = table.Column<string>(nullable: true),
Photo = table.Column<Guid>(),
CountryOfBirthId = table.Column<short>(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");
}
}
}