2019-06-17 01:58:32 +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 01:58:32 +01:00
|
|
|
|
{
|
2019-06-17 02:07:45 +01:00
|
|
|
|
public partial class AddDocumentsByMachine : Migration
|
2019-06-17 01:58:32 +01:00
|
|
|
|
{
|
|
|
|
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
|
|
|
|
{
|
2020-02-10 22:44:18 +00:00
|
|
|
|
migrationBuilder.CreateTable("DocumentsByMachines", table => new
|
|
|
|
|
|
{
|
|
|
|
|
|
Id = table.Column<long>().
|
|
|
|
|
|
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
2020-08-05 21:00:35 +01:00
|
|
|
|
DocumentId = table.Column<long>(),
|
|
|
|
|
|
MachineId = table.Column<int>()
|
2020-02-10 22:44:18 +00:00
|
|
|
|
}, constraints: table =>
|
|
|
|
|
|
{
|
|
|
|
|
|
table.PrimaryKey("PK_DocumentsByMachines", x => x.Id);
|
|
|
|
|
|
|
|
|
|
|
|
table.ForeignKey("FK_DocumentsByMachines_Documents_DocumentId", x => x.DocumentId, "Documents", "Id",
|
|
|
|
|
|
onDelete: ReferentialAction.Cascade);
|
|
|
|
|
|
|
|
|
|
|
|
table.ForeignKey("FK_DocumentsByMachines_machines_MachineId", x => x.MachineId, "machines", "id",
|
|
|
|
|
|
onDelete: ReferentialAction.Cascade);
|
|
|
|
|
|
});
|
2019-06-17 01:58:32 +01:00
|
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateIndex("IX_DocumentsByMachines_DocumentId", "DocumentsByMachines", "DocumentId");
|
|
|
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateIndex("IX_DocumentsByMachines_MachineId", "DocumentsByMachines", "MachineId");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-02-10 22:44:18 +00:00
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder) =>
|
2019-06-17 01:58:32 +01:00
|
|
|
|
migrationBuilder.DropTable("DocumentsByMachines");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|