Добавлены избранные плейлисты

This commit is contained in:
FrigaT
2026-04-14 14:14:19 +03:00
parent 8230951839
commit dcb2efbedb
17 changed files with 1118 additions and 5 deletions

View File

@@ -0,0 +1,64 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace PlaylistShared.Api.Data.Migrations
{
/// <inheritdoc />
public partial class AddUserFavorites : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "YandexPlaylistUuid",
table: "SharedPlaylists",
type: "nvarchar(50)",
maxLength: 50,
nullable: false,
defaultValue: "");
migrationBuilder.CreateTable(
name: "FavoritePlaylists",
columns: table => new
{
UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
SharedPlaylistId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
AddedAtUtc = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_FavoritePlaylists", x => new { x.UserId, x.SharedPlaylistId });
table.ForeignKey(
name: "FK_FavoritePlaylists_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_FavoritePlaylists_SharedPlaylists_SharedPlaylistId",
column: x => x.SharedPlaylistId,
principalTable: "SharedPlaylists",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_FavoritePlaylists_SharedPlaylistId",
table: "FavoritePlaylists",
column: "SharedPlaylistId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "FavoritePlaylists");
migrationBuilder.DropColumn(
name: "YandexPlaylistUuid",
table: "SharedPlaylists");
}
}
}