freetubesync/FreeTubeSync/Migrations/20250808221748_UpdateNewLayout.cs
Mario Steele 004c490dd8 Looks like we finally have a solution.
Change logging to just log a message, instead of the exception.
Moved logic to Syncer involvement.  When posting the data, if a 500 is
returned, then it is up to the Syncer to re-submit it.
2025-08-09 04:09:17 -05:00

130 lines
5.7 KiB
C#

using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace FreeTubeSync.Migrations
{
/// <inheritdoc />
public partial class UpdateNewLayout : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Subscriptions");
migrationBuilder.DropTable(
name: "Videos");
migrationBuilder.CreateTable(
name: "Subscription",
columns: table => new
{
id = table.Column<string>(type: "TEXT", nullable: false),
Profile_id = table.Column<string>(type: "TEXT", nullable: false),
name = table.Column<string>(type: "TEXT", nullable: false),
thumbnail = table.Column<string>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Subscription", x => new { x.Profile_id, x.id });
table.ForeignKey(
name: "FK_Subscription_Profiles_Profile_id",
column: x => x.Profile_id,
principalTable: "Profiles",
principalColumn: "_id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Video",
columns: table => new
{
videoId = table.Column<string>(type: "TEXT", nullable: false),
Playlist_id = table.Column<string>(type: "TEXT", nullable: false),
title = table.Column<string>(type: "TEXT", nullable: false),
author = table.Column<string>(type: "TEXT", nullable: false),
authorId = table.Column<string>(type: "TEXT", nullable: false),
lengthSeconds = table.Column<string>(type: "TEXT", nullable: false),
published = table.Column<long>(type: "INTEGER", nullable: false),
timeAdded = table.Column<long>(type: "INTEGER", nullable: false),
playlistItemId = table.Column<string>(type: "TEXT", nullable: false),
type = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Video", x => new { x.Playlist_id, x.videoId });
table.ForeignKey(
name: "FK_Video_Playlists_Playlist_id",
column: x => x.Playlist_id,
principalTable: "Playlists",
principalColumn: "_id",
onDelete: ReferentialAction.Cascade);
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Subscription");
migrationBuilder.DropTable(
name: "Video");
migrationBuilder.CreateTable(
name: "Subscriptions",
columns: table => new
{
id = table.Column<string>(type: "TEXT", nullable: false),
Profile_id = table.Column<string>(type: "TEXT", nullable: true),
name = table.Column<string>(type: "TEXT", nullable: false),
thumbnail = table.Column<string>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Subscriptions", x => x.id);
table.ForeignKey(
name: "FK_Subscriptions_Profiles_Profile_id",
column: x => x.Profile_id,
principalTable: "Profiles",
principalColumn: "_id");
});
migrationBuilder.CreateTable(
name: "Videos",
columns: table => new
{
playlistItemId = table.Column<string>(type: "TEXT", nullable: false),
Playlist_id = table.Column<string>(type: "TEXT", nullable: true),
author = table.Column<string>(type: "TEXT", nullable: false),
authorId = table.Column<string>(type: "TEXT", nullable: false),
lengthSeconds = table.Column<string>(type: "TEXT", nullable: false),
pubished = table.Column<long>(type: "INTEGER", nullable: false),
timeAdded = table.Column<long>(type: "INTEGER", nullable: false),
title = table.Column<string>(type: "TEXT", nullable: false),
type = table.Column<string>(type: "TEXT", nullable: false),
videoId = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Videos", x => x.playlistItemId);
table.ForeignKey(
name: "FK_Videos_Playlists_Playlist_id",
column: x => x.Playlist_id,
principalTable: "Playlists",
principalColumn: "_id");
});
migrationBuilder.CreateIndex(
name: "IX_Subscriptions_Profile_id",
table: "Subscriptions",
column: "Profile_id");
migrationBuilder.CreateIndex(
name: "IX_Videos_Playlist_id",
table: "Videos",
column: "Playlist_id");
}
}
}