dramaling-vocab-learning/backend/DramaLing.Api/Migrations/20250929055523_AddOptionsVo...

72 lines
2.8 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace DramaLing.Api.Migrations
{
/// <inheritdoc />
public partial class AddOptionsVocabularyTable : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "options_vocabularies",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
Word = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false),
cefr_level = table.Column<string>(type: "TEXT", maxLength: 2, nullable: false),
part_of_speech = table.Column<string>(type: "TEXT", maxLength: 20, nullable: false),
word_length = table.Column<int>(type: "INTEGER", nullable: false),
is_active = table.Column<bool>(type: "INTEGER", nullable: false, defaultValue: true),
created_at = table.Column<DateTime>(type: "TEXT", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"),
updated_at = table.Column<DateTime>(type: "TEXT", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP")
},
constraints: table =>
{
table.PrimaryKey("PK_options_vocabularies", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_OptionsVocabulary_Active",
table: "options_vocabularies",
column: "is_active");
migrationBuilder.CreateIndex(
name: "IX_OptionsVocabulary_CEFR",
table: "options_vocabularies",
column: "cefr_level");
migrationBuilder.CreateIndex(
name: "IX_OptionsVocabulary_Core_Matching",
table: "options_vocabularies",
columns: new[] { "cefr_level", "part_of_speech", "word_length" });
migrationBuilder.CreateIndex(
name: "IX_OptionsVocabulary_PartOfSpeech",
table: "options_vocabularies",
column: "part_of_speech");
migrationBuilder.CreateIndex(
name: "IX_OptionsVocabulary_Word",
table: "options_vocabularies",
column: "Word",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_OptionsVocabulary_WordLength",
table: "options_vocabularies",
column: "word_length");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "options_vocabularies");
}
}
}