Phase 9 Wave 1: add ReleaseMedium discriminator + Session/Mix metadata
Add ReleaseMedium enum (Cut/Session/Mix) and two 1:1 satellite entities (SessionMetadata, MixMetadata) with EF configs and an additive migration. ReleaseDto.ReleaseType is now nullable, nulled for non-Cut at the converter. Existing releases default to Cut via column default; no data migration.
This commit is contained in:
@@ -0,0 +1,106 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace DeepDrftData.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddReleaseMedium : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "medium",
|
||||
table: "release",
|
||||
type: "character varying(20)",
|
||||
maxLength: 20,
|
||||
nullable: false,
|
||||
defaultValue: "Cut");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "mix_metadata",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
release_id = table.Column<long>(type: "bigint", nullable: false),
|
||||
waveform_entry_key = table.Column<string>(type: "character varying(500)", maxLength: 500, nullable: false),
|
||||
created_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
updated_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
is_deleted = table.Column<bool>(type: "boolean", nullable: false, defaultValue: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_mix_metadata", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "FK_mix_metadata_release_release_id",
|
||||
column: x => x.release_id,
|
||||
principalTable: "release",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "session_metadata",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
release_id = table.Column<long>(type: "bigint", nullable: false),
|
||||
hero_image_entry_key = table.Column<string>(type: "character varying(500)", maxLength: 500, nullable: false),
|
||||
created_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
updated_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
is_deleted = table.Column<bool>(type: "boolean", nullable: false, defaultValue: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_session_metadata", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "FK_session_metadata_release_release_id",
|
||||
column: x => x.release_id,
|
||||
principalTable: "release",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_mix_metadata_is_deleted",
|
||||
table: "mix_metadata",
|
||||
column: "is_deleted");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_mix_metadata_release_id",
|
||||
table: "mix_metadata",
|
||||
column: "release_id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_session_metadata_is_deleted",
|
||||
table: "session_metadata",
|
||||
column: "is_deleted");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_session_metadata_release_id",
|
||||
table: "session_metadata",
|
||||
column: "release_id",
|
||||
unique: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "mix_metadata");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "session_metadata");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "medium",
|
||||
table: "release");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user