using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace timetracker.Data.Migrations { /// public partial class Initial : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "AppSettings", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), DailyTargetHours = table.Column(type: "REAL", nullable: false), MinimumBreakMinutes = table.Column(type: "INTEGER", nullable: false), VacationDaysPerYear = table.Column(type: "INTEGER", nullable: false), WorkMonday = table.Column(type: "INTEGER", nullable: false), WorkTuesday = table.Column(type: "INTEGER", nullable: false), WorkWednesday = table.Column(type: "INTEGER", nullable: false), WorkThursday = table.Column(type: "INTEGER", nullable: false), WorkFriday = table.Column(type: "INTEGER", nullable: false), WorkSaturday = table.Column(type: "INTEGER", nullable: false), WorkSunday = table.Column(type: "INTEGER", nullable: false) }, constraints: table => { table.PrimaryKey("PK_AppSettings", x => x.Id); }); migrationBuilder.CreateTable( name: "VacationDays", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), Date = table.Column(type: "TEXT", nullable: false), Note = table.Column(type: "TEXT", nullable: true) }, constraints: table => { table.PrimaryKey("PK_VacationDays", x => x.Id); }); migrationBuilder.CreateTable( name: "WorkDays", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), Date = table.Column(type: "TEXT", nullable: false), StartTime = table.Column(type: "TEXT", nullable: true), EndTime = table.Column(type: "TEXT", nullable: true) }, constraints: table => { table.PrimaryKey("PK_WorkDays", x => x.Id); }); migrationBuilder.CreateTable( name: "BreakEntries", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), WorkDayId = table.Column(type: "INTEGER", nullable: false), StartTime = table.Column(type: "TEXT", nullable: true), EndTime = table.Column(type: "TEXT", nullable: true) }, constraints: table => { table.PrimaryKey("PK_BreakEntries", x => x.Id); table.ForeignKey( name: "FK_BreakEntries_WorkDays_WorkDayId", column: x => x.WorkDayId, principalTable: "WorkDays", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_BreakEntries_WorkDayId", table: "BreakEntries", column: "WorkDayId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "AppSettings"); migrationBuilder.DropTable( name: "BreakEntries"); migrationBuilder.DropTable( name: "VacationDays"); migrationBuilder.DropTable( name: "WorkDays"); } } }