diff --git a/YTManager/Migrations/20170902220142_initial.Designer.cs b/YTManager/Migrations/20170902220142_initial.Designer.cs
deleted file mode 100644
index e46501e..0000000
--- a/YTManager/Migrations/20170902220142_initial.Designer.cs
+++ /dev/null
@@ -1,89 +0,0 @@
-//
-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("20170902220142_initial")]
- partial class initial
- {
- protected override void BuildTargetModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder
- .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn)
- .HasAnnotation("ProductVersion", "2.0.0-rtm-26452");
-
- modelBuilder.Entity("YTManager.Models.Channel", b =>
- {
- b.Property("ChannelId")
- .ValueGeneratedOnAdd();
-
- b.Property("Description")
- .IsRequired();
-
- b.Property("ThumbnailURL")
- .IsRequired();
-
- b.Property("Title")
- .IsRequired();
-
- b.Property("YTChannelID")
- .IsRequired();
-
- b.HasKey("ChannelId");
-
- b.ToTable("Channels");
- });
-
- modelBuilder.Entity("YTManager.Models.Video", b =>
- {
- b.Property("VideoId")
- .ValueGeneratedOnAdd();
-
- b.Property("AddedtoDB");
-
- b.Property("ChannelId");
-
- b.Property("Description")
- .IsRequired();
-
- b.Property("ThumbnailURL")
- .IsRequired();
-
- b.Property("Title")
- .IsRequired();
-
- b.Property("Uploaded");
-
- b.Property("YTChannelID")
- .IsRequired();
-
- b.Property("YTVideoID")
- .IsRequired();
-
- b.HasKey("VideoId");
-
- b.HasIndex("ChannelId");
-
- b.ToTable("Videos");
- });
-
- modelBuilder.Entity("YTManager.Models.Video", b =>
- {
- b.HasOne("YTManager.Models.Channel", "Channel")
- .WithMany("Videos")
- .HasForeignKey("ChannelId")
- .OnDelete(DeleteBehavior.Cascade);
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/YTManager/Migrations/20170902220142_initial.cs b/YTManager/Migrations/20170902220142_initial.cs
deleted file mode 100644
index f53bec0..0000000
--- a/YTManager/Migrations/20170902220142_initial.cs
+++ /dev/null
@@ -1,69 +0,0 @@
-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(type: "int8", nullable: false)
- .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
- Description = table.Column(type: "text", nullable: false),
- ThumbnailURL = table.Column(type: "text", nullable: false),
- Title = table.Column(type: "text", nullable: false),
- YTChannelID = table.Column(type: "text", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Channels", x => x.ChannelId);
- });
-
- migrationBuilder.CreateTable(
- name: "Videos",
- columns: table => new
- {
- VideoId = table.Column(type: "int8", nullable: false)
- .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
- AddedtoDB = table.Column(type: "timestamp", nullable: false),
- ChannelId = table.Column(type: "int8", nullable: false),
- Description = table.Column(type: "text", nullable: false),
- ThumbnailURL = table.Column(type: "text", nullable: false),
- Title = table.Column(type: "text", nullable: false),
- Uploaded = table.Column(type: "timestamp", nullable: false),
- YTChannelID = table.Column(type: "text", nullable: false),
- YTVideoID = table.Column(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");
- }
- }
-}
diff --git a/YTManager/Migrations/MediaDBModelSnapshot.cs b/YTManager/Migrations/MediaDBModelSnapshot.cs
deleted file mode 100644
index 86bcdc6..0000000
--- a/YTManager/Migrations/MediaDBModelSnapshot.cs
+++ /dev/null
@@ -1,88 +0,0 @@
-//
-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))]
- partial class MediaDBModelSnapshot : ModelSnapshot
- {
- protected override void BuildModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder
- .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn)
- .HasAnnotation("ProductVersion", "2.0.0-rtm-26452");
-
- modelBuilder.Entity("YTManager.Models.Channel", b =>
- {
- b.Property("ChannelId")
- .ValueGeneratedOnAdd();
-
- b.Property("Description")
- .IsRequired();
-
- b.Property("ThumbnailURL")
- .IsRequired();
-
- b.Property("Title")
- .IsRequired();
-
- b.Property("YTChannelID")
- .IsRequired();
-
- b.HasKey("ChannelId");
-
- b.ToTable("Channels");
- });
-
- modelBuilder.Entity("YTManager.Models.Video", b =>
- {
- b.Property("VideoId")
- .ValueGeneratedOnAdd();
-
- b.Property("AddedtoDB");
-
- b.Property("ChannelId");
-
- b.Property("Description")
- .IsRequired();
-
- b.Property("ThumbnailURL")
- .IsRequired();
-
- b.Property("Title")
- .IsRequired();
-
- b.Property("Uploaded");
-
- b.Property("YTChannelID")
- .IsRequired();
-
- b.Property("YTVideoID")
- .IsRequired();
-
- b.HasKey("VideoId");
-
- b.HasIndex("ChannelId");
-
- b.ToTable("Videos");
- });
-
- modelBuilder.Entity("YTManager.Models.Video", b =>
- {
- b.HasOne("YTManager.Models.Channel", "Channel")
- .WithMany("Videos")
- .HasForeignKey("ChannelId")
- .OnDelete(DeleteBehavior.Cascade);
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/YTManager/Startup.cs b/YTManager/Startup.cs
index e0e3b3a..977dced 100644
--- a/YTManager/Startup.cs
+++ b/YTManager/Startup.cs
@@ -9,7 +9,7 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Hangfire;
-using Hangfire.PostgreSql;
+using Hangfire.MemoryStorage;
using Microsoft.EntityFrameworkCore;
namespace YTManager {
@@ -20,17 +20,14 @@ namespace YTManager {
public IConfiguration Configuration { get; }
- // String used for connecting to the database server.
- public static string dbstr { get; } = "Host=192.168.1.130;Database=postgres;Username=postgres;Password=pass";
-
// ID for periodic job to update all channels.
public static string periodicupdatejobID { get; } = "2013066213";
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services) {
services.AddMvc();
- services.AddHangfire(x => x.UsePostgreSqlStorage(dbstr));
- services.AddDbContext(options => options.UseNpgsql(dbstr));
+ services.AddHangfire(x => x.UseMemoryStorage());
+ services.AddDbContext(options => options.UseInMemoryDatabase(databaseName: "testdb"));
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
diff --git a/YTManager/Tasks/FetchVideos.cs b/YTManager/Tasks/FetchVideos.cs
index b6251d8..17a7425 100644
--- a/YTManager/Tasks/FetchVideos.cs
+++ b/YTManager/Tasks/FetchVideos.cs
@@ -20,7 +20,7 @@ namespace YTManager.Tasks
// Get all the channels to update.
var ops = new DbContextOptionsBuilder();
- ops.UseNpgsql(YTManager.Startup.dbstr);
+ ops.UseInMemoryDatabase(databaseName: "testdb");
using (var dbcontext = new MediaDB(ops.Options)) {
// Get all the potential relevant channels.
List channels;
diff --git a/YTManager/YTManager.csproj b/YTManager/YTManager.csproj
index f34f742..c10495d 100644
--- a/YTManager/YTManager.csproj
+++ b/YTManager/YTManager.csproj
@@ -5,23 +5,21 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
+
+