38 lines
1.1 KiB
C#
38 lines
1.1 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace DramaLing.Api.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddStudyRecordUniqueIndex : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_study_records_user_id",
|
|
table: "study_records");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_StudyRecord_UserCard_TestType_Unique",
|
|
table: "study_records",
|
|
columns: new[] { "user_id", "flashcard_id", "study_mode" },
|
|
unique: true);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_StudyRecord_UserCard_TestType_Unique",
|
|
table: "study_records");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_study_records_user_id",
|
|
table: "study_records",
|
|
column: "user_id");
|
|
}
|
|
}
|
|
}
|