using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace JobTrackerApi.Migrations { /// public partial class AddAttachmentsAndJobEvents : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Attachments", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), JobApplicationId = table.Column(type: "INTEGER", nullable: false), FileName = table.Column(type: "TEXT", nullable: false), FilePath = table.Column(type: "TEXT", nullable: false), UploadDate = table.Column(type: "TEXT", nullable: false), FileType = table.Column(type: "TEXT", nullable: false), FileSize = table.Column(type: "INTEGER", nullable: false, defaultValue: 0L) }, constraints: table => { table.PrimaryKey("PK_Attachments", x => x.Id); table.ForeignKey( name: "FK_Attachments_JobApplications_JobApplicationId", column: x => x.JobApplicationId, principalTable: "JobApplications", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_Attachments_JobApplicationId", table: "Attachments", column: "JobApplicationId"); migrationBuilder.CreateTable( name: "JobEvents", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), JobApplicationId = table.Column(type: "INTEGER", nullable: false), Type = table.Column(type: "TEXT", nullable: false), OldValue = table.Column(type: "TEXT", nullable: true), NewValue = table.Column(type: "TEXT", nullable: true), Note = table.Column(type: "TEXT", nullable: true), At = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_JobEvents", x => x.Id); table.ForeignKey( name: "FK_JobEvents_JobApplications_JobApplicationId", column: x => x.JobApplicationId, principalTable: "JobApplications", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_JobEvents_JobApplicationId", table: "JobEvents", column: "JobApplicationId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable(name: "JobEvents"); migrationBuilder.DropTable(name: "Attachments"); } } }