-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ac5623e
commit d7a308f
Showing
13 changed files
with
988 additions
and
11 deletions.
There are no files selected for viewing
646 changes: 646 additions & 0 deletions
646
server/src/Korga.Server/Migrations/20240121221944_PersonFilterTree.Designer.cs
Large diffs are not rendered by default.
Oops, something went wrong.
140 changes: 140 additions & 0 deletions
140
server/src/Korga.Server/Migrations/20240121221944_PersonFilterTree.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,140 @@ | ||
using Microsoft.EntityFrameworkCore.Migrations; | ||
|
||
#nullable disable | ||
|
||
namespace Korga.Server.Migrations | ||
{ | ||
/// <inheritdoc /> | ||
public partial class PersonFilterTree : Migration | ||
{ | ||
/// <inheritdoc /> | ||
protected override void Up(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.DropForeignKey( | ||
name: "FK_PersonFilters_DistributionLists_DistributionListId", | ||
table: "PersonFilters"); | ||
|
||
migrationBuilder.DropIndex( | ||
name: "IX_PersonFilters_DistributionListId", | ||
table: "PersonFilters"); | ||
|
||
migrationBuilder.DropColumn( | ||
name: "DistributionListId", | ||
table: "PersonFilters"); | ||
|
||
migrationBuilder.AddColumn<int>( | ||
name: "GroupTypeId", | ||
table: "PersonFilters", | ||
type: "int", | ||
nullable: true); | ||
|
||
migrationBuilder.AddColumn<long>( | ||
name: "ParentId", | ||
table: "PersonFilters", | ||
type: "bigint", | ||
nullable: true); | ||
|
||
migrationBuilder.AddColumn<long>( | ||
name: "PermittedRecipientsId", | ||
table: "DistributionLists", | ||
type: "bigint", | ||
nullable: true); | ||
|
||
migrationBuilder.CreateIndex( | ||
name: "IX_PersonFilters_GroupTypeId", | ||
table: "PersonFilters", | ||
column: "GroupTypeId"); | ||
|
||
migrationBuilder.CreateIndex( | ||
name: "IX_PersonFilters_ParentId", | ||
table: "PersonFilters", | ||
column: "ParentId"); | ||
|
||
migrationBuilder.CreateIndex( | ||
name: "IX_DistributionLists_PermittedRecipientsId", | ||
table: "DistributionLists", | ||
column: "PermittedRecipientsId"); | ||
|
||
migrationBuilder.AddForeignKey( | ||
name: "FK_DistributionLists_PersonFilters_PermittedRecipientsId", | ||
table: "DistributionLists", | ||
column: "PermittedRecipientsId", | ||
principalTable: "PersonFilters", | ||
principalColumn: "Id"); | ||
|
||
migrationBuilder.AddForeignKey( | ||
name: "FK_PersonFilters_GroupTypes_GroupTypeId", | ||
table: "PersonFilters", | ||
column: "GroupTypeId", | ||
principalTable: "GroupTypes", | ||
principalColumn: "Id"); | ||
|
||
migrationBuilder.AddForeignKey( | ||
name: "FK_PersonFilters_PersonFilters_ParentId", | ||
table: "PersonFilters", | ||
column: "ParentId", | ||
principalTable: "PersonFilters", | ||
principalColumn: "Id"); | ||
} | ||
|
||
/// <inheritdoc /> | ||
protected override void Down(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.DropForeignKey( | ||
name: "FK_DistributionLists_PersonFilters_PermittedRecipientsId", | ||
table: "DistributionLists"); | ||
|
||
migrationBuilder.DropForeignKey( | ||
name: "FK_PersonFilters_GroupTypes_GroupTypeId", | ||
table: "PersonFilters"); | ||
|
||
migrationBuilder.DropForeignKey( | ||
name: "FK_PersonFilters_PersonFilters_ParentId", | ||
table: "PersonFilters"); | ||
|
||
migrationBuilder.DropIndex( | ||
name: "IX_PersonFilters_GroupTypeId", | ||
table: "PersonFilters"); | ||
|
||
migrationBuilder.DropIndex( | ||
name: "IX_PersonFilters_ParentId", | ||
table: "PersonFilters"); | ||
|
||
migrationBuilder.DropIndex( | ||
name: "IX_DistributionLists_PermittedRecipientsId", | ||
table: "DistributionLists"); | ||
|
||
migrationBuilder.DropColumn( | ||
name: "GroupTypeId", | ||
table: "PersonFilters"); | ||
|
||
migrationBuilder.DropColumn( | ||
name: "ParentId", | ||
table: "PersonFilters"); | ||
|
||
migrationBuilder.DropColumn( | ||
name: "PermittedRecipientsId", | ||
table: "DistributionLists"); | ||
|
||
migrationBuilder.AddColumn<long>( | ||
name: "DistributionListId", | ||
table: "PersonFilters", | ||
type: "bigint", | ||
nullable: false, | ||
defaultValue: 0L); | ||
|
||
migrationBuilder.CreateIndex( | ||
name: "IX_PersonFilters_DistributionListId", | ||
table: "PersonFilters", | ||
column: "DistributionListId"); | ||
|
||
migrationBuilder.AddForeignKey( | ||
name: "FK_PersonFilters_DistributionLists_DistributionListId", | ||
table: "PersonFilters", | ||
column: "DistributionListId", | ||
principalTable: "DistributionLists", | ||
principalColumn: "Id", | ||
onDelete: ReferentialAction.Cascade); | ||
} | ||
} | ||
} |
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
11 changes: 11 additions & 0 deletions
11
server/tests/Korga.Server.Tests/Migrations/08_GroupMemberStatus/DatabaseContext.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,11 @@ | ||
using Microsoft.EntityFrameworkCore; | ||
|
||
namespace Korga.Server.Tests.Migrations.GroupMemberStatus; | ||
|
||
public class DatabaseContext : DbContext | ||
{ | ||
public DatabaseContext(DbContextOptions<DatabaseContext> options) : base(options) { } | ||
|
||
public DbSet<DistributionList> DistributionLists => Set<DistributionList>(); | ||
public DbSet<PersonFilter> PersonFilters => Set<PersonFilter>(); | ||
} |
8 changes: 8 additions & 0 deletions
8
server/tests/Korga.Server.Tests/Migrations/08_GroupMemberStatus/DistributionList.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,8 @@ | ||
namespace Korga.Server.Tests.Migrations.GroupMemberStatus; | ||
|
||
public class DistributionList | ||
{ | ||
public required long Id { get; set; } | ||
public required string Alias { get; set; } | ||
public int Flags { get; set; } | ||
} |
12 changes: 12 additions & 0 deletions
12
server/tests/Korga.Server.Tests/Migrations/08_GroupMemberStatus/GroupFilter.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,12 @@ | ||
using Korga.ChurchTools.Entities; | ||
|
||
namespace Korga.Server.Tests.Migrations.GroupMemberStatus; | ||
|
||
public class GroupFilter : PersonFilter | ||
{ | ||
public Group? Group { get; set; } | ||
public int GroupId { get; set; } | ||
|
||
public GroupRole? GroupRole { get; set; } | ||
public int? GroupRoleId { get; set; } | ||
} |
8 changes: 8 additions & 0 deletions
8
server/tests/Korga.Server.Tests/Migrations/08_GroupMemberStatus/PersonFilter.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,8 @@ | ||
namespace Korga.Server.Tests.Migrations.GroupMemberStatus; | ||
|
||
public abstract class PersonFilter | ||
{ | ||
public long Id { get; set; } | ||
public long DistributionListId { get; set; } | ||
public DistributionList? DistributionList { get; set; } | ||
} |
9 changes: 9 additions & 0 deletions
9
server/tests/Korga.Server.Tests/Migrations/08_GroupMemberStatus/SinglePerson.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,9 @@ | ||
using Korga.ChurchTools.Entities; | ||
|
||
namespace Korga.Server.Tests.Migrations.GroupMemberStatus; | ||
|
||
public class SinglePerson : PersonFilter | ||
{ | ||
public Person? Person { get; set; } | ||
public int PersonId { get; set; } | ||
} |
9 changes: 9 additions & 0 deletions
9
server/tests/Korga.Server.Tests/Migrations/08_GroupMemberStatus/StatusFilter.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,9 @@ | ||
using Korga.ChurchTools.Entities; | ||
|
||
namespace Korga.Server.Tests.Migrations.GroupMemberStatus; | ||
|
||
public class StatusFilter : PersonFilter | ||
{ | ||
public Status? Status { get; set; } | ||
public int StatusId { get; set; } | ||
} |
11 changes: 11 additions & 0 deletions
11
server/tests/Korga.Server.Tests/Migrations/09_PersonFilterTree/DatabaseContext.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,11 @@ | ||
using Microsoft.EntityFrameworkCore; | ||
|
||
namespace Korga.Server.Tests.Migrations.PersonFilterTree; | ||
|
||
public class DatabaseContext : DbContext | ||
{ | ||
public DatabaseContext(DbContextOptions<DatabaseContext> options) : base(options) { } | ||
|
||
public DbSet<DistributionList> DistributionLists => Set<DistributionList>(); | ||
public DbSet<PersonFilter> PersonFilters => Set<PersonFilter>(); | ||
} |
9 changes: 9 additions & 0 deletions
9
server/tests/Korga.Server.Tests/Migrations/09_PersonFilterTree/DistributionList.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,9 @@ | ||
namespace Korga.Server.Tests.Migrations.PersonFilterTree; | ||
|
||
public class DistributionList | ||
{ | ||
public required long Id { get; set; } | ||
public required string Alias { get; set; } | ||
public int Flags { get; set; } | ||
public long? PermittedRecipientsId { get; set; } | ||
} |
9 changes: 9 additions & 0 deletions
9
server/tests/Korga.Server.Tests/Migrations/09_PersonFilterTree/PersonFilter.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,9 @@ | ||
namespace Korga.Server.Tests.Migrations.PersonFilterTree; | ||
|
||
public abstract class PersonFilter | ||
{ | ||
public long Id { get; set; } | ||
|
||
public long? ParentId { get; set; } | ||
public PersonFilter? Parent { get; set; } | ||
} |
Oops, something went wrong.