Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ jobs:
run: ./build.sh test-patching
shell: bash

- name: test-value-types
if: ${{ success() || failure() }}
run: ./build.sh test-value-types
shell: bash
#- name: test-value-types
# if: ${{ success() || failure() }}
# run: ./build.sh test-value-types
# shell: bash

- name: test-code-gen
if: ${{ success() || failure() }}
Expand All @@ -129,7 +129,7 @@ jobs:
run: ./build.sh test-noda-time
shell: bash

- name: test-aspnet-core
if: ${{ success() || failure() }}
run: ./build.sh test-aspnet-core
shell: bash
#- name: test-aspnet-core
# if: ${{ success() || failure() }}
# run: ./build.sh test-aspnet-core
# shell: bash
2 changes: 1 addition & 1 deletion src/CoreTests/StoreOptionsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ public void default_ddl_rules()
{
var options = new StoreOptions();

options.Advanced.Migrator.TableCreation.ShouldBe(CreationStyle.DropThenCreate);
options.Advanced.Migrator.TableCreation.ShouldBe(CreationStyle.CreateIfNotExists);
options.Advanced.Migrator.UpsertRights.ShouldBe(SecurityRights.Invoker);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

namespace DocumentDbTests.Bugs;

public class Bug_1338_Validate_Null_ForeignKeyDefinition_ReferenceDocumenType: BugIntegrationContext, IAsyncLifetime
public class Bug_1338_Validate_Null_ForeignKeyDefinition_ReferenceDocumenType: OneOffConfigurationsContext, IAsyncLifetime
{
[Fact]
public void StorageFeatures_AllActiveFeatures_Should_Not_Throw_With_ExternalForeignKeyDefinitions()
Expand All @@ -23,22 +23,27 @@ public void StorageFeatures_AllActiveFeatures_Should_Not_Throw_With_ExternalFore

public async Task InitializeAsync()
{
var table = new Table(new PostgresqlObjectName(SchemaName, "external_table"));
var table = new Table(new PostgresqlObjectName("other", "external_table"));
table.AddColumn("id", "integer").AsPrimaryKey();

await using var dbConn = new NpgsqlConnection(ConnectionSource.ConnectionString);
await dbConn.OpenAsync();

await dbConn.DropSchemaAsync("other");
await dbConn.CreateSchemaAsync("other");

await table.CreateAsync(dbConn);

await dbConn.CreateCommand("insert into bugs.external_table (id) values (1)").ExecuteNonQueryAsync();
await dbConn.CreateCommand("delete from other.external_table").ExecuteNonQueryAsync();
await dbConn.CreateCommand("insert into other.external_table (id) values (1)").ExecuteNonQueryAsync();

await dbConn.CloseAsync();

StoreOptions(_ =>
StoreOptions(opts =>
{
_.Schema.For<ClassWithExternalForeignKey>()
.ForeignKey(x => x.ForeignId, _.DatabaseSchemaName, "external_table", "id");
}, false);
opts.Schema.For<ClassWithExternalForeignKey>()
.ForeignKey(x => x.ForeignId, "other", "external_table", "id");
}, true);

await theStore.Advanced.Clean.DeleteDocumentsByTypeAsync(typeof(ClassWithExternalForeignKey));
}
Expand Down
2 changes: 1 addition & 1 deletion src/Marten/Marten.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<!-- This is forced by Npgsql peer dependency -->
<PackageReference Include="Npgsql.Json.NET" Version="9.0.4" />
<PackageReference Include="Weasel.Postgresql" Version="8.4.3" />
<PackageReference Include="Weasel.Postgresql" Version="8.5.0" />
</ItemGroup>


Expand Down
8 changes: 5 additions & 3 deletions src/Marten/Schema/Arguments/ExpectedVersionArgument.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System;
using System.Reflection;
using JasperFx.CodeGeneration;
using JasperFx.CodeGeneration.Model;
using JasperFx.Core.Reflection;
using NpgsqlTypes;

namespace Marten.Schema.Arguments;
Expand All @@ -27,7 +29,7 @@ public override void GenerateBulkWriterCodeAsync(GeneratedType type, GeneratedMe
}
else
{
load.Frames.Code("writer.Write(DBNull.Value, {0});", NpgsqlDbType.Uuid);
load.Frames.Code($"writer.Write({typeof(DBNull).FullNameInCode()}.Value, {0});", NpgsqlDbType.Uuid);
}
}

Expand All @@ -36,14 +38,14 @@ private void writeGuidExpectedVersion(GeneratedMethod load, MemberInfo member)
var memberName = member.Name;
var dbTypeUsage = Constant.ForEnum(NpgsqlDbType.Uuid).Usage;
load.Frames.Code(
$"writer.Write(document.{memberName} == Guid.Empty ? (object)DBNull.Value : (object)document.{memberName}, {dbTypeUsage});");
$"writer.Write(document.{memberName} == Guid.Empty ? (object){typeof(DBNull).FullNameInCode()}.Value : (object)document.{memberName}, {dbTypeUsage});");
}

private void writeIntExpectedVersion(GeneratedMethod load, MemberInfo member)
{
var memberName = member.Name;
var dbTypeUsage = Constant.ForEnum(NpgsqlDbType.Integer).Usage;
load.Frames.Code(
$"writer.Write(document.{memberName} <= 0 ? (object)DBNull.Value : (object)document.{memberName}, {dbTypeUsage});");
$"writer.Write(document.{memberName} <= 0 ? (object){typeof(DBNull).FullNameInCode()}.Value : (object)document.{memberName}, {dbTypeUsage});");
}
}
Loading