mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
35 lines
1.5 KiB
C#
35 lines
1.5 KiB
C#
using Microsoft.EntityFrameworkCore.Metadata;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
namespace Marechai.Database.Migrations
|
|
{
|
|
public partial class AddDocumentsByMachine : Migration
|
|
{
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable("DocumentsByMachines", table => new
|
|
{
|
|
Id = table.Column<long>().
|
|
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
DocumentId = table.Column<long>(),
|
|
MachineId = table.Column<int>()
|
|
}, 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);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex("IX_DocumentsByMachines_DocumentId", "DocumentsByMachines", "DocumentId");
|
|
|
|
migrationBuilder.CreateIndex("IX_DocumentsByMachines_MachineId", "DocumentsByMachines", "MachineId");
|
|
}
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder) =>
|
|
migrationBuilder.DropTable("DocumentsByMachines");
|
|
}
|
|
} |