172 lines
7.3 KiB
C#
172 lines
7.3 KiB
C#
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|||
|
|
|
|||
|
|
#nullable disable
|
|||
|
|
|
|||
|
|
namespace FreeTubeSync.Migrations
|
|||
|
|
{
|
|||
|
|
/// <inheritdoc />
|
|||
|
|
public partial class Init : Migration
|
|||
|
|
{
|
|||
|
|
/// <inheritdoc />
|
|||
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|||
|
|
{
|
|||
|
|
migrationBuilder.CreateTable(
|
|||
|
|
name: "Histories",
|
|||
|
|
columns: table => new
|
|||
|
|
{
|
|||
|
|
_id = table.Column<string>(type: "TEXT", nullable: false),
|
|||
|
|
videoId = 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),
|
|||
|
|
published = table.Column<long>(type: "INTEGER", nullable: false),
|
|||
|
|
description = table.Column<string>(type: "TEXT", nullable: false),
|
|||
|
|
viewCount = table.Column<long>(type: "INTEGER", nullable: false),
|
|||
|
|
lengthSeconds = table.Column<long>(type: "INTEGER", nullable: false),
|
|||
|
|
watchProgress = table.Column<float>(type: "REAL", nullable: false),
|
|||
|
|
timeWatched = table.Column<long>(type: "INTEGER", nullable: false),
|
|||
|
|
isLive = table.Column<bool>(type: "INTEGER", nullable: false),
|
|||
|
|
type = table.Column<string>(type: "TEXT", nullable: false),
|
|||
|
|
lastViewedPlaylistType = table.Column<string>(type: "TEXT", nullable: false),
|
|||
|
|
lastViewedPlaylistItemId = table.Column<string>(type: "TEXT", nullable: true)
|
|||
|
|
},
|
|||
|
|
constraints: table =>
|
|||
|
|
{
|
|||
|
|
table.PrimaryKey("PK_Histories", x => x._id);
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
migrationBuilder.CreateTable(
|
|||
|
|
name: "Playlists",
|
|||
|
|
columns: table => new
|
|||
|
|
{
|
|||
|
|
_id = table.Column<string>(type: "TEXT", nullable: false),
|
|||
|
|
playlistName = table.Column<string>(type: "TEXT", nullable: false),
|
|||
|
|
@protected = table.Column<bool>(name: "protected", type: "INTEGER", nullable: false),
|
|||
|
|
createdAt = table.Column<int>(type: "INTEGER", nullable: false),
|
|||
|
|
lastUpdatedAt = table.Column<int>(type: "INTEGER", nullable: false)
|
|||
|
|
},
|
|||
|
|
constraints: table =>
|
|||
|
|
{
|
|||
|
|
table.PrimaryKey("PK_Playlists", x => x._id);
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
migrationBuilder.CreateTable(
|
|||
|
|
name: "Profiles",
|
|||
|
|
columns: table => new
|
|||
|
|
{
|
|||
|
|
_id = table.Column<string>(type: "TEXT", nullable: false),
|
|||
|
|
name = table.Column<string>(type: "TEXT", nullable: false),
|
|||
|
|
bgColor = table.Column<string>(type: "TEXT", nullable: false),
|
|||
|
|
textColor = table.Column<string>(type: "TEXT", nullable: false)
|
|||
|
|
},
|
|||
|
|
constraints: table =>
|
|||
|
|
{
|
|||
|
|
table.PrimaryKey("PK_Profiles", x => x._id);
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
migrationBuilder.CreateTable(
|
|||
|
|
name: "SearchHistories",
|
|||
|
|
columns: table => new
|
|||
|
|
{
|
|||
|
|
_id = table.Column<string>(type: "TEXT", nullable: false),
|
|||
|
|
lastUpdatedAt = table.Column<int>(type: "INTEGER", nullable: false)
|
|||
|
|
},
|
|||
|
|
constraints: table =>
|
|||
|
|
{
|
|||
|
|
table.PrimaryKey("PK_SearchHistories", x => x._id);
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
migrationBuilder.CreateTable(
|
|||
|
|
name: "Settings",
|
|||
|
|
columns: table => new
|
|||
|
|
{
|
|||
|
|
_id = table.Column<string>(type: "TEXT", nullable: false),
|
|||
|
|
Value = table.Column<string>(type: "TEXT", nullable: false)
|
|||
|
|
},
|
|||
|
|
constraints: table =>
|
|||
|
|
{
|
|||
|
|
table.PrimaryKey("PK_Settings", x => x._id);
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
migrationBuilder.CreateTable(
|
|||
|
|
name: "Videos",
|
|||
|
|
columns: table => new
|
|||
|
|
{
|
|||
|
|
videoId = 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),
|
|||
|
|
pubished = table.Column<int>(type: "INTEGER", nullable: false),
|
|||
|
|
timeAdded = table.Column<int>(type: "INTEGER", nullable: false),
|
|||
|
|
playlistItemId = table.Column<string>(type: "TEXT", nullable: false),
|
|||
|
|
type = table.Column<string>(type: "TEXT", nullable: false),
|
|||
|
|
Playlist_id = table.Column<string>(type: "TEXT", nullable: true)
|
|||
|
|
},
|
|||
|
|
constraints: table =>
|
|||
|
|
{
|
|||
|
|
table.PrimaryKey("PK_Videos", x => x.videoId);
|
|||
|
|
table.ForeignKey(
|
|||
|
|
name: "FK_Videos_Playlists_Playlist_id",
|
|||
|
|
column: x => x.Playlist_id,
|
|||
|
|
principalTable: "Playlists",
|
|||
|
|
principalColumn: "_id");
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
migrationBuilder.CreateTable(
|
|||
|
|
name: "Subscriptions",
|
|||
|
|
columns: table => new
|
|||
|
|
{
|
|||
|
|
id = table.Column<string>(type: "TEXT", nullable: false),
|
|||
|
|
name = table.Column<string>(type: "TEXT", nullable: false),
|
|||
|
|
thumbnail = table.Column<string>(type: "TEXT", nullable: true),
|
|||
|
|
Profile_id = 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.CreateIndex(
|
|||
|
|
name: "IX_Subscriptions_Profile_id",
|
|||
|
|
table: "Subscriptions",
|
|||
|
|
column: "Profile_id");
|
|||
|
|
|
|||
|
|
migrationBuilder.CreateIndex(
|
|||
|
|
name: "IX_Videos_Playlist_id",
|
|||
|
|
table: "Videos",
|
|||
|
|
column: "Playlist_id");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <inheritdoc />
|
|||
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|||
|
|
{
|
|||
|
|
migrationBuilder.DropTable(
|
|||
|
|
name: "Histories");
|
|||
|
|
|
|||
|
|
migrationBuilder.DropTable(
|
|||
|
|
name: "SearchHistories");
|
|||
|
|
|
|||
|
|
migrationBuilder.DropTable(
|
|||
|
|
name: "Settings");
|
|||
|
|
|
|||
|
|
migrationBuilder.DropTable(
|
|||
|
|
name: "Subscriptions");
|
|||
|
|
|
|||
|
|
migrationBuilder.DropTable(
|
|||
|
|
name: "Videos");
|
|||
|
|
|
|||
|
|
migrationBuilder.DropTable(
|
|||
|
|
name: "Profiles");
|
|||
|
|
|
|||
|
|
migrationBuilder.DropTable(
|
|||
|
|
name: "Playlists");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|