2019-06-02 03:29:43 +01:00
|
|
|
|
using System;
|
|
|
|
|
|
using Microsoft.EntityFrameworkCore.Metadata;
|
|
|
|
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
|
|
|
2020-02-10 02:10:18 +00:00
|
|
|
|
namespace Marechai.Database.Migrations
|
2019-06-02 03:29:43 +01:00
|
|
|
|
{
|
|
|
|
|
|
public partial class AddPerson : Migration
|
|
|
|
|
|
{
|
|
|
|
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
|
|
|
|
{
|
2020-02-10 22:44:18 +00:00
|
|
|
|
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);
|
|
|
|
|
|
});
|
2019-06-02 03:29:43 +01:00
|
|
|
|
|
|
|
|
|
|
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");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-02-10 22:44:18 +00:00
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder) => migrationBuilder.DropTable("People");
|
2019-06-02 03:29:43 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|