Making sqlite work

This commit is contained in:
Zoe Roux 2021-05-29 15:10:59 +02:00
parent 19e64e8d72
commit d05e7a24b7
7 changed files with 36 additions and 21 deletions

View File

@ -8,14 +8,14 @@
<LangVersion>default</LangVersion>
</PropertyGroup>
<PropertyGroup>
<OutputPath>../Kyoo/bin/$(Configuration)/$(TargetFramework)/plugins/postgresql</OutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
<GenerateDependencyFile>false</GenerateDependencyFile>
<GenerateRuntimeConfigurationFiles>false</GenerateRuntimeConfigurationFiles>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>
<!-- <PropertyGroup>-->
<!-- <OutputPath>../Kyoo/bin/$(Configuration)/$(TargetFramework)/plugins/postgresql</OutputPath>-->
<!-- <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>-->
<!-- <ProduceReferenceAssembly>false</ProduceReferenceAssembly>-->
<!-- <GenerateDependencyFile>false</GenerateDependencyFile>-->
<!-- <GenerateRuntimeConfigurationFiles>false</GenerateRuntimeConfigurationFiles>-->
<!-- <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>-->
<!-- </PropertyGroup>-->
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.5">

View File

@ -6,17 +6,17 @@
<Authors>Zoe Roux</Authors>
<RepositoryUrl>https://github.com/AnonymusRaccoon/Kyoo</RepositoryUrl>
<LangVersion>default</LangVersion>
<RootNamespace>Kyoo.SQLite</RootNamespace>
<RootNamespace>Kyoo.SqLite</RootNamespace>
</PropertyGroup>
<PropertyGroup>
<OutputPath>../Kyoo/bin/$(Configuration)/$(TargetFramework)/plugins/sqlite</OutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
<GenerateDependencyFile>false</GenerateDependencyFile>
<GenerateRuntimeConfigurationFiles>false</GenerateRuntimeConfigurationFiles>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>
<!-- <PropertyGroup>-->
<!-- <OutputPath>../Kyoo/bin/$(Configuration)/$(TargetFramework)/plugins/sqlite</OutputPath>-->
<!-- <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>-->
<!-- <ProduceReferenceAssembly>false</ProduceReferenceAssembly>-->
<!-- <GenerateDependencyFile>false</GenerateDependencyFile>-->
<!-- <GenerateRuntimeConfigurationFiles>false</GenerateRuntimeConfigurationFiles>-->
<!-- <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>-->
<!-- </PropertyGroup>-->
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.5">

View File

@ -68,5 +68,12 @@ namespace Kyoo.SqLite
x.EnableDetailedErrors().EnableSensitiveDataLogging();
});
}
/// <inheritdoc />
public void Initialize(IServiceProvider provider)
{
DatabaseContext context = provider.GetRequiredService<DatabaseContext>();
context.Database.Migrate();
}
}
}

View File

@ -14,7 +14,6 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="5.0.5" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">

View File

@ -46,6 +46,9 @@
<!-- <ExcludeAssets>all</ExcludeAssets>-->
</ProjectReference>
<ProjectReference Include="../Kyoo.Authentication/Kyoo.Authentication.csproj">
<!-- <ExcludeAssets>all</ExcludeAssets>-->
</ProjectReference>
<ProjectReference Include="../Kyoo.SqLite/Kyoo.SqLite.csproj">
<!-- <ExcludeAssets>all</ExcludeAssets>-->
</ProjectReference>
</ItemGroup>

View File

@ -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)
});
}

View File

@ -10,6 +10,10 @@
},
"database": {
"sqlite": {
"data Source": "kyoo.db",
"cache": "Shared"
},
"postgres": {
"server": "127.0.0.1",
"port": "5432",