HUGE arch changes to make searching work right

This commit is contained in:
2018-03-05 01:08:55 -05:00
parent 96a26ce30d
commit 9f5fb78835
32 changed files with 800 additions and 447 deletions

View File

@ -1,82 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
using System;
using System.Collections.Generic;
namespace YTManager.Migrations
{
public partial class fix_channel_relationship : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Videos_Channels_ChannelPrimaryKey",
table: "Videos");
migrationBuilder.AlterColumn<long>(
name: "ChannelPrimaryKey",
table: "Videos",
nullable: false,
oldClrType: typeof(long),
oldNullable: true);
migrationBuilder.AddColumn<long>(
name: "VideoPrimaryKey",
table: "Tags",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_Tags_VideoPrimaryKey",
table: "Tags",
column: "VideoPrimaryKey");
migrationBuilder.AddForeignKey(
name: "FK_Tags_Videos_VideoPrimaryKey",
table: "Tags",
column: "VideoPrimaryKey",
principalTable: "Videos",
principalColumn: "PrimaryKey",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Videos_Channels_ChannelPrimaryKey",
table: "Videos",
column: "ChannelPrimaryKey",
principalTable: "Channels",
principalColumn: "PrimaryKey",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Tags_Videos_VideoPrimaryKey",
table: "Tags");
migrationBuilder.DropForeignKey(
name: "FK_Videos_Channels_ChannelPrimaryKey",
table: "Videos");
migrationBuilder.DropIndex(
name: "IX_Tags_VideoPrimaryKey",
table: "Tags");
migrationBuilder.DropColumn(
name: "VideoPrimaryKey",
table: "Tags");
migrationBuilder.AlterColumn<long>(
name: "ChannelPrimaryKey",
table: "Videos",
nullable: true,
oldClrType: typeof(long));
migrationBuilder.AddForeignKey(
name: "FK_Videos_Channels_ChannelPrimaryKey",
table: "Videos",
column: "ChannelPrimaryKey",
principalTable: "Channels",
principalColumn: "PrimaryKey",
onDelete: ReferentialAction.Restrict);
}
}
}

View File

@ -1,25 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
using System;
using System.Collections.Generic;
namespace YTManager.Migrations
{
public partial class added_vid_duration : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<TimeSpan>(
name: "Duration",
table: "Videos",
nullable: false,
defaultValue: "00:00:00");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Duration",
table: "Videos");
}
}
}

View File

@ -6,12 +6,13 @@ using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.EntityFrameworkCore.Storage.Internal;
using System;
using System.Collections.Generic;
using YTManager;
namespace YTManager.Migrations
{
[DbContext(typeof(MediaDB))]
[Migration("20180224051602_initial")]
[Migration("20180304034317_initial")]
partial class initial
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -39,6 +40,8 @@ namespace YTManager.Migrations
b.Property<string>("Title")
.IsRequired();
b.Property<List<string>>("UserTags");
b.Property<string>("YoutubeID")
.IsRequired();
@ -47,19 +50,6 @@ namespace YTManager.Migrations
b.ToTable("Channels");
});
modelBuilder.Entity("YTManager.Models.Tag", b =>
{
b.Property<long>("PrimaryKey")
.ValueGeneratedOnAdd();
b.Property<string>("Name")
.IsRequired();
b.HasKey("PrimaryKey");
b.ToTable("Tags");
});
modelBuilder.Entity("YTManager.Models.Video", b =>
{
b.Property<long>("PrimaryKey")
@ -69,11 +59,16 @@ namespace YTManager.Migrations
b.Property<DateTime>("AddedtoDB");
b.Property<long?>("ChannelPrimaryKey");
b.Property<long>("ChannelPrimaryKey");
b.Property<string>("Description")
.IsRequired();
b.Property<TimeSpan>("Duration");
b.Property<List<string>>("Tags")
.IsRequired();
b.Property<string>("ThumbnailURL")
.IsRequired();
@ -92,9 +87,10 @@ namespace YTManager.Migrations
modelBuilder.Entity("YTManager.Models.Video", b =>
{
b.HasOne("YTManager.Models.Channel")
b.HasOne("YTManager.Models.Channel", "Channel")
.WithMany("Videos")
.HasForeignKey("ChannelPrimaryKey");
.HasForeignKey("ChannelPrimaryKey")
.OnDelete(DeleteBehavior.Cascade);
});
#pragma warning restore 612, 618
}

View File

@ -20,6 +20,7 @@ namespace YTManager.Migrations
Refreshed = table.Column<DateTime>(nullable: false),
ThumbnailURL = table.Column<string>(nullable: false),
Title = table.Column<string>(nullable: false),
UserTags = table.Column<List<string>>(nullable: true),
YoutubeID = table.Column<string>(nullable: false)
},
constraints: table =>
@ -27,19 +28,6 @@ namespace YTManager.Migrations
table.PrimaryKey("PK_Channels", x => x.PrimaryKey);
});
migrationBuilder.CreateTable(
name: "Tags",
columns: table => new
{
PrimaryKey = table.Column<long>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
Name = table.Column<string>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Tags", x => x.PrimaryKey);
});
migrationBuilder.CreateTable(
name: "Videos",
columns: table => new
@ -48,8 +36,10 @@ namespace YTManager.Migrations
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
AddedToYT = table.Column<DateTime>(nullable: false),
AddedtoDB = table.Column<DateTime>(nullable: false),
ChannelPrimaryKey = table.Column<long>(nullable: true),
ChannelPrimaryKey = table.Column<long>(nullable: false),
Description = table.Column<string>(nullable: false),
Duration = table.Column<TimeSpan>(nullable: false),
Tags = table.Column<List<string>>(nullable: false),
ThumbnailURL = table.Column<string>(nullable: false),
Title = table.Column<string>(nullable: false),
YoutubeID = table.Column<string>(nullable: false)
@ -62,7 +52,7 @@ namespace YTManager.Migrations
column: x => x.ChannelPrimaryKey,
principalTable: "Channels",
principalColumn: "PrimaryKey",
onDelete: ReferentialAction.Restrict);
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
@ -73,9 +63,6 @@ namespace YTManager.Migrations
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Tags");
migrationBuilder.DropTable(
name: "Videos");

View File

@ -6,13 +6,14 @@ using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.EntityFrameworkCore.Storage.Internal;
using System;
using System.Collections.Generic;
using YTManager;
namespace YTManager.Migrations
{
[DbContext(typeof(MediaDB))]
[Migration("20180228202611_added_vid_duration")]
partial class added_vid_duration
[Migration("20180305045634_Tag change")]
partial class Tagchange
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
@ -39,6 +40,8 @@ namespace YTManager.Migrations
b.Property<string>("Title")
.IsRequired();
b.Property<List<string>>("UserTags");
b.Property<string>("YoutubeID")
.IsRequired();
@ -47,23 +50,6 @@ namespace YTManager.Migrations
b.ToTable("Channels");
});
modelBuilder.Entity("YTManager.Models.Tag", b =>
{
b.Property<long>("PrimaryKey")
.ValueGeneratedOnAdd();
b.Property<string>("Name")
.IsRequired();
b.Property<long?>("VideoPrimaryKey");
b.HasKey("PrimaryKey");
b.HasIndex("VideoPrimaryKey");
b.ToTable("Tags");
});
modelBuilder.Entity("YTManager.Models.Video", b =>
{
b.Property<long>("PrimaryKey")
@ -80,6 +66,9 @@ namespace YTManager.Migrations
b.Property<TimeSpan>("Duration");
b.Property<List<string>>("Tags")
.IsRequired();
b.Property<string>("ThumbnailURL")
.IsRequired();
@ -96,13 +85,6 @@ namespace YTManager.Migrations
b.ToTable("Videos");
});
modelBuilder.Entity("YTManager.Models.Tag", b =>
{
b.HasOne("YTManager.Models.Video")
.WithMany("Tags")
.HasForeignKey("VideoPrimaryKey");
});
modelBuilder.Entity("YTManager.Models.Video", b =>
{
b.HasOne("YTManager.Models.Channel", "Channel")

View File

@ -0,0 +1,19 @@
using Microsoft.EntityFrameworkCore.Migrations;
using System;
using System.Collections.Generic;
namespace YTManager.Migrations
{
public partial class Tagchange : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
}
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

View File

@ -6,13 +6,14 @@ using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.EntityFrameworkCore.Storage.Internal;
using System;
using System.Collections.Generic;
using YTManager;
namespace YTManager.Migrations
{
[DbContext(typeof(MediaDB))]
[Migration("20180224055707_fix_channel_relationship")]
partial class fix_channel_relationship
[Migration("20180305052950_Made tags required")]
partial class Madetagsrequired
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
@ -39,6 +40,9 @@ namespace YTManager.Migrations
b.Property<string>("Title")
.IsRequired();
b.Property<string[]>("UserTags")
.IsRequired();
b.Property<string>("YoutubeID")
.IsRequired();
@ -47,23 +51,6 @@ namespace YTManager.Migrations
b.ToTable("Channels");
});
modelBuilder.Entity("YTManager.Models.Tag", b =>
{
b.Property<long>("PrimaryKey")
.ValueGeneratedOnAdd();
b.Property<string>("Name")
.IsRequired();
b.Property<long?>("VideoPrimaryKey");
b.HasKey("PrimaryKey");
b.HasIndex("VideoPrimaryKey");
b.ToTable("Tags");
});
modelBuilder.Entity("YTManager.Models.Video", b =>
{
b.Property<long>("PrimaryKey")
@ -78,6 +65,11 @@ namespace YTManager.Migrations
b.Property<string>("Description")
.IsRequired();
b.Property<TimeSpan>("Duration");
b.Property<List<string>>("Tags")
.IsRequired();
b.Property<string>("ThumbnailURL")
.IsRequired();
@ -94,13 +86,6 @@ namespace YTManager.Migrations
b.ToTable("Videos");
});
modelBuilder.Entity("YTManager.Models.Tag", b =>
{
b.HasOne("YTManager.Models.Video")
.WithMany("Tags")
.HasForeignKey("VideoPrimaryKey");
});
modelBuilder.Entity("YTManager.Models.Video", b =>
{
b.HasOne("YTManager.Models.Channel", "Channel")

View File

@ -0,0 +1,28 @@
using Microsoft.EntityFrameworkCore.Migrations;
using System;
using System.Collections.Generic;
namespace YTManager.Migrations
{
public partial class Madetagsrequired : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string[]>(
name: "UserTags",
table: "Channels",
nullable: false,
oldClrType: typeof(List<string>),
oldNullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<List<string>>(
name: "UserTags",
table: "Channels",
nullable: true,
oldClrType: typeof(string[]));
}
}
}

View File

@ -0,0 +1,98 @@
// <auto-generated />
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.EntityFrameworkCore.Storage.Internal;
using System;
using YTManager;
namespace YTManager.Migrations
{
[DbContext(typeof(MediaDB))]
[Migration("20180305055427_Fixed videos tags")]
partial class Fixedvideostags
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn)
.HasAnnotation("ProductVersion", "2.0.1-rtm-125");
modelBuilder.Entity("YTManager.Models.Channel", b =>
{
b.Property<long>("PrimaryKey")
.ValueGeneratedOnAdd();
b.Property<DateTime>("AddedtoDB");
b.Property<string>("Description")
.IsRequired();
b.Property<DateTime>("Refreshed");
b.Property<string>("ThumbnailURL")
.IsRequired();
b.Property<string>("Title")
.IsRequired();
b.Property<string[]>("UserTags")
.IsRequired();
b.Property<string>("YoutubeID")
.IsRequired();
b.HasKey("PrimaryKey");
b.ToTable("Channels");
});
modelBuilder.Entity("YTManager.Models.Video", b =>
{
b.Property<long>("PrimaryKey")
.ValueGeneratedOnAdd();
b.Property<DateTime>("AddedToYT");
b.Property<DateTime>("AddedtoDB");
b.Property<long>("ChannelPrimaryKey");
b.Property<string>("Description")
.IsRequired();
b.Property<TimeSpan>("Duration");
b.Property<string[]>("Tags")
.IsRequired();
b.Property<string>("ThumbnailURL")
.IsRequired();
b.Property<string>("Title")
.IsRequired();
b.Property<string>("YoutubeID")
.IsRequired();
b.HasKey("PrimaryKey");
b.HasIndex("ChannelPrimaryKey");
b.ToTable("Videos");
});
modelBuilder.Entity("YTManager.Models.Video", b =>
{
b.HasOne("YTManager.Models.Channel", "Channel")
.WithMany("Videos")
.HasForeignKey("ChannelPrimaryKey")
.OnDelete(DeleteBehavior.Cascade);
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,19 @@
using Microsoft.EntityFrameworkCore.Migrations;
using System;
using System.Collections.Generic;
namespace YTManager.Migrations
{
public partial class Fixedvideostags : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
}
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

View File

@ -38,6 +38,9 @@ namespace YTManager.Migrations
b.Property<string>("Title")
.IsRequired();
b.Property<string[]>("UserTags")
.IsRequired();
b.Property<string>("YoutubeID")
.IsRequired();
@ -46,23 +49,6 @@ namespace YTManager.Migrations
b.ToTable("Channels");
});
modelBuilder.Entity("YTManager.Models.Tag", b =>
{
b.Property<long>("PrimaryKey")
.ValueGeneratedOnAdd();
b.Property<string>("Name")
.IsRequired();
b.Property<long?>("VideoPrimaryKey");
b.HasKey("PrimaryKey");
b.HasIndex("VideoPrimaryKey");
b.ToTable("Tags");
});
modelBuilder.Entity("YTManager.Models.Video", b =>
{
b.Property<long>("PrimaryKey")
@ -79,6 +65,9 @@ namespace YTManager.Migrations
b.Property<TimeSpan>("Duration");
b.Property<string[]>("Tags")
.IsRequired();
b.Property<string>("ThumbnailURL")
.IsRequired();
@ -95,13 +84,6 @@ namespace YTManager.Migrations
b.ToTable("Videos");
});
modelBuilder.Entity("YTManager.Models.Tag", b =>
{
b.HasOne("YTManager.Models.Video")
.WithMany("Tags")
.HasForeignKey("VideoPrimaryKey");
});
modelBuilder.Entity("YTManager.Models.Video", b =>
{
b.HasOne("YTManager.Models.Channel", "Channel")