using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace DramaLing.Api.Migrations
{
///
public partial class RemoveCardSetFeature : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_flashcards_card_sets_card_set_id",
table: "flashcards");
migrationBuilder.DropTable(
name: "card_sets");
migrationBuilder.DropIndex(
name: "IX_flashcards_card_set_id",
table: "flashcards");
migrationBuilder.DropColumn(
name: "card_set_id",
table: "flashcards");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn(
name: "card_set_id",
table: "flashcards",
type: "TEXT",
nullable: true);
migrationBuilder.CreateTable(
name: "card_sets",
columns: table => new
{
Id = table.Column(type: "TEXT", nullable: false),
UserId = table.Column(type: "TEXT", nullable: false),
CardCount = table.Column(type: "INTEGER", nullable: false),
Color = table.Column(type: "TEXT", maxLength: 50, nullable: false),
CreatedAt = table.Column(type: "TEXT", nullable: false),
Description = table.Column(type: "TEXT", nullable: true),
IsDefault = table.Column(type: "INTEGER", nullable: false),
Name = table.Column(type: "TEXT", maxLength: 255, nullable: false),
UpdatedAt = table.Column(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_card_sets", x => x.Id);
table.ForeignKey(
name: "FK_card_sets_user_profiles_UserId",
column: x => x.UserId,
principalTable: "user_profiles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_flashcards_card_set_id",
table: "flashcards",
column: "card_set_id");
migrationBuilder.CreateIndex(
name: "IX_card_sets_UserId",
table: "card_sets",
column: "UserId");
migrationBuilder.AddForeignKey(
name: "FK_flashcards_card_sets_card_set_id",
table: "flashcards",
column: "card_set_id",
principalTable: "card_sets",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
}
}
}