Files
TeleWave/backend/src/TeleWave.Infrastructure/Migrations/20260725105210_BumperChancesWeightsAndScheduleVariant.cs
T

126 lines
4.5 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace TeleWave.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class BumperChancesWeightsAndScheduleVariant : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_BumperTextVariant_BumperTemplate_BumperTemplateId",
table: "BumperTextVariant"
);
migrationBuilder.DropPrimaryKey(
name: "PK_BumperTextVariant",
table: "BumperTextVariant"
);
migrationBuilder.RenameTable(name: "BumperTextVariant", newName: "BumperTextVariants");
migrationBuilder.RenameIndex(
name: "IX_BumperTextVariant_BumperTemplateId_Position",
table: "BumperTextVariants",
newName: "IX_BumperTextVariants_BumperTemplateId_Position"
);
migrationBuilder.AddColumn<Guid>(
name: "BumperVariantId",
table: "ScheduleEntries",
type: "uuid",
nullable: true
);
// Существующим каналам — 1.0 (заставка на каждом подходящем переходе, как было до фичи).
migrationBuilder.AddColumn<double>(
name: "BumperEpisodeChangeChance",
table: "Channels",
type: "double precision",
nullable: false,
defaultValue: 1.0
);
migrationBuilder.AddColumn<double>(
name: "BumperShowChangeChance",
table: "Channels",
type: "double precision",
nullable: false,
defaultValue: 1.0
);
migrationBuilder.AddColumn<int>(
name: "Weight",
table: "BumperTextVariants",
type: "integer",
nullable: false,
defaultValue: 1
);
migrationBuilder.AddPrimaryKey(
name: "PK_BumperTextVariants",
table: "BumperTextVariants",
column: "Id"
);
migrationBuilder.AddForeignKey(
name: "FK_BumperTextVariants_BumperTemplate_BumperTemplateId",
table: "BumperTextVariants",
column: "BumperTemplateId",
principalTable: "BumperTemplate",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade
);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_BumperTextVariants_BumperTemplate_BumperTemplateId",
table: "BumperTextVariants"
);
migrationBuilder.DropPrimaryKey(
name: "PK_BumperTextVariants",
table: "BumperTextVariants"
);
migrationBuilder.DropColumn(name: "BumperVariantId", table: "ScheduleEntries");
migrationBuilder.DropColumn(name: "BumperEpisodeChangeChance", table: "Channels");
migrationBuilder.DropColumn(name: "BumperShowChangeChance", table: "Channels");
migrationBuilder.DropColumn(name: "Weight", table: "BumperTextVariants");
migrationBuilder.RenameTable(name: "BumperTextVariants", newName: "BumperTextVariant");
migrationBuilder.RenameIndex(
name: "IX_BumperTextVariants_BumperTemplateId_Position",
table: "BumperTextVariant",
newName: "IX_BumperTextVariant_BumperTemplateId_Position"
);
migrationBuilder.AddPrimaryKey(
name: "PK_BumperTextVariant",
table: "BumperTextVariant",
column: "Id"
);
migrationBuilder.AddForeignKey(
name: "FK_BumperTextVariant_BumperTemplate_BumperTemplateId",
table: "BumperTextVariant",
column: "BumperTemplateId",
principalTable: "BumperTemplate",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade
);
}
}
}