diff --git a/Kyoo.Postgresql/Kyoo.Postgresql.csproj b/Kyoo.Postgresql/Kyoo.Postgresql.csproj index 9dcbba0b..3ef6e4c2 100644 --- a/Kyoo.Postgresql/Kyoo.Postgresql.csproj +++ b/Kyoo.Postgresql/Kyoo.Postgresql.csproj @@ -8,14 +8,14 @@ default - - ../Kyoo/bin/$(Configuration)/$(TargetFramework)/plugins/postgresql - false - false - false - false - true - + + + + + + + + diff --git a/Kyoo.SqLite/Kyoo.SqLite.csproj b/Kyoo.SqLite/Kyoo.SqLite.csproj index c48664bc..43c2634f 100644 --- a/Kyoo.SqLite/Kyoo.SqLite.csproj +++ b/Kyoo.SqLite/Kyoo.SqLite.csproj @@ -6,17 +6,17 @@ Zoe Roux https://github.com/AnonymusRaccoon/Kyoo default - Kyoo.SQLite + Kyoo.SqLite - - ../Kyoo/bin/$(Configuration)/$(TargetFramework)/plugins/sqlite - false - false - false - false - true - + + + + + + + + diff --git a/Kyoo.SqLite/SqLiteModule.cs b/Kyoo.SqLite/SqLiteModule.cs index d9815093..34802b20 100644 --- a/Kyoo.SqLite/SqLiteModule.cs +++ b/Kyoo.SqLite/SqLiteModule.cs @@ -56,8 +56,8 @@ namespace Kyoo.SqLite _configuration = configuration; _environment = env; } - - + + /// public void Configure(IServiceCollection services, ICollection availableTypes) { @@ -68,5 +68,12 @@ namespace Kyoo.SqLite x.EnableDetailedErrors().EnableSensitiveDataLogging(); }); } + + /// + public void Initialize(IServiceProvider provider) + { + DatabaseContext context = provider.GetRequiredService(); + context.Database.Migrate(); + } } } \ No newline at end of file diff --git a/Kyoo.Tests/Kyoo.Tests.csproj b/Kyoo.Tests/Kyoo.Tests.csproj index b5e3dd82..dfb1d2c4 100644 --- a/Kyoo.Tests/Kyoo.Tests.csproj +++ b/Kyoo.Tests/Kyoo.Tests.csproj @@ -14,7 +14,6 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all - diff --git a/Kyoo/Kyoo.csproj b/Kyoo/Kyoo.csproj index 22fd6e21..583341f6 100644 --- a/Kyoo/Kyoo.csproj +++ b/Kyoo/Kyoo.csproj @@ -46,6 +46,9 @@ + + + diff --git a/Kyoo/Startup.cs b/Kyoo/Startup.cs index 8bd517cc..27c05c56 100644 --- a/Kyoo/Startup.cs +++ b/Kyoo/Startup.cs @@ -5,6 +5,7 @@ using Kyoo.Controllers; using Kyoo.Models; using Kyoo.Models.Options; using Kyoo.Postgresql; +using Kyoo.SqLite; using Kyoo.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; @@ -46,7 +47,8 @@ namespace Kyoo // TODO remove postgres from here and load it like a normal plugin. _plugins.LoadPlugins(new IPlugin[] { new CoreModule(configuration), - new PostgresModule(configuration, host), + // new PostgresModule(configuration, host), + new SqLiteModule(configuration, host), new AuthenticationModule(configuration, loggerFactory, host) }); } diff --git a/Kyoo/settings.json b/Kyoo/settings.json index ff7dff63..2ff0e24b 100644 --- a/Kyoo/settings.json +++ b/Kyoo/settings.json @@ -10,6 +10,10 @@ }, "database": { + "sqlite": { + "data Source": "kyoo.db", + "cache": "Shared" + }, "postgres": { "server": "127.0.0.1", "port": "5432",