Files
chapter-organizer/Data/Migrations/20251227205816_EventOccurrence.cs
T
poprhythm 3a809f18a6 Add EventOccurrence entity and update DbContext
Created the EventOccurrence entity with properties for event details and added it to the AppDbContext. Updated the model snapshot to reflect the new entity and its relationships, ensuring proper database schema generation.
2025-12-27 15:59:48 -05:00

64 lines
2.6 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Data.Migrations
{
/// <inheritdoc />
public partial class EventOccurrence : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "EventOccurrences",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
EventDefinitionId = table.Column<int>(type: "INTEGER", nullable: true),
SpecialEventType = table.Column<string>(type: "TEXT", maxLength: 50, nullable: true),
Name = table.Column<string>(type: "TEXT", maxLength: 200, nullable: false),
Time = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false),
Date = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false),
StartTime = table.Column<DateTime>(type: "TEXT", nullable: false),
EndTime = table.Column<DateTime>(type: "TEXT", nullable: true),
Location = table.Column<string>(type: "TEXT", maxLength: 500, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_EventOccurrences", x => x.Id);
table.ForeignKey(
name: "FK_EventOccurrences_Events_EventDefinitionId",
column: x => x.EventDefinitionId,
principalTable: "Events",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
name: "IX_EventOccurrences_EventDefinitionId",
table: "EventOccurrences",
column: "EventDefinitionId");
migrationBuilder.CreateIndex(
name: "IX_EventOccurrences_SpecialEventType",
table: "EventOccurrences",
column: "SpecialEventType");
migrationBuilder.CreateIndex(
name: "IX_EventOccurrences_StartTime",
table: "EventOccurrences",
column: "StartTime");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "EventOccurrences");
}
}
}