using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace PARR.DAL.Migrations { /// public partial class AllTbls : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Hosts", columns: table => new { Id = table.Column(type: "uuid", nullable: false), DateCreated = table.Column(type: "timestamp with time zone", nullable: false), DateModified = table.Column(type: "timestamp with time zone", nullable: true), HostName = table.Column(type: "text", nullable: false), IP = table.Column(type: "text", nullable: false), EK = table.Column(type: "text", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Hosts", x => x.Id); }); migrationBuilder.CreateTable( name: "JobCategories", columns: table => new { Id = table.Column(type: "uuid", nullable: false), DateCreated = table.Column(type: "timestamp with time zone", nullable: false), DateModified = table.Column(type: "timestamp with time zone", nullable: true), Name = table.Column(type: "text", nullable: false), Description = table.Column(type: "text", nullable: true) }, constraints: table => { table.PrimaryKey("PK_JobCategories", x => x.Id); }); migrationBuilder.CreateTable( name: "JobModes", columns: table => new { Id = table.Column(type: "uuid", nullable: false), DateCreated = table.Column(type: "timestamp with time zone", nullable: false), DateModified = table.Column(type: "timestamp with time zone", nullable: true), Name = table.Column(type: "text", nullable: false) }, constraints: table => { table.PrimaryKey("PK_JobModes", x => x.Id); }); migrationBuilder.CreateTable( name: "JobStatuses", columns: table => new { Id = table.Column(type: "uuid", nullable: false), DateCreated = table.Column(type: "timestamp with time zone", nullable: false), DateModified = table.Column(type: "timestamp with time zone", nullable: true), Name = table.Column(type: "text", nullable: false), Description = table.Column(type: "text", nullable: true) }, constraints: table => { table.PrimaryKey("PK_JobStatuses", x => x.Id); }); migrationBuilder.CreateTable( name: "JobTypes", columns: table => new { Id = table.Column(type: "uuid", nullable: false), DateCreated = table.Column(type: "timestamp with time zone", nullable: false), DateModified = table.Column(type: "timestamp with time zone", nullable: true), Name = table.Column(type: "text", nullable: false), Description = table.Column(type: "text", nullable: true) }, constraints: table => { table.PrimaryKey("PK_JobTypes", x => x.Id); }); migrationBuilder.CreateTable( name: "Jobs", columns: table => new { Id = table.Column(type: "uuid", nullable: false), DateCreated = table.Column(type: "timestamp with time zone", nullable: false), DateModified = table.Column(type: "timestamp with time zone", nullable: true), Name = table.Column(type: "text", nullable: false), JobModeId = table.Column(type: "uuid", nullable: false), JobCategoryId = table.Column(type: "uuid", nullable: false), JobTypeId = table.Column(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(type: "uuid", nullable: false), DateCreated = table.Column(type: "timestamp with time zone", nullable: false), DateModified = table.Column(type: "timestamp with time zone", nullable: true), DateOper = table.Column(type: "text", nullable: true), Other = table.Column(type: "text", nullable: true), TimeOut = table.Column(type: "integer", nullable: true), Info = table.Column(type: "text", nullable: true), JobStatusId = table.Column(type: "uuid", nullable: false), HostId = table.Column(type: "uuid", nullable: false), JobId = table.Column(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"); } /// 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"); } } }