mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-07-09 03:04:20 -04:00
Auto creating the database on first start
This commit is contained in:
parent
e670025514
commit
15833b519f
@ -2,7 +2,6 @@
|
||||
using Kyoo.Models.Watch;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Kyoo.Controllers
|
||||
{
|
||||
|
@ -16,6 +16,10 @@ namespace Kyoo
|
||||
Console.WriteLine($"Running as: {Environment.UserName}");
|
||||
using (IServiceScope serviceScope = host.Services.CreateScope())
|
||||
{
|
||||
serviceScope.ServiceProvider.GetService<DatabaseContext>().Database.EnsureCreated();;
|
||||
// Use the next line if the database is not SQLite (SQLite doesn't support complexe migrations).
|
||||
// serviceScope.ServiceProvider.GetService<DatabaseContext>().Database.Migrate();;
|
||||
|
||||
IPluginManager pluginManager = serviceScope.ServiceProvider.GetService<IPluginManager>();
|
||||
pluginManager.ReloadPlugins();
|
||||
|
||||
|
@ -48,7 +48,7 @@ namespace Kyoo
|
||||
}
|
||||
|
||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, DatabaseContext database)
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||
{
|
||||
if (env.IsDevelopment())
|
||||
{
|
||||
@ -94,10 +94,6 @@ namespace Kyoo
|
||||
spa.UseAngularCliServer(npmScript: "start");
|
||||
}
|
||||
});
|
||||
|
||||
database.Database.EnsureCreated();;
|
||||
// Use the next line if the database is not SQLite (SQLite doesn't support complexe migrations).
|
||||
// database.Database.Migrate();;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user