using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace JobTrackerApi.Migrations { /// public partial class AddCorrespondence : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Companies", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), Name = table.Column(type: "TEXT", nullable: false), Location = table.Column(type: "TEXT", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Companies", x => x.Id); }); migrationBuilder.CreateTable( name: "JobApplications", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), CompanyId = table.Column(type: "INTEGER", nullable: false), JobTitle = table.Column(type: "TEXT", nullable: false), DateApplied = table.Column(type: "TEXT", nullable: false), Status = table.Column(type: "TEXT", nullable: false, defaultValue: "Applied"), ResponseReceived = table.Column(type: "INTEGER", nullable: false), ResponseDate = table.Column(type: "TEXT", nullable: true), Notes = table.Column(type: "TEXT", nullable: true), CoverLetterText = table.Column(type: "TEXT", nullable: true), JobUrl = table.Column(type: "TEXT", nullable: true) }, constraints: table => { table.PrimaryKey("PK_JobApplications", x => x.Id); table.ForeignKey( name: "FK_JobApplications_Companies_CompanyId", column: x => x.CompanyId, principalTable: "Companies", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "Correspondences", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), JobApplicationId = table.Column(type: "INTEGER", nullable: false), Date = table.Column(type: "TEXT", nullable: false), From = table.Column(type: "TEXT", nullable: false), Content = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Correspondences", x => x.Id); table.ForeignKey( name: "FK_Correspondences_JobApplications_JobApplicationId", column: x => x.JobApplicationId, principalTable: "JobApplications", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_Correspondences_JobApplicationId", table: "Correspondences", column: "JobApplicationId"); migrationBuilder.CreateIndex( name: "IX_JobApplications_CompanyId", table: "JobApplications", column: "CompanyId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Correspondences"); migrationBuilder.DropTable( name: "JobApplications"); migrationBuilder.DropTable( name: "Companies"); } } }