.NET 8 backend with Zitadel JWT auth, TheMealDB integration, weekly meal plan generation, shopping list aggregation. Vue 3 + Tailwind 4 frontend with dark emerald theme, manual OIDC PKCE auth, all views implemented. Multi-stage Dockerfile with nginx reverse proxy. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
181 lines
7.3 KiB
C#
181 lines
7.3 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace backend.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class InitialCreate : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "CheckedShoppingItems",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
MealPlanId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
ItemName = table.Column<string>(type: "text", nullable: false),
|
|
UserId = table.Column<string>(type: "text", nullable: false),
|
|
IsChecked = table.Column<bool>(type: "boolean", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_CheckedShoppingItems", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "MealPlans",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
UserId = table.Column<string>(type: "text", nullable: false),
|
|
WeekStart = table.Column<DateOnly>(type: "date", nullable: false),
|
|
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_MealPlans", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Recipes",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
UserId = table.Column<string>(type: "text", nullable: true),
|
|
ExternalId = table.Column<string>(type: "text", nullable: true),
|
|
Title = table.Column<string>(type: "text", nullable: false),
|
|
Instructions = table.Column<string>(type: "text", nullable: false),
|
|
ImageUrl = table.Column<string>(type: "text", nullable: true),
|
|
Source = table.Column<int>(type: "integer", nullable: false),
|
|
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Recipes", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "UserSettings",
|
|
columns: table => new
|
|
{
|
|
UserId = table.Column<string>(type: "text", nullable: false),
|
|
HouseholdSize = table.Column<int>(type: "integer", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_UserSettings", x => x.UserId);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "MealPlanEntries",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
MealPlanId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
Date = table.Column<DateOnly>(type: "date", nullable: false),
|
|
RecipeId = table.Column<Guid>(type: "uuid", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_MealPlanEntries", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_MealPlanEntries_MealPlans_MealPlanId",
|
|
column: x => x.MealPlanId,
|
|
principalTable: "MealPlans",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_MealPlanEntries_Recipes_RecipeId",
|
|
column: x => x.RecipeId,
|
|
principalTable: "Recipes",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "RecipeIngredients",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
RecipeId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
Name = table.Column<string>(type: "text", nullable: false),
|
|
Amount = table.Column<decimal>(type: "numeric", nullable: true),
|
|
Unit = table.Column<string>(type: "text", nullable: true),
|
|
Category = table.Column<string>(type: "text", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_RecipeIngredients", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_RecipeIngredients_Recipes_RecipeId",
|
|
column: x => x.RecipeId,
|
|
principalTable: "Recipes",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_CheckedShoppingItems_MealPlanId_UserId_ItemName",
|
|
table: "CheckedShoppingItems",
|
|
columns: new[] { "MealPlanId", "UserId", "ItemName" });
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_MealPlanEntries_MealPlanId",
|
|
table: "MealPlanEntries",
|
|
column: "MealPlanId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_MealPlanEntries_RecipeId",
|
|
table: "MealPlanEntries",
|
|
column: "RecipeId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_MealPlans_UserId_WeekStart",
|
|
table: "MealPlans",
|
|
columns: new[] { "UserId", "WeekStart" },
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_RecipeIngredients_RecipeId",
|
|
table: "RecipeIngredients",
|
|
column: "RecipeId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Recipes_ExternalId",
|
|
table: "Recipes",
|
|
column: "ExternalId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Recipes_UserId",
|
|
table: "Recipes",
|
|
column: "UserId");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "CheckedShoppingItems");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "MealPlanEntries");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "RecipeIngredients");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "UserSettings");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "MealPlans");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Recipes");
|
|
}
|
|
}
|
|
}
|