Replaced postgres with memory store, updated deps
This commit is contained in:
parent
ebe2205e5d
commit
b44eedfc2a
@ -1,89 +0,0 @@
|
||||
// <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("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<long>("ChannelId")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired();
|
||||
|
||||
b.Property<string>("ThumbnailURL")
|
||||
.IsRequired();
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired();
|
||||
|
||||
b.Property<string>("YTChannelID")
|
||||
.IsRequired();
|
||||
|
||||
b.HasKey("ChannelId");
|
||||
|
||||
b.ToTable("Channels");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("YTManager.Models.Video", b =>
|
||||
{
|
||||
b.Property<long>("VideoId")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<DateTime>("AddedtoDB");
|
||||
|
||||
b.Property<long>("ChannelId");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired();
|
||||
|
||||
b.Property<string>("ThumbnailURL")
|
||||
.IsRequired();
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired();
|
||||
|
||||
b.Property<DateTime>("Uploaded");
|
||||
|
||||
b.Property<string>("YTChannelID")
|
||||
.IsRequired();
|
||||
|
||||
b.Property<string>("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
|
||||
}
|
||||
}
|
||||
}
|
@ -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<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");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,88 +0,0 @@
|
||||
// <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))]
|
||||
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<long>("ChannelId")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired();
|
||||
|
||||
b.Property<string>("ThumbnailURL")
|
||||
.IsRequired();
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired();
|
||||
|
||||
b.Property<string>("YTChannelID")
|
||||
.IsRequired();
|
||||
|
||||
b.HasKey("ChannelId");
|
||||
|
||||
b.ToTable("Channels");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("YTManager.Models.Video", b =>
|
||||
{
|
||||
b.Property<long>("VideoId")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<DateTime>("AddedtoDB");
|
||||
|
||||
b.Property<long>("ChannelId");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired();
|
||||
|
||||
b.Property<string>("ThumbnailURL")
|
||||
.IsRequired();
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired();
|
||||
|
||||
b.Property<DateTime>("Uploaded");
|
||||
|
||||
b.Property<string>("YTChannelID")
|
||||
.IsRequired();
|
||||
|
||||
b.Property<string>("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
|
||||
}
|
||||
}
|
||||
}
|
@ -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<MediaDB>(options => options.UseNpgsql(dbstr));
|
||||
services.AddHangfire(x => x.UseMemoryStorage());
|
||||
services.AddDbContext<MediaDB>(options => options.UseInMemoryDatabase(databaseName: "testdb"));
|
||||
}
|
||||
|
||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||
|
@ -20,7 +20,7 @@ namespace YTManager.Tasks
|
||||
|
||||
// Get all the channels to update.
|
||||
var ops = new DbContextOptionsBuilder<MediaDB>();
|
||||
ops.UseNpgsql(YTManager.Startup.dbstr);
|
||||
ops.UseInMemoryDatabase(databaseName: "testdb");
|
||||
using (var dbcontext = new MediaDB(ops.Options)) {
|
||||
// Get all the potential relevant channels.
|
||||
List<Models.Channel> channels;
|
||||
|
@ -5,23 +5,21 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Google.Apis.YouTube.v3" Version="1.29.0.760" />
|
||||
<PackageReference Include="Hangfire" Version="1.6.15" />
|
||||
<PackageReference Include="Hangfire.AspNetCore" Version="1.6.15" />
|
||||
<PackageReference Include="Hangfire.PostgreSql" Version="1.4.8.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="2.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.0.0" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.0" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="2.0.0" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL.Design" Version="1.1.1" />
|
||||
<PackageReference Include="Google.Apis.YouTube.v3" Version="1.32.2.1131" />
|
||||
<PackageReference Include="Hangfire" Version="1.6.17"/>
|
||||
<PackageReference Include="Hangfire.AspNetCore" Version="1.6.17" />
|
||||
<PackageReference Include="Hangfire.MemoryStorage.Core" Version="1.4.0"/>
|
||||
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.5" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="2.0.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.0.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.0.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.0.1" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
|
||||
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.0" />
|
||||
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.2" />
|
||||
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
Loading…
Reference in New Issue
Block a user