-
-
Notifications
You must be signed in to change notification settings - Fork 466
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/master' into named-parameters
- Loading branch information
Showing
24 changed files
with
747 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/CoreTests/Bugs/Bug_3603_migration_of_soft_deleted_partitions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using System.Threading.Tasks; | ||
using Marten.Testing.Documents; | ||
using Marten.Testing.Harness; | ||
using Xunit; | ||
|
||
namespace CoreTests.Bugs; | ||
|
||
public class Bug_3603_migration_of_soft_deleted_partitions : BugIntegrationContext | ||
{ | ||
[Fact] | ||
public async Task do_not_repeatedly_patch() | ||
{ | ||
// Weasel has been erroneously "finding" deltas when it should not | ||
|
||
StoreOptions(opts => | ||
{ | ||
opts.Schema.For<Target>().SoftDeletedWithPartitioningAndIndex(); | ||
|
||
opts.Events.UseArchivedStreamPartitioning = true; | ||
}); | ||
|
||
await theStore.Storage.ApplyAllConfiguredChangesToDatabaseAsync(); | ||
|
||
await theStore.Storage.Database.AssertDatabaseMatchesConfigurationAsync(); | ||
|
||
var store2 = SeparateStore(opts => | ||
{ | ||
opts.Schema.For<Target>().SoftDeletedWithPartitioningAndIndex(); | ||
opts.Events.UseArchivedStreamPartitioning = true; | ||
}); | ||
|
||
await store2.Storage.Database.AssertDatabaseMatchesConfigurationAsync(); | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
src/CoreTests/Partitioning/partitioning_and_foreign_keys.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
using System.Threading.Tasks; | ||
using Marten.Testing.Documents; | ||
using Marten.Testing.Harness; | ||
using Shouldly; | ||
using Weasel.Postgresql.Tables; | ||
using Xunit; | ||
|
||
namespace CoreTests.Partitioning; | ||
|
||
public class partitioning_and_foreign_keys : OneOffConfigurationsContext | ||
{ | ||
/* | ||
* Partitioned to partitioned | ||
* Not partitioned to partitioned | ||
* | ||
* | ||
* | ||
*/ | ||
|
||
[Fact] | ||
public async Task from_partitioned_to_not_partitioned() | ||
{ | ||
StoreOptions(opts => | ||
{ | ||
opts.Schema.For<Issue>() | ||
.SoftDeletedWithPartitioningAndIndex() | ||
.ForeignKey<User>(x => x.AssigneeId); | ||
}); | ||
|
||
await theStore.Storage.ApplyAllConfiguredChangesToDatabaseAsync(); | ||
await theStore.Storage.Database.AssertDatabaseMatchesConfigurationAsync(); | ||
} | ||
|
||
[Fact] | ||
public async Task from_partitioned_to_partitioned() | ||
{ | ||
StoreOptions(opts => | ||
{ | ||
opts.Schema.For<Issue>() | ||
.SoftDeletedWithPartitioningAndIndex() | ||
.ForeignKey<User>(x => x.AssigneeId); | ||
|
||
opts.Schema.For<User>().SoftDeletedWithPartitioningAndIndex(); | ||
}); | ||
|
||
await theStore.Storage.ApplyAllConfiguredChangesToDatabaseAsync(); | ||
await theStore.Storage.Database.AssertDatabaseMatchesConfigurationAsync(); | ||
} | ||
|
||
[Fact] | ||
public async Task from_not_partitioned_to_partitioned() | ||
{ | ||
StoreOptions(opts => | ||
{ | ||
opts.Schema.For<Issue>() | ||
.ForeignKey<User>(x => x.AssigneeId); | ||
|
||
opts.Schema.For<User>().SoftDeletedWithPartitioningAndIndex(); | ||
}); | ||
|
||
await Should.ThrowAsync<InvalidForeignKeyException>(async () => | ||
{ | ||
await theStore.Storage.ApplyAllConfiguredChangesToDatabaseAsync(); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.