102 lines
4.6 KiB
C#
102 lines
4.6 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
namespace MP.FileData.Migrations
|
|
{
|
|
public partial class InitDb : Migration
|
|
{
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "Articoli",
|
|
columns: table => new
|
|
{
|
|
CodArticolo = table.Column<string>(type: "nvarchar(450)", nullable: false),
|
|
DescArticolo = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
Disegno = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
Tipo = table.Column<string>(type: "nvarchar(max)", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Articoli", x => x.CodArticolo);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Macchine",
|
|
columns: table => new
|
|
{
|
|
IdxMacchina = table.Column<string>(type: "nvarchar(450)", nullable: false),
|
|
CodMacchina = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
Nome = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
Descrizione = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
BasePath = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
ImgUrl = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
Note = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
ShowOrder = table.Column<int>(type: "int", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Macchine", x => x.IdxMacchina);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Files",
|
|
columns: table => new
|
|
{
|
|
FileId = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
Active = table.Column<bool>(type: "bit", nullable: false),
|
|
CodArticolo = table.Column<string>(type: "nvarchar(450)", nullable: true),
|
|
IdxMacchina = table.Column<string>(type: "nvarchar(450)", nullable: true),
|
|
Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
Rev = table.Column<int>(type: "int", nullable: false),
|
|
LastMod = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
Size = table.Column<int>(type: "int", nullable: false),
|
|
Path = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
MimeType = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
Changed = table.Column<bool>(type: "bit", nullable: false),
|
|
LastCheck = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
FileContent = table.Column<byte[]>(type: "varbinary(max)", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Files", x => x.FileId);
|
|
table.ForeignKey(
|
|
name: "FK_Files_Articoli_CodArticolo",
|
|
column: x => x.CodArticolo,
|
|
principalTable: "Articoli",
|
|
principalColumn: "CodArticolo",
|
|
onDelete: ReferentialAction.Restrict);
|
|
table.ForeignKey(
|
|
name: "FK_Files_Macchine_IdxMacchina",
|
|
column: x => x.IdxMacchina,
|
|
principalTable: "Macchine",
|
|
principalColumn: "IdxMacchina",
|
|
onDelete: ReferentialAction.Restrict);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Files_CodArticolo",
|
|
table: "Files",
|
|
column: "CodArticolo");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Files_IdxMacchina",
|
|
table: "Files",
|
|
column: "IdxMacchina");
|
|
}
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "Files");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Articoli");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Macchine");
|
|
}
|
|
}
|
|
}
|