2019-06-05 15:32:17 +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-05 15:32:17 +01:00
|
|
|
|
{
|
|
|
|
|
|
public partial class AddPeopleByCompany : Migration
|
|
|
|
|
|
{
|
|
|
|
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
|
|
|
|
{
|
2020-02-10 22:44:18 +00:00
|
|
|
|
migrationBuilder.CreateTable("PeopleByCompany", table => new
|
|
|
|
|
|
{
|
|
|
|
|
|
Id = table.Column<long>().
|
|
|
|
|
|
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
2020-08-05 21:00:35 +01:00
|
|
|
|
PersonId = table.Column<int>(),
|
|
|
|
|
|
CompanyId = table.Column<int>(),
|
|
|
|
|
|
Position = table.Column<string>(nullable: true),
|
|
|
|
|
|
Start = table.Column<DateTime>(nullable: true),
|
|
|
|
|
|
End = table.Column<DateTime>(nullable: true),
|
|
|
|
|
|
Ongoing = table.Column<bool>()
|
2020-02-10 22:44:18 +00:00
|
|
|
|
}, constraints: table =>
|
|
|
|
|
|
{
|
|
|
|
|
|
table.PrimaryKey("PK_PeopleByCompany", x => x.Id);
|
2019-06-05 15:32:17 +01:00
|
|
|
|
|
2020-02-10 22:44:18 +00:00
|
|
|
|
table.ForeignKey("FK_PeopleByCompany_companies_CompanyId", x => x.CompanyId, "companies", "id",
|
|
|
|
|
|
onDelete: ReferentialAction.Cascade);
|
2019-06-05 15:32:17 +01:00
|
|
|
|
|
2020-02-10 22:44:18 +00:00
|
|
|
|
table.ForeignKey("FK_PeopleByCompany_People_PersonId", x => x.PersonId, "People", "Id",
|
|
|
|
|
|
onDelete: ReferentialAction.Cascade);
|
|
|
|
|
|
});
|
2019-06-05 15:32:17 +01:00
|
|
|
|
|
2020-02-10 22:44:18 +00:00
|
|
|
|
migrationBuilder.CreateIndex("IX_PeopleByCompany_CompanyId", "PeopleByCompany", "CompanyId");
|
2019-06-05 15:32:17 +01:00
|
|
|
|
|
2020-02-10 22:44:18 +00:00
|
|
|
|
migrationBuilder.CreateIndex("IX_PeopleByCompany_End", "PeopleByCompany", "End");
|
2019-06-05 15:32:17 +01:00
|
|
|
|
|
2020-02-10 22:44:18 +00:00
|
|
|
|
migrationBuilder.CreateIndex("IX_PeopleByCompany_PersonId", "PeopleByCompany", "PersonId");
|
2019-06-05 15:32:17 +01:00
|
|
|
|
|
2020-02-10 22:44:18 +00:00
|
|
|
|
migrationBuilder.CreateIndex("IX_PeopleByCompany_Position", "PeopleByCompany", "Position");
|
|
|
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateIndex("IX_PeopleByCompany_Start", "PeopleByCompany", "Start");
|
2019-06-05 15:32:17 +01:00
|
|
|
|
}
|
2020-02-10 22:44:18 +00:00
|
|
|
|
|
|
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder) =>
|
|
|
|
|
|
migrationBuilder.DropTable("PeopleByCompany");
|
2019-06-05 15:32:17 +01:00
|
|
|
|
}
|
2020-02-10 22:44:18 +00:00
|
|
|
|
}
|