70 lines
3.0 KiB
C#
70 lines
3.0 KiB
C#
using Microsoft.EntityFrameworkCore.Metadata;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace YTManager.Migrations
|
|
{
|
|
public partial class initial : Migration
|
|
{
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "Channels",
|
|
columns: table => new
|
|
{
|
|
ChannelId = table.Column<long>(type: "int8", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
|
|
Description = table.Column<string>(type: "text", nullable: false),
|
|
ThumbnailURL = table.Column<string>(type: "text", nullable: false),
|
|
Title = table.Column<string>(type: "text", nullable: false),
|
|
YTChannelID = table.Column<string>(type: "text", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Channels", x => x.ChannelId);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Videos",
|
|
columns: table => new
|
|
{
|
|
VideoId = table.Column<long>(type: "int8", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
|
|
AddedtoDB = table.Column<DateTime>(type: "timestamp", nullable: false),
|
|
ChannelId = table.Column<long>(type: "int8", nullable: false),
|
|
Description = table.Column<string>(type: "text", nullable: false),
|
|
ThumbnailURL = table.Column<string>(type: "text", nullable: false),
|
|
Title = table.Column<string>(type: "text", nullable: false),
|
|
Uploaded = table.Column<DateTime>(type: "timestamp", nullable: false),
|
|
YTChannelID = table.Column<string>(type: "text", nullable: false),
|
|
YTVideoID = table.Column<string>(type: "text", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Videos", x => x.VideoId);
|
|
table.ForeignKey(
|
|
name: "FK_Videos_Channels_ChannelId",
|
|
column: x => x.ChannelId,
|
|
principalTable: "Channels",
|
|
principalColumn: "ChannelId",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Videos_ChannelId",
|
|
table: "Videos",
|
|
column: "ChannelId");
|
|
}
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "Videos");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Channels");
|
|
}
|
|
}
|
|
}
|