20251109085302_PreCheckIns.cs
1 using System; 2 using Microsoft.EntityFrameworkCore.Migrations; 3 4 #nullable disable 5 6 namespace _5uhr.Migrations 7 { 8 /// <inheritdoc /> 9 public partial class PreCheckIns : Migration 10 { 11 /// <inheritdoc /> 12 protected override void Up(MigrationBuilder migrationBuilder) 13 { 14 migrationBuilder.AddColumn<decimal>( 15 name: "MessageForCheckIn4", 16 table: "Days", 17 type: "numeric(20,0)", 18 nullable: true); 19 20 migrationBuilder.AddColumn<decimal>( 21 name: "MessageForCheckIn5", 22 table: "Days", 23 type: "numeric(20,0)", 24 nullable: true); 25 26 migrationBuilder.AddColumn<decimal>( 27 name: "MessageForPreCheckInsId", 28 table: "Days", 29 type: "numeric(20,0)", 30 nullable: true); 31 32 migrationBuilder.CreateTable( 33 name: "PreCheckIns", 34 columns: table => new 35 { 36 Id = table.Column<Guid>(type: "uuid", nullable: false), 37 MemberThatPreCheckedInId = table.Column<Guid>(type: "uuid", nullable: false), 38 Timestamp = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false), 39 DayId = table.Column<Guid>(type: "uuid", nullable: false), 40 ClaimedCheckpoint = table.Column<int>(type: "integer", nullable: false) 41 }, 42 constraints: table => 43 { 44 table.PrimaryKey("PK_PreCheckIns", x => x.Id); 45 table.ForeignKey( 46 name: "FK_PreCheckIns_Days_DayId", 47 column: x => x.DayId, 48 principalTable: "Days", 49 principalColumn: "Id", 50 onDelete: ReferentialAction.Cascade); 51 table.ForeignKey( 52 name: "FK_PreCheckIns_Member_MemberThatPreCheckedInId", 53 column: x => x.MemberThatPreCheckedInId, 54 principalTable: "Member", 55 principalColumn: "Id", 56 onDelete: ReferentialAction.Cascade); 57 }); 58 59 migrationBuilder.CreateIndex( 60 name: "IX_PreCheckIns_DayId", 61 table: "PreCheckIns", 62 column: "DayId"); 63 64 migrationBuilder.CreateIndex( 65 name: "IX_PreCheckIns_MemberThatPreCheckedInId", 66 table: "PreCheckIns", 67 column: "MemberThatPreCheckedInId"); 68 } 69 70 /// <inheritdoc /> 71 protected override void Down(MigrationBuilder migrationBuilder) 72 { 73 migrationBuilder.DropTable( 74 name: "PreCheckIns"); 75 76 migrationBuilder.DropColumn( 77 name: "MessageForCheckIn4", 78 table: "Days"); 79 80 migrationBuilder.DropColumn( 81 name: "MessageForCheckIn5", 82 table: "Days"); 83 84 migrationBuilder.DropColumn( 85 name: "MessageForPreCheckInsId", 86 table: "Days"); 87 } 88 } 89 }