Convert Database projects so they build installable Packages rather than deploy to bin and modify installation to deploy Databases on demand as needed.
This commit is contained in:
@ -1,18 +1,34 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<LangVersion>9</LangVersion>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
<Version>1.0.0</Version>
|
||||
<NuspecFile>$(MSBuildProjectName).nuspec</NuspecFile>
|
||||
<PackageName>$(MSBuildProjectName).$(Version).nupkg</PackageName>
|
||||
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="EFCore.NamingConventions" Version="5.0.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.4" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="5.0.2" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<OutputPath>bin</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Oqtane.Shared\Oqtane.Shared.csproj" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<OutputPath>bin</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="EFCore.NamingConventions" Version="5.0.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.4" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="5.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Oqtane.Server\Oqtane.Server.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="CopyPackage" AfterTargets="Pack">
|
||||
<Copy SourceFiles="$(OutputPath)..\$(PackageName)" DestinationFiles="..\Oqtane.Server\wwwroot\Packages\$(PackageName).bak" />
|
||||
</Target>
|
||||
</Project>
|
||||
|
26
Oqtane.Database.PostgreSQL/Oqtane.Database.PostgreSQL.nuspec
Normal file
26
Oqtane.Database.PostgreSQL/Oqtane.Database.PostgreSQL.nuspec
Normal file
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>Oqtane.Database.PostgreSQL</id>
|
||||
<version>1.0.0</version>
|
||||
<authors>Shaun Walker</authors>
|
||||
<owners>.NET Foundation</owners>
|
||||
<title>Oqtane PostgreSQL Provider</title>
|
||||
<description>Add support for PostgreSQL to the Oqtane Framework</description>
|
||||
<copyright>.NET Foundation</copyright>
|
||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||
<license type="expression">MIT</license>
|
||||
<projectUrl>https://github.com/oqtane/oqtane.framework</projectUrl>
|
||||
<iconUrl>https://www.oqtane.org/Portals/0/icon.jpg</iconUrl>
|
||||
<tags>oqtane</tags>
|
||||
<releaseNotes>https://github.com/oqtane/oqtane.framework/releases/tag/v2.0.2</releaseNotes>
|
||||
<summary>Add support for PostgreSQL to the Oqtane Framework</summary>
|
||||
</metadata>
|
||||
<files>
|
||||
<file src="bin\net5.0\Oqtane.Database.PostgreSQL.dll" target="lib\net5.0" />
|
||||
<file src="bin\net5.0\Oqtane.Database.PostgreSQL.pdb" target="lib\net5.0" />
|
||||
<file src="bin\net5.0\EFCore.NamingConventions.dll" target="lib\net5.0" />
|
||||
<file src="bin\net5.0\Npgsql.EntityFrameworkCore.PostgreSQL.dll" target="lib\net5.0" />
|
||||
<file src="bin\net5.0\Npgsql.dll" target="lib\net5.0" />
|
||||
</files>
|
||||
</package>
|
@ -7,6 +7,7 @@ using Microsoft.EntityFrameworkCore.Migrations.Operations;
|
||||
using Microsoft.EntityFrameworkCore.Migrations.Operations.Builders;
|
||||
using Npgsql;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using Oqtane.Databases;
|
||||
using Oqtane.Shared;
|
||||
|
||||
namespace Oqtane.Database.PostgreSQL
|
||||
@ -17,15 +18,11 @@ namespace Oqtane.Database.PostgreSQL
|
||||
|
||||
private static string _name => "PostgreSQL";
|
||||
|
||||
private readonly static string _typeName;
|
||||
|
||||
private readonly INameRewriter _rewriter;
|
||||
|
||||
static PostgreSQLDatabase()
|
||||
{
|
||||
var typeQualifiedName = typeof(PostgreSQLDatabase).AssemblyQualifiedName;
|
||||
|
||||
_typeName = typeQualifiedName.Substring(0, typeQualifiedName.IndexOf(", Version"));
|
||||
Initialize(typeof(PostgreSQLDatabase));
|
||||
}
|
||||
|
||||
public PostgreSQLDatabase() : base(_name, _friendlyName)
|
||||
@ -35,8 +32,6 @@ namespace Oqtane.Database.PostgreSQL
|
||||
|
||||
public override string Provider => "Npgsql.EntityFrameworkCore.PostgreSQL";
|
||||
|
||||
public override string TypeName => _typeName;
|
||||
|
||||
public override OperationBuilder<AddColumnOperation> AddAutoIncrementColumn(ColumnsBuilder table, string name)
|
||||
{
|
||||
return table.Column<int>(name: name, nullable: false).Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityAlwaysColumn);
|
||||
|
Reference in New Issue
Block a user