frontend_projekt/OnlyPrompt.Backend/Migrations/20260412002927_ReviewManyToMany.cs
2026-04-12 03:45:01 +02:00

94 lines
2.7 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace OnlyPrompt.Backend.Migrations
{
/// <inheritdoc />
public partial class ReviewManyToMany : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropPrimaryKey(
name: "PK_Reviews",
table: "Reviews");
migrationBuilder.DropIndex(
name: "IX_Reviews_ReviewerId_PromptId",
table: "Reviews");
migrationBuilder.DropColumn(
name: "Id",
table: "Reviews");
migrationBuilder.DropColumn(
name: "Content",
table: "Prompts");
migrationBuilder.AddColumn<string>(
name: "Description",
table: "Prompts",
type: "character varying(1000)",
maxLength: 1000,
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<string>(
name: "Prompt",
table: "Prompts",
type: "character varying(4000)",
maxLength: 4000,
nullable: false,
defaultValue: "");
migrationBuilder.AddPrimaryKey(
name: "PK_Reviews",
table: "Reviews",
columns: new[] { "ReviewerId", "PromptId" });
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropPrimaryKey(
name: "PK_Reviews",
table: "Reviews");
migrationBuilder.DropColumn(
name: "Description",
table: "Prompts");
migrationBuilder.DropColumn(
name: "Prompt",
table: "Prompts");
migrationBuilder.AddColumn<Guid>(
name: "Id",
table: "Reviews",
type: "uuid",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
migrationBuilder.AddColumn<string>(
name: "Content",
table: "Prompts",
type: "text",
nullable: false,
defaultValue: "");
migrationBuilder.AddPrimaryKey(
name: "PK_Reviews",
table: "Reviews",
column: "Id");
migrationBuilder.CreateIndex(
name: "IX_Reviews_ReviewerId_PromptId",
table: "Reviews",
columns: new[] { "ReviewerId", "PromptId" },
unique: true);
}
}
}