95 lines
3.2 KiB
C#
95 lines
3.2 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace DramaLing.Api.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class FixTableNamesToSnakeCase : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_WordQueryUsageStats_user_profiles_user_id",
|
|
table: "WordQueryUsageStats");
|
|
|
|
migrationBuilder.DropPrimaryKey(
|
|
name: "PK_WordQueryUsageStats",
|
|
table: "WordQueryUsageStats");
|
|
|
|
migrationBuilder.DropPrimaryKey(
|
|
name: "PK_SentenceAnalysisCache",
|
|
table: "SentenceAnalysisCache");
|
|
|
|
migrationBuilder.RenameTable(
|
|
name: "WordQueryUsageStats",
|
|
newName: "word_query_usage_stats");
|
|
|
|
migrationBuilder.RenameTable(
|
|
name: "SentenceAnalysisCache",
|
|
newName: "sentence_analysis_cache");
|
|
|
|
migrationBuilder.AddPrimaryKey(
|
|
name: "PK_word_query_usage_stats",
|
|
table: "word_query_usage_stats",
|
|
column: "id");
|
|
|
|
migrationBuilder.AddPrimaryKey(
|
|
name: "PK_sentence_analysis_cache",
|
|
table: "sentence_analysis_cache",
|
|
column: "id");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_word_query_usage_stats_user_profiles_user_id",
|
|
table: "word_query_usage_stats",
|
|
column: "user_id",
|
|
principalTable: "user_profiles",
|
|
principalColumn: "id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_word_query_usage_stats_user_profiles_user_id",
|
|
table: "word_query_usage_stats");
|
|
|
|
migrationBuilder.DropPrimaryKey(
|
|
name: "PK_word_query_usage_stats",
|
|
table: "word_query_usage_stats");
|
|
|
|
migrationBuilder.DropPrimaryKey(
|
|
name: "PK_sentence_analysis_cache",
|
|
table: "sentence_analysis_cache");
|
|
|
|
migrationBuilder.RenameTable(
|
|
name: "word_query_usage_stats",
|
|
newName: "WordQueryUsageStats");
|
|
|
|
migrationBuilder.RenameTable(
|
|
name: "sentence_analysis_cache",
|
|
newName: "SentenceAnalysisCache");
|
|
|
|
migrationBuilder.AddPrimaryKey(
|
|
name: "PK_WordQueryUsageStats",
|
|
table: "WordQueryUsageStats",
|
|
column: "id");
|
|
|
|
migrationBuilder.AddPrimaryKey(
|
|
name: "PK_SentenceAnalysisCache",
|
|
table: "SentenceAnalysisCache",
|
|
column: "id");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_WordQueryUsageStats_user_profiles_user_id",
|
|
table: "WordQueryUsageStats",
|
|
column: "user_id",
|
|
principalTable: "user_profiles",
|
|
principalColumn: "id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
}
|
|
}
|
|
}
|