using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace FreeTubeSync.Migrations
{
///
public partial class Init : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Histories",
columns: table => new
{
_id = table.Column(type: "TEXT", nullable: false),
videoId = table.Column(type: "TEXT", nullable: false),
title = table.Column(type: "TEXT", nullable: false),
author = table.Column(type: "TEXT", nullable: false),
authorId = table.Column(type: "TEXT", nullable: false),
published = table.Column(type: "INTEGER", nullable: false),
description = table.Column(type: "TEXT", nullable: false),
viewCount = table.Column(type: "INTEGER", nullable: false),
lengthSeconds = table.Column(type: "INTEGER", nullable: false),
watchProgress = table.Column(type: "REAL", nullable: false),
timeWatched = table.Column(type: "INTEGER", nullable: false),
isLive = table.Column(type: "INTEGER", nullable: false),
type = table.Column(type: "TEXT", nullable: false),
lastViewedPlaylistType = table.Column(type: "TEXT", nullable: false),
lastViewedPlaylistItemId = table.Column(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Histories", x => x._id);
});
migrationBuilder.CreateTable(
name: "Playlists",
columns: table => new
{
_id = table.Column(type: "TEXT", nullable: false),
playlistName = table.Column(type: "TEXT", nullable: false),
@protected = table.Column(name: "protected", type: "INTEGER", nullable: false),
createdAt = table.Column(type: "INTEGER", nullable: false),
lastUpdatedAt = table.Column(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Playlists", x => x._id);
});
migrationBuilder.CreateTable(
name: "Profiles",
columns: table => new
{
_id = table.Column(type: "TEXT", nullable: false),
name = table.Column(type: "TEXT", nullable: false),
bgColor = table.Column(type: "TEXT", nullable: false),
textColor = table.Column(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Profiles", x => x._id);
});
migrationBuilder.CreateTable(
name: "SearchHistories",
columns: table => new
{
_id = table.Column(type: "TEXT", nullable: false),
lastUpdatedAt = table.Column(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_SearchHistories", x => x._id);
});
migrationBuilder.CreateTable(
name: "Settings",
columns: table => new
{
_id = table.Column(type: "TEXT", nullable: false),
Value = table.Column(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Settings", x => x._id);
});
migrationBuilder.CreateTable(
name: "Videos",
columns: table => new
{
videoId = table.Column(type: "TEXT", nullable: false),
title = table.Column(type: "TEXT", nullable: false),
author = table.Column(type: "TEXT", nullable: false),
authorId = table.Column(type: "TEXT", nullable: false),
lengthSeconds = table.Column(type: "TEXT", nullable: false),
pubished = table.Column(type: "INTEGER", nullable: false),
timeAdded = table.Column(type: "INTEGER", nullable: false),
playlistItemId = table.Column(type: "TEXT", nullable: false),
type = table.Column(type: "TEXT", nullable: false),
Playlist_id = table.Column(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(type: "TEXT", nullable: false),
name = table.Column(type: "TEXT", nullable: false),
thumbnail = table.Column(type: "TEXT", nullable: true),
Profile_id = table.Column(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");
}
///
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");
}
}
}