2019-06-17 03:02:47 +01:00
|
|
|
|
using Microsoft.EntityFrameworkCore.Metadata;
|
|
|
|
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
|
|
|
2020-02-10 02:10:18 +00:00
|
|
|
|
namespace Marechai.Database.Migrations
|
2019-06-17 03:02:47 +01:00
|
|
|
|
{
|
|
|
|
|
|
public partial class AddPeopleByBook : Migration
|
|
|
|
|
|
{
|
|
|
|
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
|
|
|
|
{
|
2020-02-10 22:44:18 +00:00
|
|
|
|
migrationBuilder.CreateTable("PeopleByBooks", table => new
|
|
|
|
|
|
{
|
|
|
|
|
|
Id = table.Column<long>().
|
|
|
|
|
|
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
2020-08-05 21:00:35 +01:00
|
|
|
|
PersonId = table.Column<int>(),
|
|
|
|
|
|
BookId = table.Column<long>(),
|
|
|
|
|
|
RoleId = table.Column<string>("char(3)")
|
2020-02-10 22:44:18 +00:00
|
|
|
|
}, constraints: table =>
|
|
|
|
|
|
{
|
|
|
|
|
|
table.PrimaryKey("PK_PeopleByBooks", x => x.Id);
|
|
|
|
|
|
|
|
|
|
|
|
table.ForeignKey("FK_PeopleByBooks_Books_BookId", x => x.BookId, "Books", "Id",
|
|
|
|
|
|
onDelete: ReferentialAction.Cascade);
|
|
|
|
|
|
|
|
|
|
|
|
table.ForeignKey("FK_PeopleByBooks_DocumentPeople_PersonId", x => x.PersonId, "DocumentPeople", "Id",
|
|
|
|
|
|
onDelete: ReferentialAction.Cascade);
|
|
|
|
|
|
|
|
|
|
|
|
table.ForeignKey("FK_PeopleByBooks_DocumentRoles_RoleId", x => x.RoleId, "DocumentRoles", "Id",
|
|
|
|
|
|
onDelete: ReferentialAction.Cascade);
|
|
|
|
|
|
});
|
2019-06-17 03:02:47 +01:00
|
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateIndex("IX_PeopleByBooks_BookId", "PeopleByBooks", "BookId");
|
|
|
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateIndex("IX_PeopleByBooks_PersonId", "PeopleByBooks", "PersonId");
|
|
|
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateIndex("IX_PeopleByBooks_RoleId", "PeopleByBooks", "RoleId");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-02-10 22:44:18 +00:00
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder) => migrationBuilder.DropTable("PeopleByBooks");
|
2019-06-17 03:02:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|