2019-06-17 01:58:32 +01:00
|
|
|
|
using Microsoft.EntityFrameworkCore.Metadata;
|
|
|
|
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Cicm.Database.Migrations
|
|
|
|
|
|
{
|
2019-06-17 02:07:45 +01:00
|
|
|
|
public partial class AddDocumentsByMachineFamily : Migration
|
2019-06-17 01:58:32 +01:00
|
|
|
|
{
|
|
|
|
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
|
|
|
|
{
|
2019-06-17 02:07:45 +01:00
|
|
|
|
migrationBuilder.CreateTable("DocumentsByMachineFamily",
|
2019-06-17 01:58:32 +01:00
|
|
|
|
table => new
|
|
|
|
|
|
{
|
|
|
|
|
|
Id = table.Column<long>()
|
|
|
|
|
|
.Annotation("MySql:ValueGenerationStrategy",
|
|
|
|
|
|
MySqlValueGenerationStrategy.IdentityColumn),
|
2019-06-17 02:07:45 +01:00
|
|
|
|
DocumentId = table.Column<long>(),
|
|
|
|
|
|
MachineFamilyId = table.Column<int>()
|
2019-06-17 01:58:32 +01:00
|
|
|
|
}, constraints: table =>
|
|
|
|
|
|
{
|
2019-06-17 02:07:45 +01:00
|
|
|
|
table.PrimaryKey("PK_DocumentsByMachineFamily", x => x.Id);
|
|
|
|
|
|
table.ForeignKey("FK_DocumentsByMachineFamily_Documents_DocumentId",
|
2019-06-17 01:58:32 +01:00
|
|
|
|
x => x.DocumentId, "Documents", "Id",
|
|
|
|
|
|
onDelete: ReferentialAction.Cascade);
|
2019-06-17 02:07:45 +01:00
|
|
|
|
table
|
|
|
|
|
|
.ForeignKey("FK_DocumentsByMachineFamily_machine_families_MachineFamilyId",
|
|
|
|
|
|
x => x.MachineFamilyId, "machine_families", "id",
|
|
|
|
|
|
onDelete: ReferentialAction.Cascade);
|
2019-06-17 01:58:32 +01:00
|
|
|
|
});
|
|
|
|
|
|
|
2019-06-17 02:07:45 +01:00
|
|
|
|
migrationBuilder.CreateIndex("IX_DocumentsByMachineFamily_DocumentId", "DocumentsByMachineFamily",
|
|
|
|
|
|
"DocumentId");
|
2019-06-17 01:58:32 +01:00
|
|
|
|
|
2019-06-17 02:07:45 +01:00
|
|
|
|
migrationBuilder.CreateIndex("IX_DocumentsByMachineFamily_MachineFamilyId", "DocumentsByMachineFamily",
|
|
|
|
|
|
"MachineFamilyId");
|
2019-06-17 01:58:32 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
|
|
|
|
{
|
2019-06-17 02:07:45 +01:00
|
|
|
|
migrationBuilder.DropTable("DocumentsByMachineFamily");
|
2019-06-17 01:58:32 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|