-
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 34725f7
Showing
28 changed files
with
1,192 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
18 changes: 18 additions & 0 deletions
18
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,18 @@ | ||
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>(); | ||
|
||
public DbSet<Person> People => Set<Person>(); | ||
public DbSet<Group> Groups => Set<Group>(); | ||
public DbSet<GroupRole> GroupRoles => Set<GroupRole>(); | ||
public DbSet<GroupType> GroupTypes => Set<GroupType>(); | ||
public DbSet<GroupStatus> GroupStatuses => Set<GroupStatus>(); | ||
public DbSet<Status> Status => Set<Status>(); | ||
} |
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; } | ||
} |
16 changes: 16 additions & 0 deletions
16
server/tests/Korga.Server.Tests/Migrations/08_GroupMemberStatus/Group.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,16 @@ | ||
using System; | ||
|
||
namespace Korga.Server.Tests.Migrations.GroupMemberStatus; | ||
|
||
public class Group | ||
{ | ||
public int Id { get; set; } | ||
|
||
public GroupType? GroupType { get; set; } | ||
public int GroupTypeId { get; set; } | ||
public GroupStatus? GroupStatus { get; set; } | ||
public int GroupStatusId { get; set; } | ||
|
||
public required string Name { get; set; } | ||
public DateTime DeletionTime { get; set; } | ||
} |
10 changes: 10 additions & 0 deletions
10
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,10 @@ | ||
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; } | ||
} |
14 changes: 14 additions & 0 deletions
14
server/tests/Korga.Server.Tests/Migrations/08_GroupMemberStatus/GroupRole.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,14 @@ | ||
using System; | ||
|
||
namespace Korga.Server.Tests.Migrations.GroupMemberStatus; | ||
|
||
public class GroupRole | ||
{ | ||
public int Id { get; set; } | ||
|
||
public GroupType? GroupType { get; set; } | ||
public int GroupTypeId { get; set; } | ||
|
||
public required string Name { get; set; } | ||
public DateTime DeletionTime { get; set; } | ||
} |
10 changes: 10 additions & 0 deletions
10
server/tests/Korga.Server.Tests/Migrations/08_GroupMemberStatus/GroupStatus.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,10 @@ | ||
using System; | ||
|
||
namespace Korga.Server.Tests.Migrations.GroupMemberStatus; | ||
|
||
public class GroupStatus | ||
{ | ||
public int Id { get; set; } | ||
public required string Name { get; set; } | ||
public DateTime DeletionTime { get; set; } | ||
} |
10 changes: 10 additions & 0 deletions
10
server/tests/Korga.Server.Tests/Migrations/08_GroupMemberStatus/GroupType.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,10 @@ | ||
using System; | ||
|
||
namespace Korga.Server.Tests.Migrations.GroupMemberStatus; | ||
|
||
public class GroupType | ||
{ | ||
public int Id { get; set; } | ||
public required string Name { get; set; } | ||
public DateTime DeletionTime { get; set; } | ||
} |
Oops, something went wrong.