using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace UWLib.Migrations { /// public partial class Init : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Lectures", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false), Semester = table.Column(type: "TEXT", nullable: false), Title = table.Column(type: "TEXT", nullable: false), Url = table.Column(type: "TEXT", nullable: false), Description = table.Column(type: "TEXT", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Lectures", x => new { x.Id, x.Semester }); }); migrationBuilder.CreateTable( name: "LectureEvents", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), From = table.Column(type: "TEXT", nullable: false), To = table.Column(type: "TEXT", nullable: false), Location = table.Column(type: "TEXT", nullable: false), LectureId = table.Column(type: "INTEGER", nullable: false), LectureSemester = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_LectureEvents", x => x.Id); table.ForeignKey( name: "FK_LectureEvents_Lectures_LectureId_LectureSemester", columns: x => new { x.LectureId, x.LectureSemester }, principalTable: "Lectures", principalColumns: new[] { "Id", "Semester" }, onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_LectureEvents_LectureId_LectureSemester", table: "LectureEvents", columns: new[] { "LectureId", "LectureSemester" }); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "LectureEvents"); migrationBuilder.DropTable( name: "Lectures"); } } }