219 lines
9.5 KiB
C#
219 lines
9.5 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace PARR.DAL.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AllTbls : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "Hosts",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
|
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
|
|
HostName = table.Column<string>(type: "text", nullable: false),
|
|
IP = table.Column<string>(type: "text", nullable: false),
|
|
EK = table.Column<string>(type: "text", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Hosts", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "JobCategories",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
|
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
|
|
Name = table.Column<string>(type: "text", nullable: false),
|
|
Description = table.Column<string>(type: "text", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_JobCategories", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "JobModes",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
|
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
|
|
Name = table.Column<string>(type: "text", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_JobModes", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "JobStatuses",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
|
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
|
|
Name = table.Column<string>(type: "text", nullable: false),
|
|
Description = table.Column<string>(type: "text", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_JobStatuses", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "JobTypes",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
|
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
|
|
Name = table.Column<string>(type: "text", nullable: false),
|
|
Description = table.Column<string>(type: "text", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_JobTypes", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Jobs",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
|
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
|
|
Name = table.Column<string>(type: "text", nullable: false),
|
|
JobModeId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
JobCategoryId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
JobTypeId = table.Column<Guid>(type: "uuid", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Jobs", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_Jobs_JobCategories_JobCategoryId",
|
|
column: x => x.JobCategoryId,
|
|
principalTable: "JobCategories",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_Jobs_JobModes_JobModeId",
|
|
column: x => x.JobModeId,
|
|
principalTable: "JobModes",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_Jobs_JobTypes_JobTypeId",
|
|
column: x => x.JobTypeId,
|
|
principalTable: "JobTypes",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "JobJournals",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
|
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
|
|
DateOper = table.Column<string>(type: "text", nullable: true),
|
|
Other = table.Column<string>(type: "text", nullable: true),
|
|
TimeOut = table.Column<int>(type: "integer", nullable: true),
|
|
Info = table.Column<string>(type: "text", nullable: true),
|
|
JobStatusId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
HostId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
JobId = table.Column<Guid>(type: "uuid", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_JobJournals", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_JobJournals_Hosts_HostId",
|
|
column: x => x.HostId,
|
|
principalTable: "Hosts",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_JobJournals_JobStatuses_JobStatusId",
|
|
column: x => x.JobStatusId,
|
|
principalTable: "JobStatuses",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_JobJournals_Jobs_JobId",
|
|
column: x => x.JobId,
|
|
principalTable: "Jobs",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_JobJournals_HostId",
|
|
table: "JobJournals",
|
|
column: "HostId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_JobJournals_JobId",
|
|
table: "JobJournals",
|
|
column: "JobId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_JobJournals_JobStatusId",
|
|
table: "JobJournals",
|
|
column: "JobStatusId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Jobs_JobCategoryId",
|
|
table: "Jobs",
|
|
column: "JobCategoryId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Jobs_JobModeId",
|
|
table: "Jobs",
|
|
column: "JobModeId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Jobs_JobTypeId",
|
|
table: "Jobs",
|
|
column: "JobTypeId");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "JobJournals");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Hosts");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "JobStatuses");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Jobs");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "JobCategories");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "JobModes");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "JobTypes");
|
|
}
|
|
}
|
|
}
|