2018-02-20 04:57:14 +00:00
|
|
|
|
using Microsoft.EntityFrameworkCore.Metadata;
|
|
|
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
|
|
namespace YTManager.Migrations
|
|
|
|
|
{
|
2018-02-24 06:10:12 +00:00
|
|
|
|
public partial class initial : Migration
|
2018-02-20 04:57:14 +00:00
|
|
|
|
{
|
|
|
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
|
|
|
{
|
|
|
|
|
migrationBuilder.CreateTable(
|
|
|
|
|
name: "Channels",
|
|
|
|
|
columns: table => new
|
|
|
|
|
{
|
|
|
|
|
PrimaryKey = table.Column<long>(nullable: false)
|
|
|
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
|
|
|
|
|
AddedtoDB = table.Column<DateTime>(nullable: false),
|
|
|
|
|
Description = table.Column<string>(nullable: false),
|
2018-02-24 06:10:12 +00:00
|
|
|
|
Refreshed = table.Column<DateTime>(nullable: false),
|
2018-02-20 04:57:14 +00:00
|
|
|
|
ThumbnailURL = table.Column<string>(nullable: false),
|
|
|
|
|
Title = table.Column<string>(nullable: false),
|
2018-03-05 06:08:55 +00:00
|
|
|
|
UserTags = table.Column<List<string>>(nullable: true),
|
2018-02-20 04:57:14 +00:00
|
|
|
|
YoutubeID = table.Column<string>(nullable: false)
|
|
|
|
|
},
|
|
|
|
|
constraints: table =>
|
|
|
|
|
{
|
|
|
|
|
table.PrimaryKey("PK_Channels", x => x.PrimaryKey);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateTable(
|
|
|
|
|
name: "Videos",
|
|
|
|
|
columns: table => new
|
|
|
|
|
{
|
|
|
|
|
PrimaryKey = table.Column<long>(nullable: false)
|
|
|
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
|
|
|
|
|
AddedToYT = table.Column<DateTime>(nullable: false),
|
|
|
|
|
AddedtoDB = table.Column<DateTime>(nullable: false),
|
2018-03-05 06:08:55 +00:00
|
|
|
|
ChannelPrimaryKey = table.Column<long>(nullable: false),
|
2018-02-20 04:57:14 +00:00
|
|
|
|
Description = table.Column<string>(nullable: false),
|
2018-03-05 06:08:55 +00:00
|
|
|
|
Duration = table.Column<TimeSpan>(nullable: false),
|
|
|
|
|
Tags = table.Column<List<string>>(nullable: false),
|
2018-02-20 04:57:14 +00:00
|
|
|
|
ThumbnailURL = table.Column<string>(nullable: false),
|
|
|
|
|
Title = table.Column<string>(nullable: false),
|
|
|
|
|
YoutubeID = table.Column<string>(nullable: false)
|
|
|
|
|
},
|
|
|
|
|
constraints: table =>
|
|
|
|
|
{
|
|
|
|
|
table.PrimaryKey("PK_Videos", x => x.PrimaryKey);
|
|
|
|
|
table.ForeignKey(
|
|
|
|
|
name: "FK_Videos_Channels_ChannelPrimaryKey",
|
|
|
|
|
column: x => x.ChannelPrimaryKey,
|
|
|
|
|
principalTable: "Channels",
|
|
|
|
|
principalColumn: "PrimaryKey",
|
2018-03-05 06:08:55 +00:00
|
|
|
|
onDelete: ReferentialAction.Cascade);
|
2018-02-20 04:57:14 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateIndex(
|
|
|
|
|
name: "IX_Videos_ChannelPrimaryKey",
|
|
|
|
|
table: "Videos",
|
|
|
|
|
column: "ChannelPrimaryKey");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
|
|
|
{
|
|
|
|
|
migrationBuilder.DropTable(
|
|
|
|
|
name: "Videos");
|
|
|
|
|
|
|
|
|
|
migrationBuilder.DropTable(
|
|
|
|
|
name: "Channels");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|