add authority, role and groups
This commit is contained in:
parent
ba8ffef213
commit
3de2489b8a
@ -31,15 +31,17 @@ public partial class Invoker
|
||||
SubjectId = sub.GetValueOrDefault(),
|
||||
TenantAuthorityDictionary = claimsPrincipal.Claims
|
||||
.Where(x => TenantAuthorityRegex().IsMatch(x.Type))
|
||||
.GroupBy(x => AppAuthorityRegex().Match(x.Type).Groups["id"].Value)
|
||||
.ToImmutableDictionary(
|
||||
x => TenantAuthorityRegex().Match(x.Type).Groups["id"].Value,
|
||||
x => claimsPrincipal.Claims.Where(y => y.Type == x.Type).Select(y => y.Value).ToHashSet()
|
||||
x => x.Key,
|
||||
x => x.Select(y => y.Value).ToHashSet()
|
||||
),
|
||||
AppAuthorityDictionary = claimsPrincipal.Claims
|
||||
.Where(x => AppAuthorityRegex().IsMatch(x.Type))
|
||||
.GroupBy(x => AppAuthorityRegex().Match(x.Type).Groups["id"].Value)
|
||||
.ToImmutableDictionary(
|
||||
x => AppAuthorityRegex().Match(x.Type).Groups["id"].Value,
|
||||
x => claimsPrincipal.Claims.Where(y => y.Type == x.Type).Select(y => y.Value).ToHashSet()
|
||||
x => x.Key,
|
||||
x => x.Select(y => y.Value).ToHashSet()
|
||||
),
|
||||
IsAuthenticated = claimsPrincipal.Identity.IsAuthenticated
|
||||
};
|
||||
|
||||
@ -0,0 +1,30 @@
|
||||
using HashidsNet;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Suspectus.Gandalf.Palantir.Data.Database;
|
||||
|
||||
namespace Suspectus.Gandalf.Palantir.Api.Controllers;
|
||||
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
[Authorize]
|
||||
public class AuthorityController : ControllerBase
|
||||
{
|
||||
private readonly ApplicationContext _context;
|
||||
private readonly IHashids _hashids;
|
||||
|
||||
public AuthorityController(ApplicationContext context, IHashids hashids)
|
||||
{
|
||||
_context = context;
|
||||
_hashids = hashids;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> Get(CancellationToken cancellationToken)
|
||||
{
|
||||
var authorities = await _context.Authorities.ToListAsync(cancellationToken: cancellationToken);
|
||||
var globalAuthorities = await _context.GlobalAuthorities.ToListAsync(cancellationToken: cancellationToken);
|
||||
return Ok(new {authorities, globalAuthorities});
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
using HashidsNet;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Suspectus.Gandalf.Palantir.Data.Database;
|
||||
|
||||
namespace Suspectus.Gandalf.Palantir.Api.Controllers;
|
||||
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
[Authorize]
|
||||
public class GroupController : ControllerBase
|
||||
{
|
||||
private readonly ApplicationContext _context;
|
||||
private readonly IHashids _hashids;
|
||||
|
||||
public GroupController(ApplicationContext context, IHashids hashids)
|
||||
{
|
||||
_context = context;
|
||||
_hashids = hashids;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> Get(CancellationToken cancellationToken)
|
||||
{
|
||||
var groups = await _context.Groups
|
||||
.Include(x => x.Roles)
|
||||
.ThenInclude(x => x.Authorities)
|
||||
.Include(x => x.Roles)
|
||||
.ThenInclude(x => x.GlobalAuthorities)
|
||||
.ToListAsync(cancellationToken: cancellationToken);
|
||||
return Ok(groups);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
using HashidsNet;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Suspectus.Gandalf.Palantir.Data.Database;
|
||||
|
||||
namespace Suspectus.Gandalf.Palantir.Api.Controllers;
|
||||
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
[Authorize]
|
||||
public class RoleController : ControllerBase
|
||||
{
|
||||
private readonly ApplicationContext _context;
|
||||
private readonly IHashids _hashids;
|
||||
|
||||
public RoleController(ApplicationContext context, IHashids hashids)
|
||||
{
|
||||
_context = context;
|
||||
_hashids = hashids;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> Get(CancellationToken cancellationToken)
|
||||
{
|
||||
var roles = await _context.Roles.ToListAsync(cancellationToken: cancellationToken);
|
||||
return Ok(roles);
|
||||
}
|
||||
}
|
||||
@ -111,7 +111,7 @@ public class TokenRequestCommandHandler(TimeProvider timeProvider, IHashids hash
|
||||
if (decodedToken.Exp is null || decodedToken.Exp?.ToUniversalTime() <= timeProvider.GetUtcNow())
|
||||
return "One does not simply provide an expired token.".AsErrorResult<TokenRequestResponse>();
|
||||
|
||||
var refreshTokenMetadata = await context.TokenMetadata.SingleOrDefaultAsync(x => x.Id == hashids.DecodeSingleLong(decodedToken.Sub), cancellationToken: cancellationToken);
|
||||
var refreshTokenMetadata = await context.TokenMetadata.SingleOrDefaultAsync(x => x.Id == hashids.DecodeSingleLong(decodedToken.Id), cancellationToken: cancellationToken);
|
||||
|
||||
if (refreshTokenMetadata is null)
|
||||
{
|
||||
|
||||
@ -6,6 +6,9 @@ using Suspectus.Gandalf.Palantir.Api.Commands;
|
||||
using Suspectus.Gandalf.Palantir.Data.Database;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.App;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Base;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission.Data;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission.Relation;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Subject;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Subject.SignIn;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Tenant;
|
||||
@ -23,6 +26,10 @@ public class InitService
|
||||
private readonly ILogger<InitService> _logger;
|
||||
private readonly InvokerContext _invokerContext;
|
||||
|
||||
private long _masterSubjectId;
|
||||
private long _masterTenantId;
|
||||
private long _masterAppId;
|
||||
|
||||
public InitService(ApplicationContext applicationContext, IMediator mediator, IConfiguration configuration, ILogger<InitService> logger, InvokerContext invokerContext)
|
||||
{
|
||||
_applicationContext = applicationContext;
|
||||
@ -52,13 +59,19 @@ public class InitService
|
||||
private async Task InitializeMaster()
|
||||
{
|
||||
var baseAddress = _configuration.GetValue<string>("BaseUrl") ?? "https://localhost:7269";
|
||||
var masterTenant = await _applicationContext.Tenants.SingleOrDefaultAsync(x => x.IsMaster);
|
||||
var existingMasterTenant = await _applicationContext.Tenants
|
||||
.Include(x => x.Apps)
|
||||
.SingleOrDefaultAsync(x => x.IsMaster);
|
||||
|
||||
if (masterTenant is not null)
|
||||
if (existingMasterTenant is not null)
|
||||
{
|
||||
var existingMasterApp = await _applicationContext.Apps
|
||||
.Include(x => x.Tenant)
|
||||
.SingleAsync(x => x.TenantId == masterTenant.Id);
|
||||
.SingleAsync(x => x.TenantId == existingMasterTenant.Id);
|
||||
|
||||
_masterSubjectId = existingMasterTenant.OwnerId;
|
||||
_masterTenantId = existingMasterTenant.Id!.Value;
|
||||
_masterAppId = existingMasterTenant.Apps.Where(x => x.Name == "Master").Select(x => x.Id!.Value).FirstOrDefault();
|
||||
|
||||
if (existingMasterApp.BaseAddress == baseAddress) return;
|
||||
|
||||
@ -73,6 +86,7 @@ public class InitService
|
||||
};
|
||||
|
||||
await _applicationContext.SaveChangesAsync();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -111,7 +125,7 @@ public class InitService
|
||||
IsAuthenticated = true
|
||||
};
|
||||
|
||||
masterTenant = new TenantEntity
|
||||
var masterTenant = new TenantEntity
|
||||
{
|
||||
Visibility = EntityVisibility.Active,
|
||||
Name = "Master",
|
||||
@ -149,21 +163,359 @@ public class InitService
|
||||
Please change the password after the first login.
|
||||
-------------------------------------------------
|
||||
""");
|
||||
|
||||
_masterSubjectId = housemasterUser.Id!.Value;
|
||||
_masterTenantId = masterTenant.Id!.Value;
|
||||
_masterAppId = masterApp.Id!.Value;
|
||||
}
|
||||
|
||||
private async Task InitializeMasterAuthorities()
|
||||
{
|
||||
var authorities = MasterAuthorities.GetAllAuthorities();
|
||||
var roles = MasterRoles.GetAllRoles();
|
||||
var groups = MasterGroups.GetAllGroups();
|
||||
private readonly Dictionary<string, long> _globalAuthorityNameToIdMap = new();
|
||||
private readonly Dictionary<string, long> _authorityNameToIdMap = new();
|
||||
private readonly Dictionary<string, long> _roleNameToIdMap = new();
|
||||
private readonly Dictionary<string, long> _groupNameToIdMap = new();
|
||||
private List<GlobalAuthorityEntity> _deletedGlobalAuthorities = [];
|
||||
|
||||
//TODO: Add a check to see if the authorities, roles, and groups already exist in the database.
|
||||
private async Task InitializeAuthorities()
|
||||
{
|
||||
var globalAuthorities = Authorities.GetAllGlobalAuthorities();
|
||||
var authorities = Authorities.GetAllAuthorities();
|
||||
|
||||
foreach (var authority in globalAuthorities)
|
||||
{
|
||||
var entity = await _applicationContext.GlobalAuthorities.SingleOrDefaultAsync(x =>
|
||||
(x.Name == authority.Name || x.Name == authority.OldName)
|
||||
&&
|
||||
x.Type == authority.Type);
|
||||
|
||||
if (entity is null)
|
||||
{
|
||||
entity = new GlobalAuthorityEntity
|
||||
{
|
||||
Name = authority.Name,
|
||||
CategoryPath = authority.Path ?? "Other",
|
||||
Description = authority.Description,
|
||||
Type = authority.Type
|
||||
};
|
||||
|
||||
_applicationContext.GlobalAuthorities.Add(entity);
|
||||
|
||||
_logger.LogInformation("Added global authority: Type: {Type} Name: {Name} Path: {Path} Description: {Description}", entity.Type, entity.Name, entity.CategoryPath, entity.Description);
|
||||
}
|
||||
else
|
||||
{
|
||||
entity.Name = authority.Name;
|
||||
entity.CategoryPath = authority.Path ?? "Other";
|
||||
entity.Description = authority.Description;
|
||||
entity.Type = authority.Type;
|
||||
|
||||
_logger.LogInformation("Updated global authority: Id: {Id} Type: {Type} Name: {Name} Path: {Path} Description: {Description}", entity.Id, entity.Type, entity.Name, entity.CategoryPath, entity.Description);
|
||||
}
|
||||
|
||||
await _applicationContext.SaveChangesAsync();
|
||||
|
||||
_globalAuthorityNameToIdMap.TryAdd(GetDictionaryKey(entity.Type, entity.Name), entity.Id!.Value);
|
||||
}
|
||||
|
||||
_deletedGlobalAuthorities = await _applicationContext.GlobalAuthorities
|
||||
.Where(x => !globalAuthorities.Select(y => y.Name).Contains(x.Name))
|
||||
.ToListAsync();
|
||||
|
||||
foreach (var authority in authorities)
|
||||
{
|
||||
var entity = await _applicationContext.Authorities.SingleOrDefaultAsync(x =>
|
||||
(x.Name == authority.Name || x.Name == authority.OldName)
|
||||
&&
|
||||
x.Type == authority.Type);
|
||||
|
||||
if (entity is null)
|
||||
{
|
||||
entity = new AuthorityEntity
|
||||
{
|
||||
Name = authority.Name,
|
||||
CategoryPath = authority.Path ?? "Other",
|
||||
Description = authority.Description,
|
||||
Type = authority.Type,
|
||||
TenantId = _masterTenantId,
|
||||
AppId = authority.Type == AuthorityType.App ? _masterAppId : null,
|
||||
Visibility = EntityVisibility.Active
|
||||
};
|
||||
|
||||
_applicationContext.Authorities.Add(entity);
|
||||
|
||||
_logger.LogInformation("Added authority: Type: {Type} Name: {Name} Path: {Path} Description: {Description}", entity.Type, entity.Name, entity.CategoryPath, entity.Description);
|
||||
}
|
||||
else
|
||||
{
|
||||
entity.Name = authority.Name;
|
||||
entity.CategoryPath = authority.Path ?? "Other";
|
||||
entity.Description = authority.Description;
|
||||
entity.Type = authority.Type;
|
||||
entity.TenantId = _masterTenantId;
|
||||
entity.AppId = authority.Type == AuthorityType.App ? _masterAppId : null;
|
||||
entity.Visibility = EntityVisibility.Active;
|
||||
|
||||
_logger.LogInformation("Updated authority: Id: {Id} TenantId: {TenantId} AppId: {AppId} Type: {Type} Name: {Name} Path: {Path} Description: {Description}", entity.Id, entity.TenantId, entity.AppId, entity.Type, entity.Name,
|
||||
entity.CategoryPath, entity.Description);
|
||||
}
|
||||
|
||||
await _applicationContext.SaveChangesAsync();
|
||||
|
||||
_authorityNameToIdMap.TryAdd(GetDictionaryKey(entity.Type, entity.Name, entity.Type == AuthorityType.Tenant ? entity.TenantId : entity.AppId), entity.Id!.Value);
|
||||
}
|
||||
|
||||
var deletedAuthoritiesQuery = _applicationContext.Authorities
|
||||
.Where(x => !authorities.Select(y => y.Name).Contains(x.Name));
|
||||
|
||||
var deletedAuthorities = await deletedAuthoritiesQuery.ToListAsync();
|
||||
|
||||
foreach (var entity in deletedAuthorities)
|
||||
{
|
||||
_logger.LogInformation("Soft deleted global authority: Id: {Id} Type: {Type} Name: {Name} Path: {Path} Description: {Description}", entity.Id, entity.Type, entity.Name, entity.CategoryPath, entity.Description);
|
||||
}
|
||||
|
||||
await deletedAuthoritiesQuery.ExecuteUpdateAsync(setter => setter.SetProperty(p => p.Visibility, EntityVisibility.Removed));
|
||||
}
|
||||
|
||||
private async Task InitializeRoles()
|
||||
{
|
||||
var roles = Roles.GetAllRoles();
|
||||
|
||||
foreach (var role in roles)
|
||||
{
|
||||
var entity = await _applicationContext.Roles.SingleOrDefaultAsync(x =>
|
||||
(x.Name == role.Name || x.Name == role.OldName)
|
||||
&&
|
||||
x.Type == role.Type);
|
||||
|
||||
if (entity is null)
|
||||
{
|
||||
entity = new RoleEntity
|
||||
{
|
||||
Name = role.Name,
|
||||
CategoryPath = role.Path ?? "Other",
|
||||
Description = role.Description,
|
||||
Type = role.Type,
|
||||
TenantId = _masterTenantId,
|
||||
AppId = role.Type == AuthorityType.App ? _masterAppId : null,
|
||||
Visibility = EntityVisibility.Active
|
||||
};
|
||||
|
||||
_applicationContext.Roles.Add(entity);
|
||||
|
||||
_logger.LogInformation("Added role: Type: {Type} Name: {Name} Path: {Path} Description: {Description}", entity.Type, entity.Name, entity.CategoryPath, entity.Description);
|
||||
}
|
||||
else
|
||||
{
|
||||
entity.Name = role.Name;
|
||||
entity.CategoryPath = role.Path ?? "Other";
|
||||
entity.Description = role.Description;
|
||||
entity.Type = role.Type;
|
||||
entity.TenantId = _masterTenantId;
|
||||
entity.AppId = role.Type == AuthorityType.App ? _masterAppId : null;
|
||||
entity.Visibility = EntityVisibility.Active;
|
||||
|
||||
_logger.LogInformation("Updated role: Id: {Id} TenantId: {TenantId} AppId: {AppId} Type: {Type} Name: {Name} Path: {Path} Description: {Description}", entity.Id, entity.TenantId, entity.AppId, entity.Type, entity.Name,
|
||||
entity.CategoryPath, entity.Description);
|
||||
}
|
||||
|
||||
await _applicationContext.SaveChangesAsync();
|
||||
|
||||
_roleNameToIdMap.TryAdd(GetDictionaryKey(entity.Type, entity.Name, entity.Type == AuthorityType.Tenant ? entity.TenantId : entity.AppId), entity.Id!.Value);
|
||||
}
|
||||
|
||||
foreach (var role in roles)
|
||||
{
|
||||
var roleId = _roleNameToIdMap[GetDictionaryKey(role.Type, role.Name, role.Type == AuthorityType.Tenant ? _masterTenantId : _masterAppId)];
|
||||
|
||||
await _applicationContext.RoleAuthorityRelations
|
||||
.Where(x => x.RoleId == roleId)
|
||||
.ExecuteDeleteAsync();
|
||||
|
||||
await _applicationContext.RoleGlobalAuthorityRelations
|
||||
.Where(x => x.RoleId == roleId)
|
||||
.ExecuteDeleteAsync();
|
||||
|
||||
var globalAuthorityRelations = role.GlobalAuthorities
|
||||
.Select(x => new RoleGlobalAuthorityRelationEntity
|
||||
{
|
||||
RoleId = roleId,
|
||||
GlobalAuthorityId = _globalAuthorityNameToIdMap[GetDictionaryKey(role.Type, x)],
|
||||
})
|
||||
.ToList();
|
||||
|
||||
var authorityRelations = role.Authorities
|
||||
.Select(x => new RoleAuthorityRelationEntity
|
||||
{
|
||||
RoleId = roleId,
|
||||
AuthorityId = _authorityNameToIdMap[GetDictionaryKey(role.Type, x, role.Type == AuthorityType.Tenant ? _masterTenantId : _masterAppId)],
|
||||
})
|
||||
.ToList();
|
||||
|
||||
_applicationContext.AddRange(globalAuthorityRelations);
|
||||
_applicationContext.AddRange(authorityRelations);
|
||||
|
||||
await _applicationContext.SaveChangesAsync();
|
||||
}
|
||||
|
||||
var deletedRolesQuery = _applicationContext.Roles
|
||||
.Where(x => !roles.Select(y => y.Name).Contains(x.Name));
|
||||
|
||||
var deletedRoles = await deletedRolesQuery.ToListAsync();
|
||||
|
||||
foreach (var entity in deletedRoles)
|
||||
{
|
||||
_logger.LogInformation("Soft deleted role authority: Id: {Id} Type: {Type} Name: {Name} Path: {Path} Description: {Description}", entity.Id, entity.Type, entity.Name, entity.CategoryPath, entity.Description);
|
||||
}
|
||||
|
||||
await deletedRolesQuery.ExecuteUpdateAsync(setter => setter.SetProperty(p => p.Visibility, EntityVisibility.Removed));
|
||||
}
|
||||
|
||||
private async Task InitializeGroups()
|
||||
{
|
||||
var groups = Groups.GetAllGroups();
|
||||
|
||||
foreach (var group in groups)
|
||||
{
|
||||
var entity = await _applicationContext.Groups.SingleOrDefaultAsync(x =>
|
||||
(x.Name == group.Name || x.Name == group.OldName)
|
||||
&&
|
||||
x.Type == group.Type
|
||||
);
|
||||
|
||||
if (entity is null)
|
||||
{
|
||||
entity = new GroupEntity
|
||||
{
|
||||
Name = group.Name,
|
||||
CategoryPath = group.Path ?? "Other",
|
||||
Description = group.Description,
|
||||
Type = group.Type,
|
||||
TenantId = _masterTenantId,
|
||||
AppId = group.Type == AuthorityType.App ? _masterAppId : null,
|
||||
Visibility = EntityVisibility.Active
|
||||
};
|
||||
|
||||
_applicationContext.Groups.Add(entity);
|
||||
|
||||
_logger.LogInformation("Added group: Type: {Type} Name: {Name} Path: {Path} Description: {Description}", entity.Type, entity.Name, entity.CategoryPath, entity.Description);
|
||||
}
|
||||
else
|
||||
{
|
||||
entity.Name = group.Name;
|
||||
entity.CategoryPath = group.Path ?? "Other";
|
||||
entity.Description = group.Description;
|
||||
entity.Type = group.Type;
|
||||
entity.TenantId = _masterTenantId;
|
||||
entity.AppId = group.Type == AuthorityType.App ? _masterAppId : null;
|
||||
entity.Visibility = EntityVisibility.Active;
|
||||
|
||||
_logger.LogInformation("Updated group: Id: {Id} TenantId: {TenantId} AppId: {AppId} Type: {Type} Name: {Name} Path: {Path} Description: {Description}", entity.Id, entity.TenantId, entity.AppId, entity.Type, entity.Name,
|
||||
entity.CategoryPath, entity.Description);
|
||||
}
|
||||
|
||||
await _applicationContext.SaveChangesAsync();
|
||||
|
||||
_groupNameToIdMap.TryAdd(GetDictionaryKey(entity.Type, entity.Name, entity.Type == AuthorityType.Tenant ? entity.TenantId : entity.AppId), entity.Id!.Value);
|
||||
}
|
||||
|
||||
foreach (var group in groups)
|
||||
{
|
||||
var groupId = _groupNameToIdMap[GetDictionaryKey(group.Type, group.Name, group.Type == AuthorityType.Tenant ? _masterTenantId : _masterAppId)];
|
||||
|
||||
await _applicationContext.GroupRoleRelations
|
||||
.Where(x => x.GroupId == groupId)
|
||||
.ExecuteDeleteAsync();
|
||||
|
||||
var roleRelations = group.Roles
|
||||
.Select(x => new GroupRoleRelationEntity
|
||||
{
|
||||
RoleId = _roleNameToIdMap[GetDictionaryKey(group.Type, x, group.Type == AuthorityType.Tenant ? _masterTenantId : _masterAppId)],
|
||||
GroupId = groupId,
|
||||
})
|
||||
.ToList();
|
||||
|
||||
_applicationContext.AddRange(roleRelations);
|
||||
|
||||
await _applicationContext.SaveChangesAsync();
|
||||
}
|
||||
|
||||
var deletedGroupsQuery = _applicationContext.Groups
|
||||
.Where(x => !groups.Select(y => y.Name).Contains(x.Name));
|
||||
|
||||
var deletedRoles = await deletedGroupsQuery.ToListAsync();
|
||||
|
||||
foreach (var entity in deletedRoles)
|
||||
{
|
||||
_logger.LogInformation("Soft deleted group authority: Id: {Id} Type: {Type} Name: {Name} Path: {Path} Description: {Description}", entity.Id, entity.Type, entity.Name, entity.CategoryPath, entity.Description);
|
||||
}
|
||||
|
||||
await deletedGroupsQuery.ExecuteUpdateAsync(setter => setter.SetProperty(p => p.Visibility, EntityVisibility.Removed));
|
||||
}
|
||||
|
||||
private async Task InitializeGroupRoles()
|
||||
{
|
||||
_invokerContext.Invoker = new Invoker
|
||||
{
|
||||
SubjectId = _masterSubjectId,
|
||||
TenantAuthorityDictionary = new Dictionary<string, HashSet<string>>(),
|
||||
AppAuthorityDictionary = new Dictionary<string, HashSet<string>>(),
|
||||
IsAuthenticated = true
|
||||
};
|
||||
|
||||
await InitializeAuthorities();
|
||||
await InitializeRoles();
|
||||
await InitializeGroups();
|
||||
|
||||
foreach (var entity in _deletedGlobalAuthorities)
|
||||
{
|
||||
_logger.LogInformation("Deleted global authority: Id: {Id} Type: {Type} Name: {Name} Path: {Path} Description: {Description}", entity.Id, entity.Type, entity.Name, entity.CategoryPath, entity.Description);
|
||||
_applicationContext.GlobalAuthorities.Remove(entity);
|
||||
}
|
||||
|
||||
var appHouseMasterGroupRelation = await _applicationContext.GroupSubjectRelations
|
||||
.Where(x => x.SubjectId == _masterSubjectId && x.Group.Name == Groups.AppHousemaster)
|
||||
.SingleOrDefaultAsync();
|
||||
|
||||
if (appHouseMasterGroupRelation is null)
|
||||
{
|
||||
var relation = new GroupSubjectRelationEntity
|
||||
{
|
||||
SubjectId = _masterSubjectId,
|
||||
GroupId = _groupNameToIdMap[GetDictionaryKey(AuthorityType.App, Groups.AppHousemaster, _masterAppId)]
|
||||
};
|
||||
|
||||
_applicationContext.GroupSubjectRelations.Add(relation);
|
||||
|
||||
await _applicationContext.SaveChangesAsync();
|
||||
}
|
||||
|
||||
var tenantHouseMasterGroupRelation = await _applicationContext.GroupSubjectRelations
|
||||
.Where(x => x.SubjectId == _masterSubjectId && x.Group.Name == Groups.TenantHousemaster)
|
||||
.SingleOrDefaultAsync();
|
||||
|
||||
if (tenantHouseMasterGroupRelation is null)
|
||||
{
|
||||
var relation = new GroupSubjectRelationEntity
|
||||
{
|
||||
SubjectId = _masterSubjectId,
|
||||
GroupId = _groupNameToIdMap[GetDictionaryKey(AuthorityType.Tenant, Groups.TenantHousemaster, _masterTenantId)]
|
||||
};
|
||||
|
||||
_applicationContext.GroupSubjectRelations.Add(relation);
|
||||
|
||||
await _applicationContext.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
|
||||
private string GetDictionaryKey(AuthorityType type, string name, long? id = null)
|
||||
{
|
||||
return id is null ? $"{type}:{name}" : $"{type}:{name}:{id}";
|
||||
}
|
||||
|
||||
public async Task InitializeAsync()
|
||||
{
|
||||
await InitializeDatabaseAsync();
|
||||
await InitializeMaster();
|
||||
await InitializeMasterAuthorities();
|
||||
await InitializeGroupRoles();
|
||||
}
|
||||
}
|
||||
@ -23,32 +23,32 @@ public class TestController(IHashids hashids, ApplicationContext context, Invoke
|
||||
return Ok((Invoker)User);
|
||||
}
|
||||
|
||||
[HttpPost("tenant")]
|
||||
public async Task<IActionResult> AddTenant([FromBody] CreateTenantCommand command)
|
||||
{
|
||||
var invoker = invokerContext.Invoker!;
|
||||
|
||||
var authorities = await context.AuthorityEntities.Where(x => x.Type == AuthorityType.Tenant).ToListAsync();
|
||||
|
||||
var tenantSubjectRelationEntity = new TenantSubjectRelationEntity
|
||||
{
|
||||
Tenant = new TenantEntity
|
||||
{
|
||||
Visibility = EntityVisibility.Active,
|
||||
OwnerId = invoker.SubjectId,
|
||||
Name = command.Name,
|
||||
IsMaster = false
|
||||
},
|
||||
SubjectId = invoker.SubjectId,
|
||||
InternalAuthorities = authorities.ToHashSet()
|
||||
};
|
||||
|
||||
await context.AddAsync(tenantSubjectRelationEntity);
|
||||
await context.SaveChangesAsync();
|
||||
|
||||
return Ok(tenantSubjectRelationEntity.Tenant);
|
||||
}
|
||||
|
||||
// [HttpPost("tenant")]
|
||||
// public async Task<IActionResult> AddTenant([FromBody] CreateTenantCommand command)
|
||||
// {
|
||||
// var invoker = invokerContext.Invoker!;
|
||||
//
|
||||
// var authorities = await context.AuthorityEntities.Where(x => x.Type == Type.Tenant).ToListAsync();
|
||||
//
|
||||
// var tenantSubjectRelationEntity = new TenantSubjectRelationEntity
|
||||
// {
|
||||
// Tenant = new TenantEntity
|
||||
// {
|
||||
// Visibility = EntityVisibility.Active,
|
||||
// OwnerId = invoker.SubjectId,
|
||||
// Name = command.Name,
|
||||
// IsMaster = false
|
||||
// },
|
||||
// SubjectId = invoker.SubjectId,
|
||||
// Authorities = authorities.ToHashSet()
|
||||
// };
|
||||
//
|
||||
// await context.AddAsync(tenantSubjectRelationEntity);
|
||||
// await context.SaveChangesAsync();
|
||||
//
|
||||
// return Ok(tenantSubjectRelationEntity.Tenant);
|
||||
// }
|
||||
//
|
||||
[HttpPut("tenant/{id:long}")]
|
||||
public async Task<IActionResult> UpdateTenant(long id, [FromBody] UpdateTenantCommand command)
|
||||
{
|
||||
@ -74,18 +74,18 @@ public class TestController(IHashids hashids, ApplicationContext context, Invoke
|
||||
return Ok(tenants);
|
||||
}
|
||||
|
||||
[GrAuthorize(Type = AuthorityType.Tenant, Authorities = [TenantAuthority.Read], ParameterName = "id")]
|
||||
[HttpGet("tenant/{id}")]
|
||||
public async Task<IActionResult> GetTenant(string id)
|
||||
{
|
||||
if(!hashids.TryDecodeSingleLong(id, out var decodedId)) return BadRequest("One does not simply use a invalid id.");
|
||||
|
||||
var tenant = await context.Tenants.Where(x => x.Id == decodedId).SingleOrDefaultAsync();
|
||||
|
||||
if(tenant is null) return BadRequest("One does not simply request unknown tenant.");
|
||||
|
||||
return Ok(tenant);
|
||||
}
|
||||
// [GrAuthorize(Type = Type.Tenant, Authorities = [TenantAuthority.Read], ParameterName = "id")]
|
||||
// [HttpGet("tenant/{id}")]
|
||||
// public async Task<IActionResult> GetTenant(string id)
|
||||
// {
|
||||
// if(!hashids.TryDecodeSingleLong(id, out var decodedId)) return BadRequest("One does not simply use a invalid id.");
|
||||
//
|
||||
// var tenant = await context.Tenants.Where(x => x.Id == decodedId).SingleOrDefaultAsync();
|
||||
//
|
||||
// if(tenant is null) return BadRequest("One does not simply request unknown tenant.");
|
||||
//
|
||||
// return Ok(tenant);
|
||||
// }
|
||||
|
||||
[AllowAnonymous]
|
||||
[HttpGet("hashid/encode/{id:long}")]
|
||||
|
||||
@ -20,8 +20,8 @@ public sealed class ApplicationContext(DbContextOptions<ApplicationContext> opti
|
||||
base.OnModelCreating(builder);
|
||||
|
||||
ConfigureId(builder);
|
||||
AddEnumToStringConversion(builder);
|
||||
AddVersionRelations(builder);
|
||||
AddEnumToStringConversion(builder);
|
||||
SetTableNames(builder);
|
||||
}
|
||||
|
||||
|
||||
@ -1,10 +1,11 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.App;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Security;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission.Relation;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Subject;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Subject.SignIn;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Tenant;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Base;
|
||||
|
||||
namespace Suspectus.Gandalf.Palantir.Data.Database;
|
||||
|
||||
@ -23,9 +24,25 @@ public abstract class CoreContext<T>(DbContextOptions<T> options) : DbContext(op
|
||||
public DbSet<AppVersionEntity> AppsVersions { get; set; }
|
||||
public DbSet<TenantVersionEntity> TenantVersions { get; set; }
|
||||
public DbSet<AppSubjectRelationVersionEntity> AppSubjectRelationVersions { get; set; }
|
||||
|
||||
public DbSet<TenantSubjectRelationVersionEntity> TenantSubjectRelationVersions { get; set; }
|
||||
public DbSet<AppSubjectRelationInternalAuthorityRelationVersionEntity> AppSubjectRelationInternalAuthorityRelationVersions { get; set; }
|
||||
public DbSet<TenantSubjectRelationInternalAuthorityRelationVersionEntity> TenantSubjectRelationInternalAuthorityRelationVersions { get; set; }
|
||||
// public DbSet<AppSubjectRelationInternalAuthorityRelationVersionEntity> AppSubjectRelationInternalAuthorityRelationVersions { get; set; }
|
||||
// public DbSet<TenantSubjectRoleRelationVersionEntity> TenantSubjectRelationInternalAuthorityRelationVersions { get; set; }
|
||||
|
||||
|
||||
|
||||
public DbSet<GlobalAuthorityEntity> GlobalAuthorities { get; set; }
|
||||
public DbSet<AuthorityEntity> Authorities { get; set; }
|
||||
public DbSet<RoleEntity> Roles { get; set; }
|
||||
public DbSet<GroupEntity> Groups { get; set; }
|
||||
|
||||
public DbSet<GroupSubjectRelationEntity> GroupSubjectRelations { get; set; }
|
||||
public DbSet<RoleSubjectRelationEntity> RoleSubjectRelations { get; set; }
|
||||
public DbSet<RoleAuthorityRelationEntity> RoleAuthorityRelations { get; set; }
|
||||
public DbSet<RoleGlobalAuthorityRelationEntity> RoleGlobalAuthorityRelations { get; set; }
|
||||
public DbSet<GroupRoleRelationEntity> GroupRoleRelations { get; set; }
|
||||
|
||||
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder builder)
|
||||
{
|
||||
@ -57,29 +74,6 @@ public abstract class CoreContext<T>(DbContextOptions<T> options) : DbContext(op
|
||||
|
||||
#endregion
|
||||
|
||||
#region TenantSubjectRelation
|
||||
|
||||
var tenantSubjectRelationBuilder = builder.Entity<TenantSubjectRelationEntity>();
|
||||
|
||||
tenantSubjectRelationBuilder
|
||||
.HasMany(x => x.InternalAuthorities)
|
||||
.WithMany(x => x.TenantSubjectRelations)
|
||||
.UsingEntity<TenantSubjectRelationInternalAuthorityRelationEntity>(
|
||||
r => r
|
||||
.HasOne(x => x.InternalAuthority)
|
||||
.WithMany()
|
||||
.HasForeignKey(x => x.InternalAuthorityId),
|
||||
l => l
|
||||
.HasOne(x => x.TenantSubjectRelation)
|
||||
.WithMany()
|
||||
.HasForeignKey(x => new { x.SubjectId, x.TenantId }),
|
||||
j => j
|
||||
.HasKey(x => new { x.SubjectId, x.TenantId, x.InternalAuthorityId })
|
||||
)
|
||||
.HasKey(x => new { x.SubjectId, x.TenantId });
|
||||
|
||||
#endregion
|
||||
|
||||
#region Subject
|
||||
|
||||
var subjectBuilder = builder.Entity<SubjectEntity>();
|
||||
@ -133,26 +127,125 @@ public abstract class CoreContext<T>(DbContextOptions<T> options) : DbContext(op
|
||||
|
||||
#endregion
|
||||
|
||||
#region AppSubjectRelation
|
||||
#region Group
|
||||
|
||||
var appSubjectRelationBuilder = builder.Entity<AppSubjectRelationEntity>();
|
||||
var groupBuilder = builder.Entity<GroupEntity>();
|
||||
|
||||
appSubjectRelationBuilder
|
||||
.HasMany(x => x.InternalAuthorities)
|
||||
.WithMany(x => x.AppSubjectRelations)
|
||||
.UsingEntity<AppSubjectRelationInternalAuthorityRelationEntity>(
|
||||
groupBuilder
|
||||
.HasMany(x => x.Roles)
|
||||
.WithMany(x => x.Groups)
|
||||
.UsingEntity<GroupRoleRelationEntity>(
|
||||
r => r
|
||||
.HasOne(x => x.InternalAuthority)
|
||||
.HasOne(x => x.Role)
|
||||
.WithMany()
|
||||
.HasForeignKey(x => x.InternalAuthorityId),
|
||||
.HasForeignKey(x => x.RoleId),
|
||||
l => l
|
||||
.HasOne(x => x.AppSubjectRelation)
|
||||
.HasOne(x => x.Group)
|
||||
.WithMany()
|
||||
.HasForeignKey(x => new { x.SubjectId, x.AppId }),
|
||||
.HasForeignKey(x => x.GroupId),
|
||||
j => j
|
||||
.HasKey(x => new { x.SubjectId, x.AppId, x.InternalAuthorityId })
|
||||
)
|
||||
.HasKey(x => new { x.SubjectId, x.AppId });
|
||||
.HasKey(x => new { x.GroupId, x.RoleId })
|
||||
);
|
||||
|
||||
groupBuilder
|
||||
.HasMany(x => x.Subjects)
|
||||
.WithMany(x => x.Groups)
|
||||
.UsingEntity<GroupSubjectRelationEntity>(
|
||||
r => r
|
||||
.HasOne(x => x.Subject)
|
||||
.WithMany()
|
||||
.HasForeignKey(x => x.SubjectId),
|
||||
l => l
|
||||
.HasOne(x => x.Group)
|
||||
.WithMany()
|
||||
.HasForeignKey(x => x.GroupId),
|
||||
j => j
|
||||
.HasKey(x => new { x.GroupId, x.SubjectId }));
|
||||
|
||||
groupBuilder.HasOne(x => x.Tenant)
|
||||
.WithMany(x => x.Groups)
|
||||
.HasForeignKey(x => x.TenantId);
|
||||
|
||||
groupBuilder.HasOne(x => x.App)
|
||||
.WithMany(x => x.Groups)
|
||||
.HasForeignKey(x => x.AppId);
|
||||
|
||||
groupBuilder.HasIndex(x => new { x.Name, x.AppId })
|
||||
.IsUnique()
|
||||
.HasFilter($"\"{nameof(GroupEntity.AppId)}\" IS NOT NULL");
|
||||
|
||||
groupBuilder.HasIndex(x => new { x.Name, x.TenantId })
|
||||
.IsUnique()
|
||||
.HasFilter($"\"{nameof(GroupEntity.AppId)}\" IS NULL");
|
||||
|
||||
#endregion
|
||||
|
||||
#region Role
|
||||
|
||||
var roleBuilder = builder.Entity<RoleEntity>();
|
||||
|
||||
roleBuilder
|
||||
.HasMany(x => x.Authorities)
|
||||
.WithMany(x => x.Roles)
|
||||
.UsingEntity<RoleAuthorityRelationEntity>(
|
||||
r => r
|
||||
.HasOne(x => x.Authority)
|
||||
.WithMany()
|
||||
.HasForeignKey(x => x.AuthorityId),
|
||||
l => l
|
||||
.HasOne(x => x.Role)
|
||||
.WithMany()
|
||||
.HasForeignKey(x => x.RoleId),
|
||||
j => j
|
||||
.HasKey(x => new { x.RoleId, x.AuthorityId })
|
||||
);
|
||||
|
||||
roleBuilder
|
||||
.HasMany(x => x.GlobalAuthorities)
|
||||
.WithMany()
|
||||
.UsingEntity<RoleGlobalAuthorityRelationEntity>(
|
||||
r => r
|
||||
.HasOne(x => x.GlobalAuthority)
|
||||
.WithMany()
|
||||
.HasForeignKey(x => x.GlobalAuthorityId),
|
||||
l => l
|
||||
.HasOne(x => x.Role)
|
||||
.WithMany()
|
||||
.HasForeignKey(x => x.RoleId),
|
||||
j => j
|
||||
.HasKey(x => new { x.RoleId, x.GlobalAuthorityId })
|
||||
);
|
||||
|
||||
roleBuilder.HasOne(x => x.Tenant)
|
||||
.WithMany(x => x.Roles)
|
||||
.HasForeignKey(x => x.TenantId);
|
||||
|
||||
roleBuilder.HasOne(x => x.App)
|
||||
.WithMany(x => x.Roles)
|
||||
.HasForeignKey(x => x.AppId);
|
||||
|
||||
roleBuilder
|
||||
.HasMany(x => x.Subjects)
|
||||
.WithMany(x => x.Roles)
|
||||
.UsingEntity<RoleSubjectRelationEntity>(
|
||||
r => r
|
||||
.HasOne(x => x.Subject)
|
||||
.WithMany()
|
||||
.HasForeignKey(x => x.SubjectId),
|
||||
l => l
|
||||
.HasOne(x => x.Role)
|
||||
.WithMany()
|
||||
.HasForeignKey(x => x.RoleId),
|
||||
j => j
|
||||
.HasKey(x => new { x.RoleId, x.SubjectId }));
|
||||
|
||||
roleBuilder.HasIndex(x => new { x.Name, x.AppId })
|
||||
.IsUnique()
|
||||
.HasFilter($"\"{nameof(GroupEntity.AppId)}\" IS NOT NULL");
|
||||
|
||||
roleBuilder.HasIndex(x => new { x.Name, x.TenantId })
|
||||
.IsUnique()
|
||||
.HasFilter($"\"{nameof(GroupEntity.AppId)}\" IS NULL");
|
||||
|
||||
#endregion
|
||||
|
||||
@ -160,28 +253,29 @@ public abstract class CoreContext<T>(DbContextOptions<T> options) : DbContext(op
|
||||
|
||||
var authorityBuilder = builder.Entity<AuthorityEntity>();
|
||||
|
||||
authorityBuilder
|
||||
.HasData(
|
||||
new AuthorityEntity
|
||||
{
|
||||
Id = 1,
|
||||
Type = AuthorityType.Tenant,
|
||||
Name = "Tenant_Read",
|
||||
Description = "Allows users to read tenants"
|
||||
}, new AuthorityEntity
|
||||
{
|
||||
Id = 2,
|
||||
Type = AuthorityType.App,
|
||||
Name = "App_Read",
|
||||
Description = "Allows users to read apps"
|
||||
}
|
||||
);
|
||||
authorityBuilder.HasOne(x => x.Tenant)
|
||||
.WithMany(x => x.Authorities)
|
||||
.HasForeignKey(x => x.TenantId);
|
||||
|
||||
authorityBuilder
|
||||
.HasKey(x => x.Id);
|
||||
authorityBuilder.HasOne(x => x.App)
|
||||
.WithMany(x => x.Authorities)
|
||||
.HasForeignKey(x => x.AppId);
|
||||
|
||||
authorityBuilder
|
||||
.HasIndex(x => x.Name)
|
||||
authorityBuilder.HasIndex(x => new { x.Name, x.AppId })
|
||||
.IsUnique()
|
||||
.HasFilter($"\"{nameof(GroupEntity.AppId)}\" IS NOT NULL");
|
||||
|
||||
authorityBuilder.HasIndex(x => new { x.Name, x.TenantId })
|
||||
.IsUnique()
|
||||
.HasFilter($"\"{nameof(GroupEntity.AppId)}\" IS NULL");
|
||||
|
||||
#endregion
|
||||
|
||||
#region GlobalAuthority
|
||||
|
||||
var globalAuthorityBuilder = builder.Entity<GlobalAuthorityEntity>();
|
||||
|
||||
globalAuthorityBuilder.HasIndex(x => x.Name)
|
||||
.IsUnique();
|
||||
|
||||
#endregion
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Base;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Subject;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Tenant;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Version;
|
||||
@ -9,6 +10,9 @@ public class AppEntity : AppData, IVersionableEntity
|
||||
{
|
||||
public TenantEntity? Tenant { get; set; }
|
||||
public HashSet<SubjectEntity> Subjects { get; set; } = [];
|
||||
public HashSet<GroupEntity> Groups { get; set; } = [];
|
||||
public HashSet<RoleEntity> Roles { get; set; } = [];
|
||||
public HashSet<AuthorityEntity> Authorities { get; set; } = [];
|
||||
}
|
||||
|
||||
public class AppVersionEntity : AppData, IVersionEntity<AppEntity>
|
||||
@ -25,3 +29,11 @@ public abstract class AppData : TenantRelationData
|
||||
public required string Name { get; set; }
|
||||
public required string BaseAddress { get; set; }
|
||||
}
|
||||
|
||||
public abstract class AppRelationData : TenantRelationData {
|
||||
public required long AppId { get; set; }
|
||||
}
|
||||
|
||||
public abstract class OptionalAppRelationData : TenantRelationData {
|
||||
public long? AppId { get; set; }
|
||||
}
|
||||
@ -1,19 +1,19 @@
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Base;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Security;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Subject;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Tenant;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Version;
|
||||
|
||||
namespace Suspectus.Gandalf.Palantir.Data.Entities.App;
|
||||
|
||||
public class AppSubjectRelationEntity : AppSubjectRelationData<long>, IMappingEntity, IVersionableEntity
|
||||
public class AppSubjectRelationEntity : AppSubjectRelationData, IMappingEntity, IVersionableEntity
|
||||
{
|
||||
public HashSet<AuthorityEntity> InternalAuthorities { get; set; } = [];
|
||||
public AppEntity? App { get; set; }
|
||||
public SubjectEntity? Subject { get; set; }
|
||||
}
|
||||
|
||||
public class AppSubjectRelationVersionEntity : AppSubjectRelationData<long>, IVersionEntity<AppSubjectRelationEntity>
|
||||
public class AppSubjectRelationVersionEntity : AppSubjectRelationData, IVersionEntity<AppSubjectRelationEntity>
|
||||
{
|
||||
public SubjectEntity? Suspect { get; set; }
|
||||
public long SuspectId { get; set; }
|
||||
@ -22,8 +22,8 @@ public class AppSubjectRelationVersionEntity : AppSubjectRelationData<long>, IVe
|
||||
public AppSubjectRelationEntity? Reference { get; set; }
|
||||
}
|
||||
|
||||
public abstract class AppSubjectRelationData<T> where T : IConvertible
|
||||
public abstract class AppSubjectRelationData
|
||||
{
|
||||
public required T AppId { get; set; }
|
||||
public required T SubjectId { get; set; }
|
||||
public required long AppId { get; set; }
|
||||
public required long SubjectId { get; set; }
|
||||
}
|
||||
@ -1,29 +0,0 @@
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.App;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Base;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Subject;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Tenant;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Version;
|
||||
|
||||
namespace Suspectus.Gandalf.Palantir.Data.Entities.Security;
|
||||
|
||||
public class AppSubjectRelationInternalAuthorityRelationEntity : AppSubjectRelationInternalAuthorityRelationData<long>, IMappingEntity, IVersionableEntity
|
||||
{
|
||||
public AppSubjectRelationEntity? AppSubjectRelation { get; set; }
|
||||
public AuthorityEntity? InternalAuthority { get; set; }
|
||||
}
|
||||
|
||||
public class AppSubjectRelationInternalAuthorityRelationVersionEntity : AppSubjectRelationInternalAuthorityRelationData<long>, IVersionEntity<AppSubjectRelationInternalAuthorityRelationEntity>
|
||||
{
|
||||
public SubjectEntity? Suspect { get; set; }
|
||||
public long SuspectId { get; set; }
|
||||
public VersionAction Action { get; set; }
|
||||
public DateTimeOffset At { get; set; }
|
||||
public AppSubjectRelationInternalAuthorityRelationEntity? Reference { get; set; }
|
||||
}
|
||||
|
||||
public class AppSubjectRelationInternalAuthorityRelationData<T> where T : IConvertible
|
||||
{
|
||||
public required T AppId { get; set; }
|
||||
public required T SubjectId { get; set; }
|
||||
public required T InternalAuthorityId { get; set; }
|
||||
}
|
||||
@ -1,27 +0,0 @@
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.App;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Base;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Tenant;
|
||||
|
||||
namespace Suspectus.Gandalf.Palantir.Data.Entities.Security;
|
||||
|
||||
public class AuthorityEntity : IdData
|
||||
{
|
||||
public required string Name { get; set; }
|
||||
|
||||
public required AuthorityType Type { get; set; }
|
||||
|
||||
[ContentKey] public string? Description { get; set; }
|
||||
|
||||
public HashSet<TenantSubjectRelationEntity>? TenantSubjectRelations { get; set; } = [];
|
||||
public HashSet<AppSubjectRelationEntity>? AppSubjectRelations { get; set; } = [];
|
||||
}
|
||||
|
||||
public static class TenantAuthority
|
||||
{
|
||||
public const string Read = "Tenant_Read";
|
||||
}
|
||||
|
||||
public static class AppAuthority
|
||||
{
|
||||
public const string Read = "App_Read";
|
||||
}
|
||||
@ -1,7 +0,0 @@
|
||||
namespace Suspectus.Gandalf.Palantir.Data.Entities.Security;
|
||||
|
||||
public enum AuthorityType
|
||||
{
|
||||
Tenant,
|
||||
App
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
// namespace Suspectus.Gandalf.Palantir.Data.Entities.Security;
|
||||
//
|
||||
// public class AppSubjectRelationInternalAuthorityRelationData<T> where T : IConvertible
|
||||
// {
|
||||
// public required T AppId { get; set; }
|
||||
// public required T SubjectId { get; set; }
|
||||
// public required T AuthorityId { get; set; }
|
||||
// }
|
||||
@ -0,0 +1,12 @@
|
||||
// using Suspectus.Gandalf.Palantir.Data.Entities.App;
|
||||
// using Suspectus.Gandalf.Palantir.Data.Entities.Base;
|
||||
// using Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission;
|
||||
// using Suspectus.Gandalf.Palantir.Data.Entities.Tenant;
|
||||
//
|
||||
// namespace Suspectus.Gandalf.Palantir.Data.Entities.Security;
|
||||
//
|
||||
// public class AppSubjectRelationInternalAuthorityRelationEntity : AppSubjectRelationInternalAuthorityRelationData<long>, IMappingEntity, IVersionableEntity
|
||||
// {
|
||||
// public AppSubjectRelationEntity? AppSubjectRelation { get; set; }
|
||||
// public AuthorityEntity? Authority { get; set; }
|
||||
// }
|
||||
@ -0,0 +1,13 @@
|
||||
// using Suspectus.Gandalf.Palantir.Data.Entities.Subject;
|
||||
// using Suspectus.Gandalf.Palantir.Data.Entities.Version;
|
||||
//
|
||||
// namespace Suspectus.Gandalf.Palantir.Data.Entities.Security;
|
||||
//
|
||||
// public class AppSubjectRelationInternalAuthorityRelationVersionEntity : AppSubjectRelationInternalAuthorityRelationData<long>, IVersionEntity<AppSubjectRelationInternalAuthorityRelationEntity>
|
||||
// {
|
||||
// public SubjectEntity? Suspect { get; set; }
|
||||
// public long SuspectId { get; set; }
|
||||
// public VersionAction Action { get; set; }
|
||||
// public DateTimeOffset At { get; set; }
|
||||
// public AppSubjectRelationInternalAuthorityRelationEntity? Reference { get; set; }
|
||||
// }
|
||||
@ -0,0 +1,8 @@
|
||||
// namespace Suspectus.Gandalf.Palantir.Data.Entities.Security;
|
||||
//
|
||||
// public class TenantSubjectRoleRelationData<T> where T : IConvertible
|
||||
// {
|
||||
// public required T TenantId { get; set; }
|
||||
// public required T SubjectId { get; set; }
|
||||
// public required T RoleId { get; set; }
|
||||
// }
|
||||
@ -0,0 +1,11 @@
|
||||
// using Suspectus.Gandalf.Palantir.Data.Entities.Base;
|
||||
// using Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission;
|
||||
// using Suspectus.Gandalf.Palantir.Data.Entities.Tenant;
|
||||
//
|
||||
// namespace Suspectus.Gandalf.Palantir.Data.Entities.Security;
|
||||
//
|
||||
// public class TenantSubjectRoleRelationEntity : TenantSubjectRoleRelationData<long>, IMappingEntity, IVersionableEntity
|
||||
// {
|
||||
// public TenantSubjectRelationEntity? TenantSubjectRelation { get; set; }
|
||||
// public AuthorityEntity? Role { get; set; }
|
||||
// }
|
||||
@ -0,0 +1,13 @@
|
||||
// using Suspectus.Gandalf.Palantir.Data.Entities.Subject;
|
||||
// using Suspectus.Gandalf.Palantir.Data.Entities.Version;
|
||||
//
|
||||
// namespace Suspectus.Gandalf.Palantir.Data.Entities.Security;
|
||||
//
|
||||
// public class TenantSubjectRoleRelationVersionEntity : TenantSubjectRoleRelationData<long>, IVersionEntity<TenantSubjectRoleRelationEntity>
|
||||
// {
|
||||
// public SubjectEntity? Suspect { get; set; }
|
||||
// public long SuspectId { get; set; }
|
||||
// public VersionAction Action { get; set; }
|
||||
// public DateTimeOffset At { get; set; }
|
||||
// public TenantSubjectRoleRelationEntity? Reference { get; set; }
|
||||
// }
|
||||
@ -0,0 +1,13 @@
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.App;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Base;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission.Data;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Tenant;
|
||||
|
||||
namespace Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission;
|
||||
|
||||
public class AuthorityEntity : AuthorityData, IVersionableEntity
|
||||
{
|
||||
public HashSet<RoleEntity> Roles { get; set; } = [];
|
||||
public TenantEntity Tenant { get; set; } = null!;
|
||||
public AppEntity? App { get; set; }
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
namespace Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission.Data;
|
||||
|
||||
public abstract class AuthorityData : DescribedCategorizedNameWithVisibilityData
|
||||
{
|
||||
public required long TenantId { get; set; }
|
||||
public long? AppId { get; set; }
|
||||
public required AuthorityType Type { get; set; }
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
namespace Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission.Data;
|
||||
|
||||
public enum AuthorityType
|
||||
{
|
||||
Tenant,
|
||||
App
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Base;
|
||||
|
||||
namespace Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission.Data;
|
||||
|
||||
public abstract class CategorizedNameData : IdData
|
||||
{
|
||||
public required string Name { get; set; }
|
||||
public required string CategoryPath { get; set; }
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
namespace Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission.Data;
|
||||
|
||||
public abstract class DescribedCategorizedNameData : CategorizedNameData
|
||||
{
|
||||
public string? Description { get; set; }
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Base;
|
||||
|
||||
namespace Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission.Data;
|
||||
|
||||
public abstract class DescribedCategorizedNameWithVisibilityData : DescribedCategorizedNameData
|
||||
{
|
||||
public EntityVisibility Visibility { get; set; }
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
namespace Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission.Data;
|
||||
|
||||
public abstract class GlobalAuthorityData : DescribedCategorizedNameData
|
||||
{
|
||||
public AuthorityType Type { get; set; }
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
namespace Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission.Data;
|
||||
|
||||
public abstract class GroupData : AuthorityData;
|
||||
@ -0,0 +1,3 @@
|
||||
namespace Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission.Data;
|
||||
|
||||
public abstract class RoleData : AuthorityData;
|
||||
@ -0,0 +1,5 @@
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission.Data;
|
||||
|
||||
namespace Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission;
|
||||
|
||||
public class GlobalAuthorityEntity : GlobalAuthorityData;
|
||||
@ -0,0 +1,15 @@
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.App;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Base;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission.Data;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Subject;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Tenant;
|
||||
|
||||
namespace Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission;
|
||||
|
||||
public class GroupEntity : GroupData, IVersionableEntity
|
||||
{
|
||||
public HashSet<RoleEntity> Roles { get; set; } = [];
|
||||
public TenantEntity Tenant { get; set; } = null!;
|
||||
public AppEntity? App { get; set; }
|
||||
public HashSet<SubjectEntity> Subjects { get; set; } = [];
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
namespace Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission.Relation;
|
||||
|
||||
public class GroupRoleRelationData
|
||||
{
|
||||
public required long GroupId { get; set; }
|
||||
public required long RoleId { get; set; }
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Base;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Tenant;
|
||||
|
||||
namespace Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission.Relation;
|
||||
|
||||
public class GroupRoleRelationEntity : GroupRoleRelationData, IMappingEntity, IVersionableEntity
|
||||
{
|
||||
public GroupEntity Group { get; set; } = null!;
|
||||
public RoleEntity Role { get; set; } = null!;
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
namespace Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission.Relation;
|
||||
|
||||
public class GroupSubjectRelationData
|
||||
{
|
||||
public required long GroupId { get; set; }
|
||||
public required long SubjectId { get; set; }
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Base;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Subject;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Tenant;
|
||||
|
||||
namespace Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission.Relation;
|
||||
|
||||
public class GroupSubjectRelationEntity : GroupSubjectRelationData, IMappingEntity, IVersionableEntity
|
||||
{
|
||||
public GroupEntity Group { get; set; } = null!;
|
||||
public SubjectEntity Subject { get; set; } = null!;
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
namespace Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission.Relation;
|
||||
|
||||
public class RoleAuthorityRelationData
|
||||
{
|
||||
public required long RoleId { get; set; }
|
||||
public required long AuthorityId { get; set; }
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Base;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Tenant;
|
||||
|
||||
namespace Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission.Relation;
|
||||
|
||||
public class RoleAuthorityRelationEntity : RoleAuthorityRelationData, IMappingEntity, IVersionableEntity
|
||||
{
|
||||
public RoleEntity Role { get; set; } = null!;
|
||||
public AuthorityEntity Authority { get; set; } = null!;
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
namespace Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission.Relation;
|
||||
|
||||
public class RoleGlobalAuthorityRelationData
|
||||
{
|
||||
public required long RoleId { get; set; }
|
||||
public required long GlobalAuthorityId { get; set; }
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Base;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Tenant;
|
||||
|
||||
namespace Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission.Relation;
|
||||
|
||||
public class RoleGlobalAuthorityRelationEntity : RoleGlobalAuthorityRelationData, IMappingEntity, IVersionableEntity
|
||||
{
|
||||
public RoleEntity Role { get; set; } = null!;
|
||||
public GlobalAuthorityEntity GlobalAuthority { get; set; } = null!;
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
namespace Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission.Relation;
|
||||
|
||||
public class RoleSubjectRelationData
|
||||
{
|
||||
public required long RoleId { get; set; }
|
||||
public required long SubjectId { get; set; }
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Base;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Subject;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Tenant;
|
||||
|
||||
namespace Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission.Relation;
|
||||
|
||||
public class RoleSubjectRelationEntity : RoleSubjectRelationData, IMappingEntity, IVersionableEntity
|
||||
{
|
||||
public RoleEntity Role { get; set; } = null!;
|
||||
public SubjectEntity Subject { get; set; } = null!;
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.App;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission.Data;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Subject;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Tenant;
|
||||
|
||||
namespace Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission;
|
||||
|
||||
public class RoleEntity : RoleData, IVersionableEntity
|
||||
{
|
||||
public HashSet<GroupEntity> Groups { get; set; } = [];
|
||||
public HashSet<AuthorityEntity> Authorities { get; set; } = [];
|
||||
public HashSet<GlobalAuthorityEntity> GlobalAuthorities { get; set; } = [];
|
||||
public HashSet<SubjectEntity> Subjects { get; set; } = [];
|
||||
public TenantEntity Tenant { get; set; } = null!;
|
||||
public AppEntity? App { get; set; }
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission.Data;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Subject;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Version;
|
||||
|
||||
namespace Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission.Version;
|
||||
|
||||
public class AuthorityVersionEntity : AuthorityData, IVersionEntity<AuthorityEntity>
|
||||
{
|
||||
public SubjectEntity? Suspect { get; set; }
|
||||
public long SuspectId { get; set; }
|
||||
public VersionAction Action { get; set; }
|
||||
public DateTimeOffset At { get; set; }
|
||||
public AuthorityEntity? Reference { get; set; }
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Base;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission.Relation;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Subject;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Version;
|
||||
|
||||
namespace Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission.Version;
|
||||
|
||||
public class GroupRoleRelationVersionEntity : GroupRoleRelationData, IMappingEntity, IVersionEntity<GroupRoleRelationEntity>
|
||||
{
|
||||
public SubjectEntity? Suspect { get; set; }
|
||||
public long SuspectId { get; set; }
|
||||
public VersionAction Action { get; set; }
|
||||
public DateTimeOffset At { get; set; }
|
||||
public GroupRoleRelationEntity? Reference { get; set; }
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Base;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission.Relation;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Subject;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Version;
|
||||
|
||||
namespace Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission.Version;
|
||||
|
||||
public class GroupSubjectRelationVersionEntity : GroupSubjectRelationData, IMappingEntity, IVersionEntity<GroupSubjectRelationEntity>
|
||||
{
|
||||
public SubjectEntity? Suspect { get; set; }
|
||||
public long SuspectId { get; set; }
|
||||
public VersionAction Action { get; set; }
|
||||
public DateTimeOffset At { get; set; }
|
||||
public GroupSubjectRelationEntity? Reference { get; set; }
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission.Data;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Subject;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Version;
|
||||
|
||||
namespace Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission.Version;
|
||||
|
||||
public class GroupVersionEntity : GroupData, IVersionEntity<GroupEntity>
|
||||
{
|
||||
public SubjectEntity? Suspect { get; set; }
|
||||
public long SuspectId { get; set; }
|
||||
public VersionAction Action { get; set; }
|
||||
public DateTimeOffset At { get; set; }
|
||||
public GroupEntity? Reference { get; set; }
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Base;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission.Relation;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Subject;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Version;
|
||||
|
||||
namespace Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission.Version;
|
||||
|
||||
public class RoleAuthorityRelationVersionEntity : RoleAuthorityRelationData, IMappingEntity, IVersionEntity<RoleAuthorityRelationEntity>
|
||||
{
|
||||
public SubjectEntity? Suspect { get; set; }
|
||||
public long SuspectId { get; set; }
|
||||
public VersionAction Action { get; set; }
|
||||
public DateTimeOffset At { get; set; }
|
||||
public RoleAuthorityRelationEntity? Reference { get; set; }
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Base;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission.Relation;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Subject;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Version;
|
||||
|
||||
namespace Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission.Version;
|
||||
|
||||
public class RoleGlobalAuthorityRelationVersionEntity : RoleGlobalAuthorityRelationData, IMappingEntity, IVersionEntity<RoleGlobalAuthorityRelationEntity>
|
||||
{
|
||||
public SubjectEntity? Suspect { get; set; }
|
||||
public long SuspectId { get; set; }
|
||||
public VersionAction Action { get; set; }
|
||||
public DateTimeOffset At { get; set; }
|
||||
public RoleGlobalAuthorityRelationEntity? Reference { get; set; }
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Base;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission.Relation;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Subject;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Version;
|
||||
|
||||
namespace Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission.Version;
|
||||
|
||||
public class RoleSubjectRelationVersionEntity : RoleSubjectRelationData, IMappingEntity, IVersionEntity<RoleSubjectRelationEntity>
|
||||
{
|
||||
public SubjectEntity? Suspect { get; set; }
|
||||
public long SuspectId { get; set; }
|
||||
public VersionAction Action { get; set; }
|
||||
public DateTimeOffset At { get; set; }
|
||||
public RoleSubjectRelationEntity? Reference { get; set; }
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission.Data;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Subject;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Version;
|
||||
|
||||
namespace Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission.Version;
|
||||
|
||||
public class RoleVersionEntity : RoleData, IVersionEntity<RoleEntity>
|
||||
{
|
||||
public SubjectEntity? Suspect { get; set; }
|
||||
public long SuspectId { get; set; }
|
||||
public VersionAction Action { get; set; }
|
||||
public DateTimeOffset At { get; set; }
|
||||
public RoleEntity? Reference { get; set; }
|
||||
}
|
||||
@ -1,28 +0,0 @@
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Base;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Subject;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Tenant;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Version;
|
||||
|
||||
namespace Suspectus.Gandalf.Palantir.Data.Entities.Security;
|
||||
|
||||
public class TenantSubjectRelationInternalAuthorityRelationEntity : TenantSubjectRelationInternalAuthorityRelationData<long>, IMappingEntity, IVersionableEntity
|
||||
{
|
||||
public TenantSubjectRelationEntity? TenantSubjectRelation { get; set; }
|
||||
public AuthorityEntity? InternalAuthority { get; set; }
|
||||
}
|
||||
|
||||
public class TenantSubjectRelationInternalAuthorityRelationVersionEntity : TenantSubjectRelationInternalAuthorityRelationData<long>, IVersionEntity<TenantSubjectRelationInternalAuthorityRelationEntity>
|
||||
{
|
||||
public SubjectEntity? Suspect { get; set; }
|
||||
public long SuspectId { get; set; }
|
||||
public VersionAction Action { get; set; }
|
||||
public DateTimeOffset At { get; set; }
|
||||
public TenantSubjectRelationInternalAuthorityRelationEntity? Reference { get; set; }
|
||||
}
|
||||
|
||||
public class TenantSubjectRelationInternalAuthorityRelationData<T> where T : IConvertible
|
||||
{
|
||||
public required T TenantId { get; set; }
|
||||
public required T SubjectId { get; set; }
|
||||
public required T InternalAuthorityId { get; set; }
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.App;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Base;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Subject.SignIn;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Tenant;
|
||||
|
||||
@ -11,4 +12,6 @@ public class SubjectEntity : VisibilityData
|
||||
public HashSet<SignInEntity> SignInMethods { get; set; } = [];
|
||||
public HashSet<TenantEntity> Tenants { get; set; } = [];
|
||||
public HashSet<AppEntity> Apps { get; set; } = [];
|
||||
public HashSet<RoleEntity> Roles { get; set; } = [];
|
||||
public HashSet<GroupEntity> Groups { get; set; } = [];
|
||||
}
|
||||
@ -1,4 +1,5 @@
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.App;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Subject;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Version;
|
||||
|
||||
@ -9,6 +10,9 @@ public class TenantEntity : TenantData, IVersionableEntity
|
||||
public SubjectEntity? Owner { get; set; }
|
||||
public HashSet<SubjectEntity> Subjects { get; set; } = [];
|
||||
public HashSet<AppEntity> Apps { get; set; } = [];
|
||||
public HashSet<GroupEntity> Groups { get; set; } = [];
|
||||
public HashSet<RoleEntity> Roles { get; set; } = [];
|
||||
public HashSet<AuthorityEntity> Authorities { get; set; } = [];
|
||||
}
|
||||
|
||||
public interface IVersionableEntity;
|
||||
|
||||
@ -1,18 +1,18 @@
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Base;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Security;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Subject;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Version;
|
||||
|
||||
namespace Suspectus.Gandalf.Palantir.Data.Entities.Tenant;
|
||||
|
||||
public class TenantSubjectRelationEntity : TenantSubjectRelationData<long>, IMappingEntity, IVersionableEntity
|
||||
public class TenantSubjectRelationEntity : TenantSubjectRelationData, IMappingEntity, IVersionableEntity
|
||||
{
|
||||
public TenantEntity? Tenant { get; set; }
|
||||
public SubjectEntity? Subject { get; set; }
|
||||
public HashSet<AuthorityEntity> InternalAuthorities { get; set; } = [];
|
||||
}
|
||||
|
||||
public class TenantSubjectRelationVersionEntity : TenantSubjectRelationData<long>, IVersionEntity<TenantSubjectRelationEntity>
|
||||
public class TenantSubjectRelationVersionEntity : TenantSubjectRelationData, IVersionEntity<TenantSubjectRelationEntity>
|
||||
{
|
||||
public SubjectEntity? Suspect { get; set; }
|
||||
public long SuspectId { get; set; }
|
||||
@ -21,8 +21,8 @@ public class TenantSubjectRelationVersionEntity : TenantSubjectRelationData<long
|
||||
public TenantSubjectRelationEntity? Reference { get; set; }
|
||||
}
|
||||
|
||||
public abstract class TenantSubjectRelationData<T> where T : IConvertible
|
||||
public abstract class TenantSubjectRelationData
|
||||
{
|
||||
public T TenantId { get; set; }
|
||||
public T SubjectId { get; set; }
|
||||
public required long TenantId { get; set; }
|
||||
public required long SubjectId { get; set; }
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission.Data;
|
||||
|
||||
namespace Suspectus.Gandalf.Palantir.Data.MasterData.Attributes;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class AuthorityAttribute : Attribute
|
||||
{
|
||||
public string? OldKey { get; init; }
|
||||
public string? Path { get; init; }
|
||||
public AuthorityType Type { get; init; }
|
||||
|
||||
|
||||
public AuthorityAttribute(AuthorityType type, string? path = null, string? oldKey = null)
|
||||
{
|
||||
OldKey = oldKey;
|
||||
Type = type;
|
||||
Path = path;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission.Data;
|
||||
|
||||
namespace Suspectus.Gandalf.Palantir.Data.MasterData.Attributes;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class GlobalAuthorityAttribute : Attribute
|
||||
{
|
||||
public string? OldKey { get; init; }
|
||||
public string? Path { get; init; }
|
||||
public AuthorityType Type { get; init; }
|
||||
|
||||
|
||||
public GlobalAuthorityAttribute(AuthorityType type, string? path = null, string? oldKey = null)
|
||||
{
|
||||
OldKey = oldKey;
|
||||
Type = type;
|
||||
Path = path;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission.Data;
|
||||
|
||||
namespace Suspectus.Gandalf.Palantir.Data.MasterData.Attributes;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class GroupAttribute : Attribute
|
||||
{
|
||||
public string? OldKey { get; init; }
|
||||
public AuthorityType Type { get; init; }
|
||||
public string? Path { get; init; }
|
||||
|
||||
public GroupAttribute(AuthorityType type, string? path = null, string? oldKey = null)
|
||||
{
|
||||
OldKey = oldKey;
|
||||
Type = type;
|
||||
Path = path;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
namespace Suspectus.Gandalf.Palantir.Data.MasterData.Attributes;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class HasAuthoritiesAttribute : Attribute
|
||||
{
|
||||
public IReadOnlyList<string> Authorities { get; init; } = [];
|
||||
public bool AllAuthorities { get; init; }
|
||||
|
||||
public HasAuthoritiesAttribute(params string[] authorities)
|
||||
{
|
||||
Authorities = authorities;
|
||||
}
|
||||
|
||||
public HasAuthoritiesAttribute(bool allAuthorities)
|
||||
{
|
||||
AllAuthorities = allAuthorities;
|
||||
}
|
||||
}
|
||||
@ -1,17 +1,17 @@
|
||||
namespace Suspectus.Gandalf.Palantir.Data.MasterData.Atttibutes;
|
||||
namespace Suspectus.Gandalf.Palantir.Data.MasterData.Attributes;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class HasMasterAuthoritiesAttribute : Attribute
|
||||
public class HasGlobalAuthoritiesAttribute : Attribute
|
||||
{
|
||||
public IReadOnlyList<string> Authorities { get; init; } = [];
|
||||
public bool AllAuthorities { get; init; }
|
||||
|
||||
public HasMasterAuthoritiesAttribute(params string[] authorities)
|
||||
public HasGlobalAuthoritiesAttribute(params string[] authorities)
|
||||
{
|
||||
Authorities = authorities;
|
||||
}
|
||||
|
||||
public HasMasterAuthoritiesAttribute(bool allAuthorities)
|
||||
public HasGlobalAuthoritiesAttribute(bool allAuthorities)
|
||||
{
|
||||
AllAuthorities = allAuthorities;
|
||||
}
|
||||
@ -1,17 +1,17 @@
|
||||
namespace Suspectus.Gandalf.Palantir.Data.MasterData.Atttibutes;
|
||||
namespace Suspectus.Gandalf.Palantir.Data.MasterData.Attributes;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class HasMasterRolesAttribute : Attribute
|
||||
public class HasRolesAttribute : Attribute
|
||||
{
|
||||
public IReadOnlyList<string> Roles { get; init; } = [];
|
||||
public bool AllRoles { get; init; }
|
||||
|
||||
public HasMasterRolesAttribute(params string[] roles)
|
||||
public HasRolesAttribute(params string[] roles)
|
||||
{
|
||||
Roles = roles;
|
||||
}
|
||||
|
||||
public HasMasterRolesAttribute(bool allRoles)
|
||||
public HasRolesAttribute(bool allRoles)
|
||||
{
|
||||
AllRoles = allRoles;
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission.Data;
|
||||
|
||||
namespace Suspectus.Gandalf.Palantir.Data.MasterData.Attributes;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class RoleAttribute : AuthorityAttribute
|
||||
{
|
||||
public RoleAttribute(AuthorityType type, string? path = null, string? oldKey = null) : base(type, path, oldKey) {}
|
||||
}
|
||||
@ -1,14 +0,0 @@
|
||||
namespace Suspectus.Gandalf.Palantir.Data.MasterData.Atttibutes;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class MasterAuthorityAttribute : Attribute
|
||||
{
|
||||
public string? OldKey { get; init; }
|
||||
|
||||
public MasterAuthorityAttribute() {}
|
||||
|
||||
public MasterAuthorityAttribute(string? oldKey)
|
||||
{
|
||||
OldKey = oldKey;
|
||||
}
|
||||
}
|
||||
@ -1,14 +0,0 @@
|
||||
namespace Suspectus.Gandalf.Palantir.Data.MasterData.Atttibutes;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class MasterGroupAttribute : Attribute
|
||||
{
|
||||
public string? OldKey { get; init; }
|
||||
|
||||
public MasterGroupAttribute() {}
|
||||
|
||||
public MasterGroupAttribute(string? oldKey)
|
||||
{
|
||||
OldKey = oldKey;
|
||||
}
|
||||
}
|
||||
@ -1,14 +0,0 @@
|
||||
namespace Suspectus.Gandalf.Palantir.Data.MasterData.Atttibutes;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class MasterRoleAttribute : Attribute
|
||||
{
|
||||
public string? OldKey { get; init; }
|
||||
|
||||
public MasterRoleAttribute() {}
|
||||
|
||||
public MasterRoleAttribute(string? oldKey)
|
||||
{
|
||||
OldKey = oldKey;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,141 @@
|
||||
using System.ComponentModel;
|
||||
using System.Reflection;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission.Data;
|
||||
using Suspectus.Gandalf.Palantir.Data.MasterData.Attributes;
|
||||
|
||||
namespace Suspectus.Gandalf.Palantir.Data.MasterData;
|
||||
|
||||
public static class Authorities
|
||||
{
|
||||
private const string RootPrefix = "g";
|
||||
|
||||
public static class Global
|
||||
{
|
||||
private const string GlobalPrefix = $"{RootPrefix}.global";
|
||||
|
||||
public static class TenantAuthorities
|
||||
{
|
||||
private const string TenantPrefix = $"{GlobalPrefix}.t";
|
||||
private const string TenantPath = "Tenant Authorities";
|
||||
|
||||
[GlobalAuthority(AuthorityType.Tenant, TenantPath)] [Description("Allows to see this tenant.")]
|
||||
public const string View = $"{TenantPrefix}.view";
|
||||
|
||||
public static class App
|
||||
{
|
||||
private const string AppPrefix = $"{TenantPrefix}.a";
|
||||
private const string AppPath = $"{TenantPath}/App";
|
||||
|
||||
[GlobalAuthority(AuthorityType.Tenant, AppPath)] [Description("Allows to create a app for this tenant.")]
|
||||
public const string Create = $"{AppPrefix}.add";
|
||||
}
|
||||
}
|
||||
|
||||
public static class AppAuthorities
|
||||
{
|
||||
private const string AppPrefix = $"{GlobalPrefix}.a";
|
||||
private const string AppPath = "App Authorities";
|
||||
|
||||
[GlobalAuthority(AuthorityType.App, AppPath)] [Description("Allows to see this app.")]
|
||||
public const string View = $"{AppPrefix}.view";
|
||||
}
|
||||
}
|
||||
|
||||
public static class Profile
|
||||
{
|
||||
private const string ProfilePrefix = $"{RootPrefix}.p";
|
||||
private const string ProfilePath = $"{nameof(Profile)}";
|
||||
|
||||
[Authority(AuthorityType.App, ProfilePath)] [Description("Allows to view any profile.")]
|
||||
public const string View = $"{ProfilePrefix}.view";
|
||||
|
||||
[Authority(AuthorityType.App, ProfilePath)] [Description("Allows to edit any profile.")]
|
||||
public const string Edit = $"{ProfilePrefix}.edit";
|
||||
|
||||
public static class Self
|
||||
{
|
||||
private const string SelfProfilePrefix = $"{ProfilePrefix}.self";
|
||||
private const string SelfProfilePath = $"{ProfilePath}/{nameof(Self)}";
|
||||
|
||||
[Authority(AuthorityType.App, SelfProfilePath)] [Description("Allows to view your own profile.")]
|
||||
public const string View = $"{SelfProfilePrefix}.view";
|
||||
|
||||
[Authority(AuthorityType.App, SelfProfilePath)] [Description("Allows to edit your own profile.")]
|
||||
public const string Edit = $"{SelfProfilePrefix}.edit";
|
||||
}
|
||||
}
|
||||
|
||||
public static class Tenant
|
||||
{
|
||||
private const string TenantPrefix = $"{RootPrefix}.t";
|
||||
private const string TenantPath = $"{nameof(Tenant)}";
|
||||
|
||||
[Authority(AuthorityType.App, TenantPath)] [Description("Allows to create a tenant.")]
|
||||
public const string Create = $"{TenantPrefix}.add";
|
||||
}
|
||||
|
||||
public static List<MasterAuthorityData> GetAllAuthorities()
|
||||
{
|
||||
var authorities = new List<FieldInfo>();
|
||||
CollectFields(typeof(Authorities));
|
||||
|
||||
return authorities
|
||||
.Select(x => new MasterAuthorityData
|
||||
{
|
||||
Name = (string)x.GetValue(null)!,
|
||||
Type = x.GetCustomAttribute<AuthorityAttribute>()!.Type,
|
||||
OldName = x.GetCustomAttribute<AuthorityAttribute>()!.OldKey,
|
||||
Description = x.GetCustomAttribute<DescriptionAttribute>()?.Description ?? null,
|
||||
Path = x.GetCustomAttribute<AuthorityAttribute>()!.Path
|
||||
}).ToList();
|
||||
|
||||
void CollectFields(Type type)
|
||||
{
|
||||
var fields = type
|
||||
.GetFields(BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy)
|
||||
.Where(f => f.FieldType == typeof(string) && Attribute.IsDefined(f, typeof(AuthorityAttribute)));
|
||||
|
||||
authorities.AddRange(fields);
|
||||
|
||||
foreach (var nested in type.GetNestedTypes())
|
||||
CollectFields(nested);
|
||||
}
|
||||
}
|
||||
|
||||
public static List<MasterAuthorityData> GetAllGlobalAuthorities()
|
||||
{
|
||||
var authorities = new List<FieldInfo>();
|
||||
CollectFields(typeof(Authorities));
|
||||
|
||||
return authorities
|
||||
.Select(x => new MasterAuthorityData
|
||||
{
|
||||
Name = (string)x.GetValue(null)!,
|
||||
Type = x.GetCustomAttribute<GlobalAuthorityAttribute>()!.Type,
|
||||
OldName = x.GetCustomAttribute<GlobalAuthorityAttribute>()!.OldKey,
|
||||
Description = x.GetCustomAttribute<DescriptionAttribute>()?.Description ?? null,
|
||||
Path = x.GetCustomAttribute<GlobalAuthorityAttribute>()!.Path
|
||||
}).ToList();
|
||||
|
||||
void CollectFields(Type type)
|
||||
{
|
||||
var fields = type
|
||||
.GetFields(BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy)
|
||||
.Where(f => f.FieldType == typeof(string) && Attribute.IsDefined(f, typeof(GlobalAuthorityAttribute)));
|
||||
|
||||
authorities.AddRange(fields);
|
||||
|
||||
foreach (var nested in type.GetNestedTypes())
|
||||
CollectFields(nested);
|
||||
}
|
||||
}
|
||||
|
||||
public class MasterAuthorityData
|
||||
{
|
||||
public required string Name { get; set; } = null!;
|
||||
public required AuthorityType Type { get; set; }
|
||||
public string? OldName { get; set; }
|
||||
public string? Description { get; set; }
|
||||
public string? Path { get; set; }
|
||||
}
|
||||
}
|
||||
@ -1,39 +1,47 @@
|
||||
using System.ComponentModel;
|
||||
using System.Reflection;
|
||||
using Suspectus.Gandalf.Palantir.Data.MasterData.Atttibutes;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission.Data;
|
||||
using Suspectus.Gandalf.Palantir.Data.MasterData.Attributes;
|
||||
|
||||
namespace Suspectus.Gandalf.Palantir.Data.MasterData;
|
||||
|
||||
public static class MasterGroups
|
||||
public static class Groups
|
||||
{
|
||||
[MasterGroup]
|
||||
[Description("Contains the minimal set of Roles to use the application.")]
|
||||
[HasMasterRoles(MasterRoles.SelfProfile)]
|
||||
public const string BasicUser = "Basic User";
|
||||
[Group(AuthorityType.Tenant, "Housemaster", oldKey: "")]
|
||||
[Description("Housemaster group, has full control over the tenant.")]
|
||||
[HasRoles(Roles.TenantHousemaster)]
|
||||
public const string TenantHousemaster = "Housemaster";
|
||||
|
||||
[Group(AuthorityType.App, "Housemaster")]
|
||||
[Description("Housemaster group, has full control over the app.")]
|
||||
[HasRoles(Roles.AppHousemaster)]
|
||||
public const string AppHousemaster = "Housemaster";
|
||||
|
||||
public static List<MasterGroupData> GetAllGroups()
|
||||
{
|
||||
var groups = new List<FieldInfo>();
|
||||
CollectFields(typeof(MasterGroups));
|
||||
CollectFields(typeof(Groups));
|
||||
|
||||
return groups
|
||||
.Select(x => new MasterGroupData
|
||||
{
|
||||
Name = (string)x.GetValue(null)!,
|
||||
OldName = x.GetCustomAttribute<MasterGroupAttribute>()!.OldKey,
|
||||
Type = x.GetCustomAttribute<GroupAttribute>()!.Type,
|
||||
OldName = x.GetCustomAttribute<GroupAttribute>()!.OldKey,
|
||||
Path = x.GetCustomAttribute<GroupAttribute>()!.Path,
|
||||
Description = x.GetCustomAttribute<DescriptionAttribute>()?.Description ?? null,
|
||||
Roles = GetRoles(x)
|
||||
}).ToList();
|
||||
|
||||
IReadOnlyList<string> GetRoles(FieldInfo field)
|
||||
{
|
||||
var hasMasterRolesAttribute = field.GetCustomAttribute<HasMasterRolesAttribute>();
|
||||
var hasMasterRolesAttribute = field.GetCustomAttribute<HasRolesAttribute>();
|
||||
|
||||
if (hasMasterRolesAttribute is null)
|
||||
return [];
|
||||
|
||||
if (hasMasterRolesAttribute.AllRoles)
|
||||
return MasterRoles.GetAllRoles().Select(x => x.Name).ToList();
|
||||
return Roles.GetAllRoles().Select(x => x.Name).ToList();
|
||||
|
||||
return hasMasterRolesAttribute.Roles;
|
||||
}
|
||||
@ -42,7 +50,7 @@ public static class MasterGroups
|
||||
{
|
||||
var fields = type
|
||||
.GetFields(BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy)
|
||||
.Where(f => f.FieldType == typeof(string) && Attribute.IsDefined(f, typeof(MasterGroupAttribute)));
|
||||
.Where(f => f.FieldType == typeof(string) && Attribute.IsDefined(f, typeof(GroupAttribute)));
|
||||
|
||||
groups.AddRange(fields);
|
||||
|
||||
@ -53,9 +61,11 @@ public static class MasterGroups
|
||||
|
||||
public class MasterGroupData
|
||||
{
|
||||
public required string Name { get; set; }
|
||||
public required string Name { get; set; } = null!;
|
||||
public required AuthorityType Type { get; set; }
|
||||
public string? OldName { get; set; }
|
||||
public string? Description { get; set; }
|
||||
public string? Path { get; set; }
|
||||
public IReadOnlyList<string> Roles { get; set; } = [];
|
||||
}
|
||||
}
|
||||
@ -1,59 +0,0 @@
|
||||
using System.ComponentModel;
|
||||
using System.Reflection;
|
||||
using Suspectus.Gandalf.Palantir.Data.MasterData.Atttibutes;
|
||||
|
||||
namespace Suspectus.Gandalf.Palantir.Data.MasterData;
|
||||
|
||||
public static class MasterAuthorities
|
||||
{
|
||||
public static class Profile
|
||||
{
|
||||
[MasterAuthority] [Description("Allows to view any profile.")]
|
||||
public const string Read = "g.profile.read";
|
||||
|
||||
[MasterAuthority] [Description("Allows to edit any profile.")]
|
||||
public const string Write = "g.profile.write";
|
||||
|
||||
public static class Self
|
||||
{
|
||||
[MasterAuthority] [Description("Allows to view your own profile.")]
|
||||
public const string Read = "g.profile.self.read";
|
||||
|
||||
[MasterAuthority] [Description("Allows to edit your own profile.")]
|
||||
public const string Write = "g.profile.self.write";
|
||||
}
|
||||
}
|
||||
|
||||
public static List<MasterAuthorityData> GetAllAuthorities()
|
||||
{
|
||||
var authorities = new List<FieldInfo>();
|
||||
CollectFields(typeof(MasterAuthorities));
|
||||
|
||||
return authorities
|
||||
.Select(x => new MasterAuthorityData
|
||||
{
|
||||
Name = (string)x.GetValue(null)!,
|
||||
OldName = x.GetCustomAttribute<MasterAuthorityAttribute>()!.OldKey,
|
||||
Description = x.GetCustomAttribute<DescriptionAttribute>()?.Description ?? null
|
||||
}).ToList();
|
||||
|
||||
void CollectFields(Type type)
|
||||
{
|
||||
var fields = type
|
||||
.GetFields(BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy)
|
||||
.Where(f => f.FieldType == typeof(string) && Attribute.IsDefined(f, typeof(MasterAuthorityAttribute)));
|
||||
|
||||
authorities.AddRange(fields);
|
||||
|
||||
foreach (var nested in type.GetNestedTypes())
|
||||
CollectFields(nested);
|
||||
}
|
||||
}
|
||||
|
||||
public class MasterAuthorityData
|
||||
{
|
||||
public string Name { get; set; } = null!;
|
||||
public string? OldName { get; set; }
|
||||
public string? Description { get; set; }
|
||||
}
|
||||
}
|
||||
@ -1,66 +0,0 @@
|
||||
using System.ComponentModel;
|
||||
using System.Reflection;
|
||||
using Suspectus.Gandalf.Palantir.Data.MasterData.Atttibutes;
|
||||
|
||||
namespace Suspectus.Gandalf.Palantir.Data.MasterData;
|
||||
|
||||
public static class MasterRoles
|
||||
{
|
||||
[MasterRole]
|
||||
[Description("Allows everything.")]
|
||||
[HasMasterAuthorities(true)]
|
||||
public const string Housemaster = nameof(Housemaster);
|
||||
|
||||
[MasterRole]
|
||||
[Description("Allows to view your own profile.")]
|
||||
[HasMasterAuthorities(MasterAuthorities.Profile.Self.Read, MasterAuthorities.Profile.Self.Write)]
|
||||
public const string SelfProfile = "Self Profile";
|
||||
|
||||
public static List<MasterRoleData> GetAllRoles()
|
||||
{
|
||||
var roles = new List<FieldInfo>();
|
||||
CollectFields(typeof(MasterRoles));
|
||||
|
||||
return roles
|
||||
.Select(x => new MasterRoleData
|
||||
{
|
||||
Name = (string)x.GetValue(null)!,
|
||||
OldName = x.GetCustomAttribute<MasterRoleAttribute>()!.OldKey,
|
||||
Description = x.GetCustomAttribute<DescriptionAttribute>()?.Description ?? null,
|
||||
Authorities = GetAuthorities(x)
|
||||
}).ToList();
|
||||
|
||||
IReadOnlyList<string> GetAuthorities(FieldInfo field)
|
||||
{
|
||||
var hasMasterAuthoritiesAttribute = field.GetCustomAttribute<HasMasterAuthoritiesAttribute>();
|
||||
|
||||
if (hasMasterAuthoritiesAttribute is null)
|
||||
return [];
|
||||
|
||||
if (hasMasterAuthoritiesAttribute.AllAuthorities)
|
||||
return MasterAuthorities.GetAllAuthorities().Select(x => x.Name).ToList();
|
||||
|
||||
return hasMasterAuthoritiesAttribute.Authorities;
|
||||
}
|
||||
|
||||
void CollectFields(Type type)
|
||||
{
|
||||
var fields = type
|
||||
.GetFields(BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy)
|
||||
.Where(f => f.FieldType == typeof(string) && Attribute.IsDefined(f, typeof(MasterRoleAttribute)));
|
||||
|
||||
roles.AddRange(fields);
|
||||
|
||||
foreach (var nested in type.GetNestedTypes())
|
||||
CollectFields(nested);
|
||||
}
|
||||
}
|
||||
|
||||
public class MasterRoleData
|
||||
{
|
||||
public required string Name { get; set; }
|
||||
public string? OldName { get; set; }
|
||||
public string? Description { get; set; }
|
||||
public IReadOnlyList<string> Authorities { get; set; } = [];
|
||||
}
|
||||
}
|
||||
100
src/dotnet/Suspectus.Gandalf.Palantir.Data/MasterData/Roles.cs
Normal file
100
src/dotnet/Suspectus.Gandalf.Palantir.Data/MasterData/Roles.cs
Normal file
@ -0,0 +1,100 @@
|
||||
using System.ComponentModel;
|
||||
using System.Reflection;
|
||||
using Suspectus.Gandalf.Palantir.Data.Entities.Security.Permission.Data;
|
||||
using Suspectus.Gandalf.Palantir.Data.MasterData.Attributes;
|
||||
|
||||
namespace Suspectus.Gandalf.Palantir.Data.MasterData;
|
||||
|
||||
public static class Roles
|
||||
{
|
||||
[Role(AuthorityType.App, "Housemaster")]
|
||||
[Description("Allows everything.")]
|
||||
[HasAuthorities(true)]
|
||||
[HasGlobalAuthorities(true)]
|
||||
public const string AppHousemaster = "Housemaster";
|
||||
|
||||
[Role(AuthorityType.Tenant, "Housemaster")]
|
||||
[Description("Allows everything.")]
|
||||
[HasAuthorities(true)]
|
||||
[HasGlobalAuthorities(true)]
|
||||
public const string TenantHousemaster = "Housemaster";
|
||||
|
||||
public static List<MasterRoleData> GetAllRoles()
|
||||
{
|
||||
var roles = new List<FieldInfo>();
|
||||
CollectFields(typeof(Roles));
|
||||
|
||||
return roles
|
||||
.Select(x => new MasterRoleData
|
||||
{
|
||||
Name = (string)x.GetValue(null)!,
|
||||
Type = x.GetCustomAttribute<RoleAttribute>()!.Type,
|
||||
OldName = x.GetCustomAttribute<RoleAttribute>()!.OldKey,
|
||||
Path = x.GetCustomAttribute<RoleAttribute>()!.Path,
|
||||
Description = x.GetCustomAttribute<DescriptionAttribute>()?.Description ?? null,
|
||||
Authorities = GetAuthorities(x, x.GetCustomAttribute<RoleAttribute>()!.Type),
|
||||
GlobalAuthorities= GetGlobalAuthorities(x, x.GetCustomAttribute<RoleAttribute>()!.Type)
|
||||
}).ToList();
|
||||
|
||||
IReadOnlyList<string> GetGlobalAuthorities(FieldInfo field, AuthorityType type)
|
||||
{
|
||||
var hasGlobalAuthoritiesAttribute = field.GetCustomAttribute<HasGlobalAuthoritiesAttribute>();
|
||||
|
||||
if (hasGlobalAuthoritiesAttribute is null)
|
||||
return [];
|
||||
|
||||
if (hasGlobalAuthoritiesAttribute.AllAuthorities)
|
||||
{
|
||||
return Authorities
|
||||
.GetAllGlobalAuthorities()
|
||||
.Where(x => x.Type == type)
|
||||
.Select(x => x.Name)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
return hasGlobalAuthoritiesAttribute.Authorities;
|
||||
}
|
||||
|
||||
IReadOnlyList<string> GetAuthorities(FieldInfo field, AuthorityType type)
|
||||
{
|
||||
var hasAuthoritiesAttribute = field.GetCustomAttribute<HasAuthoritiesAttribute>();
|
||||
|
||||
if (hasAuthoritiesAttribute is null)
|
||||
return [];
|
||||
|
||||
if (hasAuthoritiesAttribute.AllAuthorities)
|
||||
{
|
||||
return Authorities
|
||||
.GetAllAuthorities()
|
||||
.Where(x => x.Type == type)
|
||||
.Select(x => x.Name)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
return hasAuthoritiesAttribute.Authorities;
|
||||
}
|
||||
|
||||
void CollectFields(Type type)
|
||||
{
|
||||
var fields = type
|
||||
.GetFields(BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy)
|
||||
.Where(f => f.FieldType == typeof(string) && Attribute.IsDefined(f, typeof(RoleAttribute)));
|
||||
|
||||
roles.AddRange(fields);
|
||||
|
||||
foreach (var nested in type.GetNestedTypes())
|
||||
CollectFields(nested);
|
||||
}
|
||||
}
|
||||
|
||||
public class MasterRoleData
|
||||
{
|
||||
public required string Name { get; set; } = null!;
|
||||
public required AuthorityType Type { get; set; }
|
||||
public string? OldName { get; set; }
|
||||
public string? Description { get; set; }
|
||||
public string? Path { get; init; }
|
||||
public IReadOnlyList<string> Authorities { get; set; } = [];
|
||||
public IReadOnlyList<string> GlobalAuthorities { get; set; } = [];
|
||||
}
|
||||
}
|
||||
@ -1,663 +0,0 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using Suspectus.Gandalf.Palantir.Data.Database;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace W542.GandalfReborn.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(ApplicationContext))]
|
||||
[Migration("20240903154112_sus")]
|
||||
partial class sus
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.8")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("TenantId");
|
||||
|
||||
b.ToTable("AppRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("AppRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId");
|
||||
|
||||
b.HasIndex("AppId");
|
||||
|
||||
b.ToTable("AppSubjectRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("AppSubjectRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId", "InternalAuthorityId");
|
||||
|
||||
b.HasIndex("InternalAuthorityId");
|
||||
|
||||
b.ToTable("AppSubjectRelationInternalAuthorityRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId", "InternalAuthorityId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("AppSubjectRelationInternalAuthorityRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AuthorityEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Type")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Name")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Authority", "gr");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1L,
|
||||
Description = "Allows users to read tenants",
|
||||
Name = "Tenant_Read",
|
||||
Type = "Tenant"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2L,
|
||||
Description = "Allows users to read apps",
|
||||
Name = "App_Read",
|
||||
Type = "App"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId", "InternalAuthorityId");
|
||||
|
||||
b.HasIndex("InternalAuthorityId");
|
||||
|
||||
b.ToTable("TenantSubjectRelationInternalAuthorityRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId", "InternalAuthorityId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("TenantSubjectRelationInternalAuthorityRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Subject.SignIn.SignInEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsLegacy")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Method")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("PasswordHash")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SubjectId");
|
||||
|
||||
b.ToTable("SignIn", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Name")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Subject", "gr");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1L,
|
||||
Name = "chris",
|
||||
Visibility = "Active"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("OwnerId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OwnerId");
|
||||
|
||||
b.ToTable("Tenant", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId");
|
||||
|
||||
b.HasIndex("TenantId");
|
||||
|
||||
b.ToTable("TenantSubjectRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("TenantSubjectRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("OwnerId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("TenantVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", "Tenant")
|
||||
.WithMany("Apps")
|
||||
.HasForeignKey("TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Tenant");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.App.AppRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.App.AppRelationEntity", "App")
|
||||
.WithMany()
|
||||
.HasForeignKey("AppId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Subject")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("App");
|
||||
|
||||
b.Navigation("Subject");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "AppId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Security.AuthorityEntity", "InternalAuthority")
|
||||
.WithMany()
|
||||
.HasForeignKey("InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationEntity", "AppSubjectRelation")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "AppId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("AppSubjectRelation");
|
||||
|
||||
b.Navigation("InternalAuthority");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "AppId", "InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Security.AuthorityEntity", "InternalAuthority")
|
||||
.WithMany()
|
||||
.HasForeignKey("InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationEntity", "TenantSubjectRelation")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("InternalAuthority");
|
||||
|
||||
b.Navigation("TenantSubjectRelation");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "TenantId", "InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Subject.SignIn.SignInEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Subject")
|
||||
.WithMany("SignInMethods")
|
||||
.HasForeignKey("SubjectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Subject");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Owner")
|
||||
.WithMany()
|
||||
.HasForeignKey("OwnerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Owner");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Subject")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", "Tenant")
|
||||
.WithMany()
|
||||
.HasForeignKey("TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Subject");
|
||||
|
||||
b.Navigation("Tenant");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", b =>
|
||||
{
|
||||
b.Navigation("SignInMethods");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", b =>
|
||||
{
|
||||
b.Navigation("Apps");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,592 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
||||
|
||||
namespace W542.GandalfReborn.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class sus : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.EnsureSchema(
|
||||
name: "gr");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Authority",
|
||||
schema: "gr",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Name = table.Column<string>(type: "text", nullable: false),
|
||||
Type = table.Column<string>(type: "text", nullable: false),
|
||||
Description = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Authority", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Subject",
|
||||
schema: "gr",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Name = table.Column<string>(type: "text", nullable: false),
|
||||
Visibility = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Subject", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "SignIn",
|
||||
schema: "gr",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Method = table.Column<string>(type: "text", nullable: false),
|
||||
IsLegacy = table.Column<bool>(type: "boolean", nullable: false),
|
||||
Email = table.Column<string>(type: "text", nullable: true),
|
||||
PasswordHash = table.Column<string>(type: "text", nullable: true),
|
||||
Visibility = table.Column<string>(type: "text", nullable: false),
|
||||
SubjectId = table.Column<long>(type: "bigint", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_SignIn", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_SignIn_Subject_SubjectId",
|
||||
column: x => x.SubjectId,
|
||||
principalSchema: "gr",
|
||||
principalTable: "Subject",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Tenant",
|
||||
schema: "gr",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Visibility = table.Column<string>(type: "text", nullable: false),
|
||||
OwnerId = table.Column<long>(type: "bigint", nullable: false),
|
||||
Name = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Tenant", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Tenant_Subject_OwnerId",
|
||||
column: x => x.OwnerId,
|
||||
principalSchema: "gr",
|
||||
principalTable: "Subject",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AppRelation",
|
||||
schema: "gr",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Visibility = table.Column<string>(type: "text", nullable: false),
|
||||
TenantId = table.Column<long>(type: "bigint", nullable: false),
|
||||
Name = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AppRelation", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_AppRelation_Tenant_TenantId",
|
||||
column: x => x.TenantId,
|
||||
principalSchema: "gr",
|
||||
principalTable: "Tenant",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TenantSubjectRelation",
|
||||
schema: "gr",
|
||||
columns: table => new
|
||||
{
|
||||
TenantId = table.Column<long>(type: "bigint", nullable: false),
|
||||
SubjectId = table.Column<long>(type: "bigint", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TenantSubjectRelation", x => new { x.SubjectId, x.TenantId });
|
||||
table.ForeignKey(
|
||||
name: "FK_TenantSubjectRelation_Subject_SubjectId",
|
||||
column: x => x.SubjectId,
|
||||
principalSchema: "gr",
|
||||
principalTable: "Subject",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_TenantSubjectRelation_Tenant_TenantId",
|
||||
column: x => x.TenantId,
|
||||
principalSchema: "gr",
|
||||
principalTable: "Tenant",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TenantVersion",
|
||||
schema: "gr",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<long>(type: "bigint", nullable: false),
|
||||
At = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
||||
SuspectId = table.Column<long>(type: "bigint", nullable: false),
|
||||
Action = table.Column<string>(type: "text", nullable: false),
|
||||
Visibility = table.Column<string>(type: "text", nullable: false),
|
||||
OwnerId = table.Column<long>(type: "bigint", nullable: false),
|
||||
Name = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TenantVersion", x => new { x.Id, x.At });
|
||||
table.ForeignKey(
|
||||
name: "FK_TenantVersion_Subject_SuspectId",
|
||||
column: x => x.SuspectId,
|
||||
principalSchema: "gr",
|
||||
principalTable: "Subject",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_TenantVersion_Tenant_Id",
|
||||
column: x => x.Id,
|
||||
principalSchema: "gr",
|
||||
principalTable: "Tenant",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AppRelationVersion",
|
||||
schema: "gr",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<long>(type: "bigint", nullable: false),
|
||||
At = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
||||
SuspectId = table.Column<long>(type: "bigint", nullable: false),
|
||||
Action = table.Column<string>(type: "text", nullable: false),
|
||||
Visibility = table.Column<string>(type: "text", nullable: false),
|
||||
TenantId = table.Column<long>(type: "bigint", nullable: false),
|
||||
Name = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AppRelationVersion", x => new { x.Id, x.At });
|
||||
table.ForeignKey(
|
||||
name: "FK_AppRelationVersion_AppRelation_Id",
|
||||
column: x => x.Id,
|
||||
principalSchema: "gr",
|
||||
principalTable: "AppRelation",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_AppRelationVersion_Subject_SuspectId",
|
||||
column: x => x.SuspectId,
|
||||
principalSchema: "gr",
|
||||
principalTable: "Subject",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AppSubjectRelation",
|
||||
schema: "gr",
|
||||
columns: table => new
|
||||
{
|
||||
AppId = table.Column<long>(type: "bigint", nullable: false),
|
||||
SubjectId = table.Column<long>(type: "bigint", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AppSubjectRelation", x => new { x.SubjectId, x.AppId });
|
||||
table.ForeignKey(
|
||||
name: "FK_AppSubjectRelation_AppRelation_AppId",
|
||||
column: x => x.AppId,
|
||||
principalSchema: "gr",
|
||||
principalTable: "AppRelation",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_AppSubjectRelation_Subject_SubjectId",
|
||||
column: x => x.SubjectId,
|
||||
principalSchema: "gr",
|
||||
principalTable: "Subject",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TenantSubjectRelationInternalAuthorityRelation",
|
||||
schema: "gr",
|
||||
columns: table => new
|
||||
{
|
||||
TenantId = table.Column<long>(type: "bigint", nullable: false),
|
||||
SubjectId = table.Column<long>(type: "bigint", nullable: false),
|
||||
InternalAuthorityId = table.Column<long>(type: "bigint", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TenantSubjectRelationInternalAuthorityRelation", x => new { x.SubjectId, x.TenantId, x.InternalAuthorityId });
|
||||
table.ForeignKey(
|
||||
name: "FK_TenantSubjectRelationInternalAuthorityRelation_Authority_In~",
|
||||
column: x => x.InternalAuthorityId,
|
||||
principalSchema: "gr",
|
||||
principalTable: "Authority",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_TenantSubjectRelationInternalAuthorityRelation_TenantSubjec~",
|
||||
columns: x => new { x.SubjectId, x.TenantId },
|
||||
principalSchema: "gr",
|
||||
principalTable: "TenantSubjectRelation",
|
||||
principalColumns: new[] { "SubjectId", "TenantId" },
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TenantSubjectRelationVersion",
|
||||
schema: "gr",
|
||||
columns: table => new
|
||||
{
|
||||
TenantId = table.Column<long>(type: "bigint", nullable: false),
|
||||
SubjectId = table.Column<long>(type: "bigint", nullable: false),
|
||||
At = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
||||
SuspectId = table.Column<long>(type: "bigint", nullable: false),
|
||||
Action = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TenantSubjectRelationVersion", x => new { x.SubjectId, x.TenantId, x.At });
|
||||
table.ForeignKey(
|
||||
name: "FK_TenantSubjectRelationVersion_Subject_SuspectId",
|
||||
column: x => x.SuspectId,
|
||||
principalSchema: "gr",
|
||||
principalTable: "Subject",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_TenantSubjectRelationVersion_TenantSubjectRelation_SubjectI~",
|
||||
columns: x => new { x.SubjectId, x.TenantId },
|
||||
principalSchema: "gr",
|
||||
principalTable: "TenantSubjectRelation",
|
||||
principalColumns: new[] { "SubjectId", "TenantId" },
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AppSubjectRelationInternalAuthorityRelation",
|
||||
schema: "gr",
|
||||
columns: table => new
|
||||
{
|
||||
AppId = table.Column<long>(type: "bigint", nullable: false),
|
||||
SubjectId = table.Column<long>(type: "bigint", nullable: false),
|
||||
InternalAuthorityId = table.Column<long>(type: "bigint", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AppSubjectRelationInternalAuthorityRelation", x => new { x.SubjectId, x.AppId, x.InternalAuthorityId });
|
||||
table.ForeignKey(
|
||||
name: "FK_AppSubjectRelationInternalAuthorityRelation_AppSubjectRelat~",
|
||||
columns: x => new { x.SubjectId, x.AppId },
|
||||
principalSchema: "gr",
|
||||
principalTable: "AppSubjectRelation",
|
||||
principalColumns: new[] { "SubjectId", "AppId" },
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_AppSubjectRelationInternalAuthorityRelation_Authority_Inter~",
|
||||
column: x => x.InternalAuthorityId,
|
||||
principalSchema: "gr",
|
||||
principalTable: "Authority",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AppSubjectRelationVersion",
|
||||
schema: "gr",
|
||||
columns: table => new
|
||||
{
|
||||
AppId = table.Column<long>(type: "bigint", nullable: false),
|
||||
SubjectId = table.Column<long>(type: "bigint", nullable: false),
|
||||
At = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
||||
SuspectId = table.Column<long>(type: "bigint", nullable: false),
|
||||
Action = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AppSubjectRelationVersion", x => new { x.SubjectId, x.AppId, x.At });
|
||||
table.ForeignKey(
|
||||
name: "FK_AppSubjectRelationVersion_AppSubjectRelation_SubjectId_AppId",
|
||||
columns: x => new { x.SubjectId, x.AppId },
|
||||
principalSchema: "gr",
|
||||
principalTable: "AppSubjectRelation",
|
||||
principalColumns: new[] { "SubjectId", "AppId" },
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_AppSubjectRelationVersion_Subject_SuspectId",
|
||||
column: x => x.SuspectId,
|
||||
principalSchema: "gr",
|
||||
principalTable: "Subject",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TenantSubjectRelationInternalAuthorityRelationVersion",
|
||||
schema: "gr",
|
||||
columns: table => new
|
||||
{
|
||||
TenantId = table.Column<long>(type: "bigint", nullable: false),
|
||||
SubjectId = table.Column<long>(type: "bigint", nullable: false),
|
||||
InternalAuthorityId = table.Column<long>(type: "bigint", nullable: false),
|
||||
At = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
||||
SuspectId = table.Column<long>(type: "bigint", nullable: false),
|
||||
Action = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TenantSubjectRelationInternalAuthorityRelationVersion", x => new { x.SubjectId, x.TenantId, x.InternalAuthorityId, x.At });
|
||||
table.ForeignKey(
|
||||
name: "FK_TenantSubjectRelationInternalAuthorityRelationVersion_Subje~",
|
||||
column: x => x.SuspectId,
|
||||
principalSchema: "gr",
|
||||
principalTable: "Subject",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_TenantSubjectRelationInternalAuthorityRelationVersion_Tenan~",
|
||||
columns: x => new { x.SubjectId, x.TenantId, x.InternalAuthorityId },
|
||||
principalSchema: "gr",
|
||||
principalTable: "TenantSubjectRelationInternalAuthorityRelation",
|
||||
principalColumns: new[] { "SubjectId", "TenantId", "InternalAuthorityId" },
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AppSubjectRelationInternalAuthorityRelationVersion",
|
||||
schema: "gr",
|
||||
columns: table => new
|
||||
{
|
||||
AppId = table.Column<long>(type: "bigint", nullable: false),
|
||||
SubjectId = table.Column<long>(type: "bigint", nullable: false),
|
||||
InternalAuthorityId = table.Column<long>(type: "bigint", nullable: false),
|
||||
At = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
||||
SuspectId = table.Column<long>(type: "bigint", nullable: false),
|
||||
Action = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AppSubjectRelationInternalAuthorityRelationVersion", x => new { x.SubjectId, x.AppId, x.InternalAuthorityId, x.At });
|
||||
table.ForeignKey(
|
||||
name: "FK_AppSubjectRelationInternalAuthorityRelationVersion_AppSubje~",
|
||||
columns: x => new { x.SubjectId, x.AppId, x.InternalAuthorityId },
|
||||
principalSchema: "gr",
|
||||
principalTable: "AppSubjectRelationInternalAuthorityRelation",
|
||||
principalColumns: new[] { "SubjectId", "AppId", "InternalAuthorityId" },
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_AppSubjectRelationInternalAuthorityRelationVersion_Subject_~",
|
||||
column: x => x.SuspectId,
|
||||
principalSchema: "gr",
|
||||
principalTable: "Subject",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
schema: "gr",
|
||||
table: "Authority",
|
||||
columns: new[] { "Id", "Description", "Name", "Type" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ 1L, "Allows users to read tenants", "Tenant_Read", "Tenant" },
|
||||
{ 2L, "Allows users to read apps", "App_Read", "App" }
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
schema: "gr",
|
||||
table: "Subject",
|
||||
columns: new[] { "Id", "Name", "Visibility" },
|
||||
values: new object[] { 1L, "chris", "Active" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AppRelation_TenantId",
|
||||
schema: "gr",
|
||||
table: "AppRelation",
|
||||
column: "TenantId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AppRelationVersion_SuspectId",
|
||||
schema: "gr",
|
||||
table: "AppRelationVersion",
|
||||
column: "SuspectId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AppSubjectRelation_AppId",
|
||||
schema: "gr",
|
||||
table: "AppSubjectRelation",
|
||||
column: "AppId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AppSubjectRelationInternalAuthorityRelation_InternalAuthori~",
|
||||
schema: "gr",
|
||||
table: "AppSubjectRelationInternalAuthorityRelation",
|
||||
column: "InternalAuthorityId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AppSubjectRelationInternalAuthorityRelationVersion_SuspectId",
|
||||
schema: "gr",
|
||||
table: "AppSubjectRelationInternalAuthorityRelationVersion",
|
||||
column: "SuspectId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AppSubjectRelationVersion_SuspectId",
|
||||
schema: "gr",
|
||||
table: "AppSubjectRelationVersion",
|
||||
column: "SuspectId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Authority_Name",
|
||||
schema: "gr",
|
||||
table: "Authority",
|
||||
column: "Name",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_SignIn_SubjectId",
|
||||
schema: "gr",
|
||||
table: "SignIn",
|
||||
column: "SubjectId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Subject_Name",
|
||||
schema: "gr",
|
||||
table: "Subject",
|
||||
column: "Name",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Tenant_OwnerId",
|
||||
schema: "gr",
|
||||
table: "Tenant",
|
||||
column: "OwnerId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TenantSubjectRelation_TenantId",
|
||||
schema: "gr",
|
||||
table: "TenantSubjectRelation",
|
||||
column: "TenantId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TenantSubjectRelationInternalAuthorityRelation_InternalAuth~",
|
||||
schema: "gr",
|
||||
table: "TenantSubjectRelationInternalAuthorityRelation",
|
||||
column: "InternalAuthorityId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TenantSubjectRelationInternalAuthorityRelationVersion_Suspe~",
|
||||
schema: "gr",
|
||||
table: "TenantSubjectRelationInternalAuthorityRelationVersion",
|
||||
column: "SuspectId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TenantSubjectRelationVersion_SuspectId",
|
||||
schema: "gr",
|
||||
table: "TenantSubjectRelationVersion",
|
||||
column: "SuspectId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TenantVersion_SuspectId",
|
||||
schema: "gr",
|
||||
table: "TenantVersion",
|
||||
column: "SuspectId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "AppRelationVersion",
|
||||
schema: "gr");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "AppSubjectRelationInternalAuthorityRelationVersion",
|
||||
schema: "gr");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "AppSubjectRelationVersion",
|
||||
schema: "gr");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "SignIn",
|
||||
schema: "gr");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "TenantSubjectRelationInternalAuthorityRelationVersion",
|
||||
schema: "gr");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "TenantSubjectRelationVersion",
|
||||
schema: "gr");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "TenantVersion",
|
||||
schema: "gr");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "AppSubjectRelationInternalAuthorityRelation",
|
||||
schema: "gr");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "TenantSubjectRelationInternalAuthorityRelation",
|
||||
schema: "gr");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "AppSubjectRelation",
|
||||
schema: "gr");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Authority",
|
||||
schema: "gr");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "TenantSubjectRelation",
|
||||
schema: "gr");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "AppRelation",
|
||||
schema: "gr");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Tenant",
|
||||
schema: "gr");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Subject",
|
||||
schema: "gr");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,716 +0,0 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using Suspectus.Gandalf.Palantir.Data.Database;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace W542.GandalfReborn.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(ApplicationContext))]
|
||||
[Migration("20240914003536_addTokens")]
|
||||
partial class addTokens
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.8")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("TenantId");
|
||||
|
||||
b.ToTable("AppRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("AppRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId");
|
||||
|
||||
b.HasIndex("AppId");
|
||||
|
||||
b.ToTable("AppSubjectRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("AppSubjectRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId", "InternalAuthorityId");
|
||||
|
||||
b.HasIndex("InternalAuthorityId");
|
||||
|
||||
b.ToTable("AppSubjectRelationInternalAuthorityRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId", "InternalAuthorityId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("AppSubjectRelationInternalAuthorityRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AuthCodeEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Challenge")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTimeOffset>("Expiration")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("IsRevoked")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("AuthCode", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AuthorityEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Type")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Name")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Authority", "gr");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1L,
|
||||
Description = "Allows users to read tenants",
|
||||
Name = "Tenant_Read",
|
||||
Type = "Tenant"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2L,
|
||||
Description = "Allows users to read apps",
|
||||
Name = "App_Read",
|
||||
Type = "App"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId", "InternalAuthorityId");
|
||||
|
||||
b.HasIndex("InternalAuthorityId");
|
||||
|
||||
b.ToTable("TenantSubjectRelationInternalAuthorityRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId", "InternalAuthorityId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("TenantSubjectRelationInternalAuthorityRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TokenMetadataEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<DateTimeOffset>("Expiration")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("IsRevoked")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("TokenType")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("UsedBy")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("TokenMetadata", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Subject.SignIn.SignInEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsLegacy")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Method")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("PasswordHash")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SubjectId");
|
||||
|
||||
b.ToTable("SignIn", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Name")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Subject", "gr");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1L,
|
||||
Name = "chris",
|
||||
Visibility = "Active"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("OwnerId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OwnerId");
|
||||
|
||||
b.ToTable("Tenant", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId");
|
||||
|
||||
b.HasIndex("TenantId");
|
||||
|
||||
b.ToTable("TenantSubjectRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("TenantSubjectRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("OwnerId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("TenantVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", "Tenant")
|
||||
.WithMany("Apps")
|
||||
.HasForeignKey("TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Tenant");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.App.AppRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.App.AppRelationEntity", "App")
|
||||
.WithMany()
|
||||
.HasForeignKey("AppId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Subject")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("App");
|
||||
|
||||
b.Navigation("Subject");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "AppId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Security.AuthorityEntity", "InternalAuthority")
|
||||
.WithMany()
|
||||
.HasForeignKey("InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationEntity", "AppSubjectRelation")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "AppId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("AppSubjectRelation");
|
||||
|
||||
b.Navigation("InternalAuthority");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "AppId", "InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Security.AuthorityEntity", "InternalAuthority")
|
||||
.WithMany()
|
||||
.HasForeignKey("InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationEntity", "TenantSubjectRelation")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("InternalAuthority");
|
||||
|
||||
b.Navigation("TenantSubjectRelation");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "TenantId", "InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Subject.SignIn.SignInEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Subject")
|
||||
.WithMany("SignInMethods")
|
||||
.HasForeignKey("SubjectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Subject");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Owner")
|
||||
.WithMany()
|
||||
.HasForeignKey("OwnerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Owner");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Subject")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", "Tenant")
|
||||
.WithMany()
|
||||
.HasForeignKey("TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Subject");
|
||||
|
||||
b.Navigation("Tenant");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", b =>
|
||||
{
|
||||
b.Navigation("SignInMethods");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", b =>
|
||||
{
|
||||
b.Navigation("Apps");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,62 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace W542.GandalfReborn.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class addTokens : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AuthCode",
|
||||
schema: "gr",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Expiration = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
||||
IsRevoked = table.Column<bool>(type: "boolean", nullable: false),
|
||||
Code = table.Column<string>(type: "text", nullable: false),
|
||||
Challenge = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AuthCode", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TokenMetadata",
|
||||
schema: "gr",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Expiration = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
||||
IsRevoked = table.Column<bool>(type: "boolean", nullable: false),
|
||||
TokenType = table.Column<string>(type: "text", nullable: false),
|
||||
UsedBy = table.Column<long>(type: "bigint", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TokenMetadata", x => x.Id);
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "AuthCode",
|
||||
schema: "gr");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "TokenMetadata",
|
||||
schema: "gr");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,716 +0,0 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using Suspectus.Gandalf.Palantir.Data.Database;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace W542.GandalfReborn.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(ApplicationContext))]
|
||||
[Migration("20240914005530_affwaf")]
|
||||
partial class affwaf
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.8")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityAlwaysColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("TenantId");
|
||||
|
||||
b.ToTable("AppRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("AppRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId");
|
||||
|
||||
b.HasIndex("AppId");
|
||||
|
||||
b.ToTable("AppSubjectRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("AppSubjectRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId", "InternalAuthorityId");
|
||||
|
||||
b.HasIndex("InternalAuthorityId");
|
||||
|
||||
b.ToTable("AppSubjectRelationInternalAuthorityRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId", "InternalAuthorityId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("AppSubjectRelationInternalAuthorityRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AuthCodeEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityAlwaysColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Challenge")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTimeOffset>("Expiration")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("IsRevoked")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("AuthCode", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AuthorityEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityAlwaysColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Type")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Name")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Authority", "gr");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1L,
|
||||
Description = "Allows users to read tenants",
|
||||
Name = "Tenant_Read",
|
||||
Type = "Tenant"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2L,
|
||||
Description = "Allows users to read apps",
|
||||
Name = "App_Read",
|
||||
Type = "App"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId", "InternalAuthorityId");
|
||||
|
||||
b.HasIndex("InternalAuthorityId");
|
||||
|
||||
b.ToTable("TenantSubjectRelationInternalAuthorityRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId", "InternalAuthorityId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("TenantSubjectRelationInternalAuthorityRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TokenMetadataEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityAlwaysColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<DateTimeOffset>("Expiration")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("IsRevoked")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("TokenType")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("UsedBy")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("TokenMetadata", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Subject.SignIn.SignInEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityAlwaysColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsLegacy")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Method")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("PasswordHash")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SubjectId");
|
||||
|
||||
b.ToTable("SignIn", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityAlwaysColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Name")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Subject", "gr");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1L,
|
||||
Name = "chris",
|
||||
Visibility = "Active"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityAlwaysColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("OwnerId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OwnerId");
|
||||
|
||||
b.ToTable("Tenant", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId");
|
||||
|
||||
b.HasIndex("TenantId");
|
||||
|
||||
b.ToTable("TenantSubjectRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("TenantSubjectRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("OwnerId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("TenantVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", "Tenant")
|
||||
.WithMany("Apps")
|
||||
.HasForeignKey("TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Tenant");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.App.AppRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.App.AppRelationEntity", "App")
|
||||
.WithMany()
|
||||
.HasForeignKey("AppId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Subject")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("App");
|
||||
|
||||
b.Navigation("Subject");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "AppId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Security.AuthorityEntity", "InternalAuthority")
|
||||
.WithMany()
|
||||
.HasForeignKey("InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationEntity", "AppSubjectRelation")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "AppId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("AppSubjectRelation");
|
||||
|
||||
b.Navigation("InternalAuthority");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "AppId", "InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Security.AuthorityEntity", "InternalAuthority")
|
||||
.WithMany()
|
||||
.HasForeignKey("InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationEntity", "TenantSubjectRelation")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("InternalAuthority");
|
||||
|
||||
b.Navigation("TenantSubjectRelation");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "TenantId", "InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Subject.SignIn.SignInEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Subject")
|
||||
.WithMany("SignInMethods")
|
||||
.HasForeignKey("SubjectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Subject");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Owner")
|
||||
.WithMany()
|
||||
.HasForeignKey("OwnerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Owner");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Subject")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", "Tenant")
|
||||
.WithMany()
|
||||
.HasForeignKey("TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Subject");
|
||||
|
||||
b.Navigation("Tenant");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", b =>
|
||||
{
|
||||
b.Navigation("SignInMethods");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", b =>
|
||||
{
|
||||
b.Navigation("Apps");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,173 +0,0 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace W542.GandalfReborn.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class affwaf : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<long>(
|
||||
name: "Id",
|
||||
schema: "gr",
|
||||
table: "TokenMetadata",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
oldClrType: typeof(long),
|
||||
oldType: "bigint")
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityAlwaysColumn)
|
||||
.OldAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
migrationBuilder.AlterColumn<long>(
|
||||
name: "Id",
|
||||
schema: "gr",
|
||||
table: "Tenant",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
oldClrType: typeof(long),
|
||||
oldType: "bigint")
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityAlwaysColumn)
|
||||
.OldAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
migrationBuilder.AlterColumn<long>(
|
||||
name: "Id",
|
||||
schema: "gr",
|
||||
table: "Subject",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
oldClrType: typeof(long),
|
||||
oldType: "bigint")
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityAlwaysColumn)
|
||||
.OldAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
migrationBuilder.AlterColumn<long>(
|
||||
name: "Id",
|
||||
schema: "gr",
|
||||
table: "SignIn",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
oldClrType: typeof(long),
|
||||
oldType: "bigint")
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityAlwaysColumn)
|
||||
.OldAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
migrationBuilder.AlterColumn<long>(
|
||||
name: "Id",
|
||||
schema: "gr",
|
||||
table: "Authority",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
oldClrType: typeof(long),
|
||||
oldType: "bigint")
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityAlwaysColumn)
|
||||
.OldAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
migrationBuilder.AlterColumn<long>(
|
||||
name: "Id",
|
||||
schema: "gr",
|
||||
table: "AuthCode",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
oldClrType: typeof(long),
|
||||
oldType: "bigint")
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityAlwaysColumn)
|
||||
.OldAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
migrationBuilder.AlterColumn<long>(
|
||||
name: "Id",
|
||||
schema: "gr",
|
||||
table: "AppRelation",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
oldClrType: typeof(long),
|
||||
oldType: "bigint")
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityAlwaysColumn)
|
||||
.OldAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<long>(
|
||||
name: "Id",
|
||||
schema: "gr",
|
||||
table: "TokenMetadata",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
oldClrType: typeof(long),
|
||||
oldType: "bigint")
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
|
||||
.OldAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityAlwaysColumn);
|
||||
|
||||
migrationBuilder.AlterColumn<long>(
|
||||
name: "Id",
|
||||
schema: "gr",
|
||||
table: "Tenant",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
oldClrType: typeof(long),
|
||||
oldType: "bigint")
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
|
||||
.OldAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityAlwaysColumn);
|
||||
|
||||
migrationBuilder.AlterColumn<long>(
|
||||
name: "Id",
|
||||
schema: "gr",
|
||||
table: "Subject",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
oldClrType: typeof(long),
|
||||
oldType: "bigint")
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
|
||||
.OldAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityAlwaysColumn);
|
||||
|
||||
migrationBuilder.AlterColumn<long>(
|
||||
name: "Id",
|
||||
schema: "gr",
|
||||
table: "SignIn",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
oldClrType: typeof(long),
|
||||
oldType: "bigint")
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
|
||||
.OldAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityAlwaysColumn);
|
||||
|
||||
migrationBuilder.AlterColumn<long>(
|
||||
name: "Id",
|
||||
schema: "gr",
|
||||
table: "Authority",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
oldClrType: typeof(long),
|
||||
oldType: "bigint")
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
|
||||
.OldAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityAlwaysColumn);
|
||||
|
||||
migrationBuilder.AlterColumn<long>(
|
||||
name: "Id",
|
||||
schema: "gr",
|
||||
table: "AuthCode",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
oldClrType: typeof(long),
|
||||
oldType: "bigint")
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
|
||||
.OldAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityAlwaysColumn);
|
||||
|
||||
migrationBuilder.AlterColumn<long>(
|
||||
name: "Id",
|
||||
schema: "gr",
|
||||
table: "AppRelation",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
oldClrType: typeof(long),
|
||||
oldType: "bigint")
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
|
||||
.OldAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityAlwaysColumn);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,716 +0,0 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using Suspectus.Gandalf.Palantir.Data.Database;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace W542.GandalfReborn.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(ApplicationContext))]
|
||||
[Migration("20240914012943_fawfghh")]
|
||||
partial class fawfghh
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.8")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("TenantId");
|
||||
|
||||
b.ToTable("AppRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("AppRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId");
|
||||
|
||||
b.HasIndex("AppId");
|
||||
|
||||
b.ToTable("AppSubjectRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("AppSubjectRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId", "InternalAuthorityId");
|
||||
|
||||
b.HasIndex("InternalAuthorityId");
|
||||
|
||||
b.ToTable("AppSubjectRelationInternalAuthorityRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId", "InternalAuthorityId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("AppSubjectRelationInternalAuthorityRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AuthCodeEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Challenge")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTimeOffset>("Expiration")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("IsRevoked")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("AuthCode", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AuthorityEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Type")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Name")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Authority", "gr");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1L,
|
||||
Description = "Allows users to read tenants",
|
||||
Name = "Tenant_Read",
|
||||
Type = "Tenant"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2L,
|
||||
Description = "Allows users to read apps",
|
||||
Name = "App_Read",
|
||||
Type = "App"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId", "InternalAuthorityId");
|
||||
|
||||
b.HasIndex("InternalAuthorityId");
|
||||
|
||||
b.ToTable("TenantSubjectRelationInternalAuthorityRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId", "InternalAuthorityId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("TenantSubjectRelationInternalAuthorityRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TokenMetadataEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<DateTimeOffset>("Expiration")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("IsRevoked")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("TokenType")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("UsedBy")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("TokenMetadata", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Subject.SignIn.SignInEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsLegacy")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Method")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("PasswordHash")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SubjectId");
|
||||
|
||||
b.ToTable("SignIn", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Name")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Subject", "gr");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1L,
|
||||
Name = "chris",
|
||||
Visibility = "Active"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("OwnerId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OwnerId");
|
||||
|
||||
b.ToTable("Tenant", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId");
|
||||
|
||||
b.HasIndex("TenantId");
|
||||
|
||||
b.ToTable("TenantSubjectRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("TenantSubjectRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("OwnerId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("TenantVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", "Tenant")
|
||||
.WithMany("Apps")
|
||||
.HasForeignKey("TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Tenant");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.App.AppRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.App.AppRelationEntity", "App")
|
||||
.WithMany()
|
||||
.HasForeignKey("AppId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Subject")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("App");
|
||||
|
||||
b.Navigation("Subject");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "AppId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Security.AuthorityEntity", "InternalAuthority")
|
||||
.WithMany()
|
||||
.HasForeignKey("InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationEntity", "AppSubjectRelation")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "AppId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("AppSubjectRelation");
|
||||
|
||||
b.Navigation("InternalAuthority");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "AppId", "InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Security.AuthorityEntity", "InternalAuthority")
|
||||
.WithMany()
|
||||
.HasForeignKey("InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationEntity", "TenantSubjectRelation")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("InternalAuthority");
|
||||
|
||||
b.Navigation("TenantSubjectRelation");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "TenantId", "InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Subject.SignIn.SignInEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Subject")
|
||||
.WithMany("SignInMethods")
|
||||
.HasForeignKey("SubjectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Subject");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Owner")
|
||||
.WithMany()
|
||||
.HasForeignKey("OwnerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Owner");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Subject")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", "Tenant")
|
||||
.WithMany()
|
||||
.HasForeignKey("TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Subject");
|
||||
|
||||
b.Navigation("Tenant");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", b =>
|
||||
{
|
||||
b.Navigation("SignInMethods");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", b =>
|
||||
{
|
||||
b.Navigation("Apps");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,173 +0,0 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace W542.GandalfReborn.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class fawfghh : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<long>(
|
||||
name: "Id",
|
||||
schema: "gr",
|
||||
table: "TokenMetadata",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
oldClrType: typeof(long),
|
||||
oldType: "bigint")
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
|
||||
.OldAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityAlwaysColumn);
|
||||
|
||||
migrationBuilder.AlterColumn<long>(
|
||||
name: "Id",
|
||||
schema: "gr",
|
||||
table: "Tenant",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
oldClrType: typeof(long),
|
||||
oldType: "bigint")
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
|
||||
.OldAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityAlwaysColumn);
|
||||
|
||||
migrationBuilder.AlterColumn<long>(
|
||||
name: "Id",
|
||||
schema: "gr",
|
||||
table: "Subject",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
oldClrType: typeof(long),
|
||||
oldType: "bigint")
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
|
||||
.OldAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityAlwaysColumn);
|
||||
|
||||
migrationBuilder.AlterColumn<long>(
|
||||
name: "Id",
|
||||
schema: "gr",
|
||||
table: "SignIn",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
oldClrType: typeof(long),
|
||||
oldType: "bigint")
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
|
||||
.OldAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityAlwaysColumn);
|
||||
|
||||
migrationBuilder.AlterColumn<long>(
|
||||
name: "Id",
|
||||
schema: "gr",
|
||||
table: "Authority",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
oldClrType: typeof(long),
|
||||
oldType: "bigint")
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
|
||||
.OldAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityAlwaysColumn);
|
||||
|
||||
migrationBuilder.AlterColumn<long>(
|
||||
name: "Id",
|
||||
schema: "gr",
|
||||
table: "AuthCode",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
oldClrType: typeof(long),
|
||||
oldType: "bigint")
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
|
||||
.OldAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityAlwaysColumn);
|
||||
|
||||
migrationBuilder.AlterColumn<long>(
|
||||
name: "Id",
|
||||
schema: "gr",
|
||||
table: "AppRelation",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
oldClrType: typeof(long),
|
||||
oldType: "bigint")
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
|
||||
.OldAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityAlwaysColumn);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<long>(
|
||||
name: "Id",
|
||||
schema: "gr",
|
||||
table: "TokenMetadata",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
oldClrType: typeof(long),
|
||||
oldType: "bigint")
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityAlwaysColumn)
|
||||
.OldAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
migrationBuilder.AlterColumn<long>(
|
||||
name: "Id",
|
||||
schema: "gr",
|
||||
table: "Tenant",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
oldClrType: typeof(long),
|
||||
oldType: "bigint")
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityAlwaysColumn)
|
||||
.OldAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
migrationBuilder.AlterColumn<long>(
|
||||
name: "Id",
|
||||
schema: "gr",
|
||||
table: "Subject",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
oldClrType: typeof(long),
|
||||
oldType: "bigint")
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityAlwaysColumn)
|
||||
.OldAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
migrationBuilder.AlterColumn<long>(
|
||||
name: "Id",
|
||||
schema: "gr",
|
||||
table: "SignIn",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
oldClrType: typeof(long),
|
||||
oldType: "bigint")
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityAlwaysColumn)
|
||||
.OldAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
migrationBuilder.AlterColumn<long>(
|
||||
name: "Id",
|
||||
schema: "gr",
|
||||
table: "Authority",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
oldClrType: typeof(long),
|
||||
oldType: "bigint")
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityAlwaysColumn)
|
||||
.OldAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
migrationBuilder.AlterColumn<long>(
|
||||
name: "Id",
|
||||
schema: "gr",
|
||||
table: "AuthCode",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
oldClrType: typeof(long),
|
||||
oldType: "bigint")
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityAlwaysColumn)
|
||||
.OldAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
migrationBuilder.AlterColumn<long>(
|
||||
name: "Id",
|
||||
schema: "gr",
|
||||
table: "AppRelation",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
oldClrType: typeof(long),
|
||||
oldType: "bigint")
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityAlwaysColumn)
|
||||
.OldAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,716 +0,0 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using Suspectus.Gandalf.Palantir.Data.Database;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace W542.GandalfReborn.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(ApplicationContext))]
|
||||
[Migration("20240914014850_gjjjjjj")]
|
||||
partial class gjjjjjj
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.8")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppRelationEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("TenantId");
|
||||
|
||||
b.ToTable("AppRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("AppRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId");
|
||||
|
||||
b.HasIndex("AppId");
|
||||
|
||||
b.ToTable("AppSubjectRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("AppSubjectRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId", "InternalAuthorityId");
|
||||
|
||||
b.HasIndex("InternalAuthorityId");
|
||||
|
||||
b.ToTable("AppSubjectRelationInternalAuthorityRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId", "InternalAuthorityId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("AppSubjectRelationInternalAuthorityRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AuthCodeEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<string>("Challenge")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTimeOffset>("Expiration")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("IsRevoked")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("AuthCode", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AuthorityEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Type")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Name")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Authority", "gr");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1L,
|
||||
Description = "Allows users to read tenants",
|
||||
Name = "Tenant_Read",
|
||||
Type = "Tenant"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2L,
|
||||
Description = "Allows users to read apps",
|
||||
Name = "App_Read",
|
||||
Type = "App"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId", "InternalAuthorityId");
|
||||
|
||||
b.HasIndex("InternalAuthorityId");
|
||||
|
||||
b.ToTable("TenantSubjectRelationInternalAuthorityRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId", "InternalAuthorityId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("TenantSubjectRelationInternalAuthorityRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TokenMetadataEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<DateTimeOffset>("Expiration")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("IsRevoked")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("TokenType")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("UsedBy")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("TokenMetadata", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Subject.SignIn.SignInEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsLegacy")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Method")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("PasswordHash")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SubjectId");
|
||||
|
||||
b.ToTable("SignIn", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Name")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Subject", "gr");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1L,
|
||||
Name = "chris",
|
||||
Visibility = "Active"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("OwnerId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OwnerId");
|
||||
|
||||
b.ToTable("Tenant", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId");
|
||||
|
||||
b.HasIndex("TenantId");
|
||||
|
||||
b.ToTable("TenantSubjectRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("TenantSubjectRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantVersionEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("OwnerId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("TenantVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", "Tenant")
|
||||
.WithMany("Apps")
|
||||
.HasForeignKey("TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Tenant");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.App.AppRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.App.AppRelationEntity", "App")
|
||||
.WithMany()
|
||||
.HasForeignKey("AppId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Subject")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("App");
|
||||
|
||||
b.Navigation("Subject");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "AppId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Security.AuthorityEntity", "InternalAuthority")
|
||||
.WithMany()
|
||||
.HasForeignKey("InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationEntity", "AppSubjectRelation")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "AppId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("AppSubjectRelation");
|
||||
|
||||
b.Navigation("InternalAuthority");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "AppId", "InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Security.AuthorityEntity", "InternalAuthority")
|
||||
.WithMany()
|
||||
.HasForeignKey("InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationEntity", "TenantSubjectRelation")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("InternalAuthority");
|
||||
|
||||
b.Navigation("TenantSubjectRelation");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "TenantId", "InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Subject.SignIn.SignInEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Subject")
|
||||
.WithMany("SignInMethods")
|
||||
.HasForeignKey("SubjectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Subject");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Owner")
|
||||
.WithMany()
|
||||
.HasForeignKey("OwnerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Owner");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Subject")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", "Tenant")
|
||||
.WithMany()
|
||||
.HasForeignKey("TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Subject");
|
||||
|
||||
b.Navigation("Tenant");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", b =>
|
||||
{
|
||||
b.Navigation("SignInMethods");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", b =>
|
||||
{
|
||||
b.Navigation("Apps");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,22 +0,0 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace W542.GandalfReborn.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class gjjjjjj : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,719 +0,0 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using Suspectus.Gandalf.Palantir.Data.Database;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace W542.GandalfReborn.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(ApplicationContext))]
|
||||
[Migration("20240914224344_jsoikgsoieg")]
|
||||
partial class jsoikgsoieg
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.8")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppRelationEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("TenantId");
|
||||
|
||||
b.ToTable("AppRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("AppRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId");
|
||||
|
||||
b.HasIndex("AppId");
|
||||
|
||||
b.ToTable("AppSubjectRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("AppSubjectRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId", "InternalAuthorityId");
|
||||
|
||||
b.HasIndex("InternalAuthorityId");
|
||||
|
||||
b.ToTable("AppSubjectRelationInternalAuthorityRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId", "InternalAuthorityId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("AppSubjectRelationInternalAuthorityRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AuthCodeEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<string>("Challenge")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTimeOffset>("Expiration")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("IsRevoked")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("AuthCode", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AuthorityEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Type")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Name")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Authority", "gr");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1L,
|
||||
Description = "Allows users to read tenants",
|
||||
Name = "Tenant_Read",
|
||||
Type = "Tenant"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2L,
|
||||
Description = "Allows users to read apps",
|
||||
Name = "App_Read",
|
||||
Type = "App"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId", "InternalAuthorityId");
|
||||
|
||||
b.HasIndex("InternalAuthorityId");
|
||||
|
||||
b.ToTable("TenantSubjectRelationInternalAuthorityRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId", "InternalAuthorityId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("TenantSubjectRelationInternalAuthorityRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TokenMetadataEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<DateTimeOffset>("Expiration")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("IsRevoked")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("TokenType")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("UsedBy")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("TokenMetadata", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Subject.SignIn.SignInEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsLegacy")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Method")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("PasswordHash")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Email")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("SubjectId");
|
||||
|
||||
b.ToTable("SignIn", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Name")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Subject", "gr");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1L,
|
||||
Name = "chris",
|
||||
Visibility = "Active"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("OwnerId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OwnerId");
|
||||
|
||||
b.ToTable("Tenant", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId");
|
||||
|
||||
b.HasIndex("TenantId");
|
||||
|
||||
b.ToTable("TenantSubjectRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("TenantSubjectRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantVersionEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("OwnerId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("TenantVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", "Tenant")
|
||||
.WithMany("Apps")
|
||||
.HasForeignKey("TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Tenant");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.App.AppRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.App.AppRelationEntity", "App")
|
||||
.WithMany()
|
||||
.HasForeignKey("AppId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Subject")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("App");
|
||||
|
||||
b.Navigation("Subject");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "AppId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Security.AuthorityEntity", "InternalAuthority")
|
||||
.WithMany()
|
||||
.HasForeignKey("InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationEntity", "AppSubjectRelation")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "AppId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("AppSubjectRelation");
|
||||
|
||||
b.Navigation("InternalAuthority");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "AppId", "InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Security.AuthorityEntity", "InternalAuthority")
|
||||
.WithMany()
|
||||
.HasForeignKey("InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationEntity", "TenantSubjectRelation")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("InternalAuthority");
|
||||
|
||||
b.Navigation("TenantSubjectRelation");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "TenantId", "InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Subject.SignIn.SignInEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Subject")
|
||||
.WithMany("SignInMethods")
|
||||
.HasForeignKey("SubjectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Subject");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Owner")
|
||||
.WithMany()
|
||||
.HasForeignKey("OwnerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Owner");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Subject")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", "Tenant")
|
||||
.WithMany()
|
||||
.HasForeignKey("TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Subject");
|
||||
|
||||
b.Navigation("Tenant");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", b =>
|
||||
{
|
||||
b.Navigation("SignInMethods");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", b =>
|
||||
{
|
||||
b.Navigation("Apps");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,30 +0,0 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace W542.GandalfReborn.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class jsoikgsoieg : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_SignIn_Email",
|
||||
schema: "gr",
|
||||
table: "SignIn",
|
||||
column: "Email",
|
||||
unique: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_SignIn_Email",
|
||||
schema: "gr",
|
||||
table: "SignIn");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,730 +0,0 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using Suspectus.Gandalf.Palantir.Data.Database;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace W542.GandalfReborn.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(ApplicationContext))]
|
||||
[Migration("20240919005908_afwawfawf")]
|
||||
partial class afwawfawf
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.8")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppRelationEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("TenantId");
|
||||
|
||||
b.ToTable("AppRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("AppRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId");
|
||||
|
||||
b.HasIndex("AppId");
|
||||
|
||||
b.ToTable("AppSubjectRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("AppSubjectRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId", "InternalAuthorityId");
|
||||
|
||||
b.HasIndex("InternalAuthorityId");
|
||||
|
||||
b.ToTable("AppSubjectRelationInternalAuthorityRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId", "InternalAuthorityId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("AppSubjectRelationInternalAuthorityRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AuthCodeEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<string>("Challenge")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTimeOffset>("Expiration")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("IsRevoked")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("AuthCode", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AuthorityEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Type")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Name")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Authority", "gr");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1L,
|
||||
Description = "Allows users to read tenants",
|
||||
Name = "Tenant_Read",
|
||||
Type = "Tenant"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2L,
|
||||
Description = "Allows users to read apps",
|
||||
Name = "App_Read",
|
||||
Type = "App"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId", "InternalAuthorityId");
|
||||
|
||||
b.HasIndex("InternalAuthorityId");
|
||||
|
||||
b.ToTable("TenantSubjectRelationInternalAuthorityRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId", "InternalAuthorityId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("TenantSubjectRelationInternalAuthorityRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TokenMetadataEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<DateTimeOffset>("Expiration")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("IsRevoked")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("TokenType")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("UsedBy")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("TokenMetadata", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Subject.SignIn.SignInEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsLegacy")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Method")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("PasswordHash")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Email")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("SubjectId");
|
||||
|
||||
b.ToTable("SignIn", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Name")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Subject", "gr");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1L,
|
||||
Name = "chris",
|
||||
Visibility = "Active"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Temp.TempInvokerContextEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("SubjectId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("SubjectId");
|
||||
|
||||
b.ToTable("TempInvokerContext", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("OwnerId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OwnerId");
|
||||
|
||||
b.ToTable("Tenant", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId");
|
||||
|
||||
b.HasIndex("TenantId");
|
||||
|
||||
b.ToTable("TenantSubjectRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("TenantSubjectRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantVersionEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("OwnerId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("TenantVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", "Tenant")
|
||||
.WithMany("Apps")
|
||||
.HasForeignKey("TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Tenant");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.App.AppRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.App.AppRelationEntity", "App")
|
||||
.WithMany()
|
||||
.HasForeignKey("AppId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Subject")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("App");
|
||||
|
||||
b.Navigation("Subject");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "AppId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Security.AuthorityEntity", "InternalAuthority")
|
||||
.WithMany()
|
||||
.HasForeignKey("InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationEntity", "AppSubjectRelation")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "AppId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("AppSubjectRelation");
|
||||
|
||||
b.Navigation("InternalAuthority");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "AppId", "InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Security.AuthorityEntity", "InternalAuthority")
|
||||
.WithMany()
|
||||
.HasForeignKey("InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationEntity", "TenantSubjectRelation")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("InternalAuthority");
|
||||
|
||||
b.Navigation("TenantSubjectRelation");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "TenantId", "InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Subject.SignIn.SignInEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Subject")
|
||||
.WithMany("SignInMethods")
|
||||
.HasForeignKey("SubjectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Subject");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Owner")
|
||||
.WithMany()
|
||||
.HasForeignKey("OwnerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Owner");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Subject")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", "Tenant")
|
||||
.WithMany()
|
||||
.HasForeignKey("TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Subject");
|
||||
|
||||
b.Navigation("Tenant");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", b =>
|
||||
{
|
||||
b.Navigation("SignInMethods");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", b =>
|
||||
{
|
||||
b.Navigation("Apps");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,35 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace W542.GandalfReborn.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class afwawfawf : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TempInvokerContext",
|
||||
schema: "gr",
|
||||
columns: table => new
|
||||
{
|
||||
SubjectId = table.Column<Guid>(type: "uuid", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TempInvokerContext", x => x.SubjectId);
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "TempInvokerContext",
|
||||
schema: "gr");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,729 +0,0 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using Suspectus.Gandalf.Palantir.Data.Database;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace W542.GandalfReborn.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(ApplicationContext))]
|
||||
[Migration("20240919010339_ffffff")]
|
||||
partial class ffffff
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.8")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppRelationEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("TenantId");
|
||||
|
||||
b.ToTable("AppRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("AppRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId");
|
||||
|
||||
b.HasIndex("AppId");
|
||||
|
||||
b.ToTable("AppSubjectRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("AppSubjectRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId", "InternalAuthorityId");
|
||||
|
||||
b.HasIndex("InternalAuthorityId");
|
||||
|
||||
b.ToTable("AppSubjectRelationInternalAuthorityRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId", "InternalAuthorityId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("AppSubjectRelationInternalAuthorityRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AuthCodeEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<string>("Challenge")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTimeOffset>("Expiration")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("IsRevoked")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("AuthCode", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AuthorityEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Type")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Name")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Authority", "gr");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1L,
|
||||
Description = "Allows users to read tenants",
|
||||
Name = "Tenant_Read",
|
||||
Type = "Tenant"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2L,
|
||||
Description = "Allows users to read apps",
|
||||
Name = "App_Read",
|
||||
Type = "App"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId", "InternalAuthorityId");
|
||||
|
||||
b.HasIndex("InternalAuthorityId");
|
||||
|
||||
b.ToTable("TenantSubjectRelationInternalAuthorityRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId", "InternalAuthorityId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("TenantSubjectRelationInternalAuthorityRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TokenMetadataEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<DateTimeOffset>("Expiration")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("IsRevoked")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("TokenType")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("UsedBy")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("TokenMetadata", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Subject.SignIn.SignInEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsLegacy")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Method")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("PasswordHash")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Email")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("SubjectId");
|
||||
|
||||
b.ToTable("SignIn", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Name")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Subject", "gr");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1L,
|
||||
Name = "chris",
|
||||
Visibility = "Active"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Temp.TempInvokerContextEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("SubjectId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.ToTable("TempInvokerContext", "gr");
|
||||
|
||||
b.ToView("#TempInvokerContext", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("OwnerId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OwnerId");
|
||||
|
||||
b.ToTable("Tenant", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId");
|
||||
|
||||
b.HasIndex("TenantId");
|
||||
|
||||
b.ToTable("TenantSubjectRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("TenantSubjectRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantVersionEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("OwnerId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("TenantVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", "Tenant")
|
||||
.WithMany("Apps")
|
||||
.HasForeignKey("TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Tenant");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.App.AppRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.App.AppRelationEntity", "App")
|
||||
.WithMany()
|
||||
.HasForeignKey("AppId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Subject")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("App");
|
||||
|
||||
b.Navigation("Subject");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "AppId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Security.AuthorityEntity", "InternalAuthority")
|
||||
.WithMany()
|
||||
.HasForeignKey("InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationEntity", "AppSubjectRelation")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "AppId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("AppSubjectRelation");
|
||||
|
||||
b.Navigation("InternalAuthority");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "AppId", "InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Security.AuthorityEntity", "InternalAuthority")
|
||||
.WithMany()
|
||||
.HasForeignKey("InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationEntity", "TenantSubjectRelation")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("InternalAuthority");
|
||||
|
||||
b.Navigation("TenantSubjectRelation");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "TenantId", "InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Subject.SignIn.SignInEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Subject")
|
||||
.WithMany("SignInMethods")
|
||||
.HasForeignKey("SubjectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Subject");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Owner")
|
||||
.WithMany()
|
||||
.HasForeignKey("OwnerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Owner");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Subject")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", "Tenant")
|
||||
.WithMany()
|
||||
.HasForeignKey("TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Subject");
|
||||
|
||||
b.Navigation("Tenant");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", b =>
|
||||
{
|
||||
b.Navigation("SignInMethods");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", b =>
|
||||
{
|
||||
b.Navigation("Apps");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,29 +0,0 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace W542.GandalfReborn.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class ffffff : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_TempInvokerContext",
|
||||
schema: "gr",
|
||||
table: "TempInvokerContext");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_TempInvokerContext",
|
||||
schema: "gr",
|
||||
table: "TempInvokerContext",
|
||||
column: "SubjectId");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,730 +0,0 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using Suspectus.Gandalf.Palantir.Data.Database;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace W542.GandalfReborn.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(ApplicationContext))]
|
||||
[Migration("20240919010748_jmäpromh")]
|
||||
partial class jmñpromh
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.8")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppRelationEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("TenantId");
|
||||
|
||||
b.ToTable("AppRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("AppRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId");
|
||||
|
||||
b.HasIndex("AppId");
|
||||
|
||||
b.ToTable("AppSubjectRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("AppSubjectRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId", "InternalAuthorityId");
|
||||
|
||||
b.HasIndex("InternalAuthorityId");
|
||||
|
||||
b.ToTable("AppSubjectRelationInternalAuthorityRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId", "InternalAuthorityId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("AppSubjectRelationInternalAuthorityRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AuthCodeEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<string>("Challenge")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTimeOffset>("Expiration")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("IsRevoked")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("AuthCode", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AuthorityEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Type")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Name")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Authority", "gr");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1L,
|
||||
Description = "Allows users to read tenants",
|
||||
Name = "Tenant_Read",
|
||||
Type = "Tenant"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2L,
|
||||
Description = "Allows users to read apps",
|
||||
Name = "App_Read",
|
||||
Type = "App"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId", "InternalAuthorityId");
|
||||
|
||||
b.HasIndex("InternalAuthorityId");
|
||||
|
||||
b.ToTable("TenantSubjectRelationInternalAuthorityRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId", "InternalAuthorityId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("TenantSubjectRelationInternalAuthorityRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TokenMetadataEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<DateTimeOffset>("Expiration")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("IsRevoked")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("TokenType")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("UsedBy")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("TokenMetadata", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Subject.SignIn.SignInEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsLegacy")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Method")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("PasswordHash")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Email")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("SubjectId");
|
||||
|
||||
b.ToTable("SignIn", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Name")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Subject", "gr");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1L,
|
||||
Name = "chris",
|
||||
Visibility = "Active"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Temp.TempInvokerContextEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("SubjectId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("SubjectId");
|
||||
|
||||
b.ToTable("TempInvokerContext", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("OwnerId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OwnerId");
|
||||
|
||||
b.ToTable("Tenant", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId");
|
||||
|
||||
b.HasIndex("TenantId");
|
||||
|
||||
b.ToTable("TenantSubjectRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("TenantSubjectRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantVersionEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("OwnerId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("TenantVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", "Tenant")
|
||||
.WithMany("Apps")
|
||||
.HasForeignKey("TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Tenant");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.App.AppRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.App.AppRelationEntity", "App")
|
||||
.WithMany()
|
||||
.HasForeignKey("AppId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Subject")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("App");
|
||||
|
||||
b.Navigation("Subject");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "AppId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Security.AuthorityEntity", "InternalAuthority")
|
||||
.WithMany()
|
||||
.HasForeignKey("InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationEntity", "AppSubjectRelation")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "AppId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("AppSubjectRelation");
|
||||
|
||||
b.Navigation("InternalAuthority");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "AppId", "InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Security.AuthorityEntity", "InternalAuthority")
|
||||
.WithMany()
|
||||
.HasForeignKey("InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationEntity", "TenantSubjectRelation")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("InternalAuthority");
|
||||
|
||||
b.Navigation("TenantSubjectRelation");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "TenantId", "InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Subject.SignIn.SignInEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Subject")
|
||||
.WithMany("SignInMethods")
|
||||
.HasForeignKey("SubjectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Subject");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Owner")
|
||||
.WithMany()
|
||||
.HasForeignKey("OwnerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Owner");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Subject")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", "Tenant")
|
||||
.WithMany()
|
||||
.HasForeignKey("TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Subject");
|
||||
|
||||
b.Navigation("Tenant");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", b =>
|
||||
{
|
||||
b.Navigation("SignInMethods");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", b =>
|
||||
{
|
||||
b.Navigation("Apps");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,29 +0,0 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace W542.GandalfReborn.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class jmñpromh : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_TempInvokerContext",
|
||||
schema: "gr",
|
||||
table: "TempInvokerContext",
|
||||
column: "SubjectId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_TempInvokerContext",
|
||||
schema: "gr",
|
||||
table: "TempInvokerContext");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,719 +0,0 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using Suspectus.Gandalf.Palantir.Data.Database;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace W542.GandalfReborn.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(ApplicationContext))]
|
||||
[Migration("20240919012025_fghdhhzttr")]
|
||||
partial class fghdhhzttr
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.8")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppRelationEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("TenantId");
|
||||
|
||||
b.ToTable("AppRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("AppRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId");
|
||||
|
||||
b.HasIndex("AppId");
|
||||
|
||||
b.ToTable("AppSubjectRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("AppSubjectRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId", "InternalAuthorityId");
|
||||
|
||||
b.HasIndex("InternalAuthorityId");
|
||||
|
||||
b.ToTable("AppSubjectRelationInternalAuthorityRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId", "InternalAuthorityId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("AppSubjectRelationInternalAuthorityRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AuthCodeEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<string>("Challenge")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTimeOffset>("Expiration")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("IsRevoked")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("AuthCode", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AuthorityEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Type")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Name")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Authority", "gr");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1L,
|
||||
Description = "Allows users to read tenants",
|
||||
Name = "Tenant_Read",
|
||||
Type = "Tenant"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2L,
|
||||
Description = "Allows users to read apps",
|
||||
Name = "App_Read",
|
||||
Type = "App"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId", "InternalAuthorityId");
|
||||
|
||||
b.HasIndex("InternalAuthorityId");
|
||||
|
||||
b.ToTable("TenantSubjectRelationInternalAuthorityRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId", "InternalAuthorityId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("TenantSubjectRelationInternalAuthorityRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TokenMetadataEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<DateTimeOffset>("Expiration")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("IsRevoked")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("TokenType")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("UsedBy")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("TokenMetadata", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Subject.SignIn.SignInEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsLegacy")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Method")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("PasswordHash")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Email")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("SubjectId");
|
||||
|
||||
b.ToTable("SignIn", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Name")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Subject", "gr");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1L,
|
||||
Name = "chris",
|
||||
Visibility = "Active"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("OwnerId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OwnerId");
|
||||
|
||||
b.ToTable("Tenant", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId");
|
||||
|
||||
b.HasIndex("TenantId");
|
||||
|
||||
b.ToTable("TenantSubjectRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("TenantSubjectRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantVersionEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("OwnerId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("TenantVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", "Tenant")
|
||||
.WithMany("Apps")
|
||||
.HasForeignKey("TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Tenant");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.App.AppRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.App.AppRelationEntity", "App")
|
||||
.WithMany()
|
||||
.HasForeignKey("AppId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Subject")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("App");
|
||||
|
||||
b.Navigation("Subject");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "AppId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Security.AuthorityEntity", "InternalAuthority")
|
||||
.WithMany()
|
||||
.HasForeignKey("InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationEntity", "AppSubjectRelation")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "AppId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("AppSubjectRelation");
|
||||
|
||||
b.Navigation("InternalAuthority");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "AppId", "InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Security.AuthorityEntity", "InternalAuthority")
|
||||
.WithMany()
|
||||
.HasForeignKey("InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationEntity", "TenantSubjectRelation")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("InternalAuthority");
|
||||
|
||||
b.Navigation("TenantSubjectRelation");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "TenantId", "InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Subject.SignIn.SignInEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Subject")
|
||||
.WithMany("SignInMethods")
|
||||
.HasForeignKey("SubjectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Subject");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Owner")
|
||||
.WithMany()
|
||||
.HasForeignKey("OwnerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Owner");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Subject")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", "Tenant")
|
||||
.WithMany()
|
||||
.HasForeignKey("TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Subject");
|
||||
|
||||
b.Navigation("Tenant");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", b =>
|
||||
{
|
||||
b.Navigation("SignInMethods");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", b =>
|
||||
{
|
||||
b.Navigation("Apps");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,35 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace W542.GandalfReborn.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class fghdhhzttr : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "TempInvokerContext",
|
||||
schema: "gr");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TempInvokerContext",
|
||||
schema: "gr",
|
||||
columns: table => new
|
||||
{
|
||||
SubjectId = table.Column<Guid>(type: "uuid", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TempInvokerContext", x => x.SubjectId);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,726 +0,0 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using Suspectus.Gandalf.Palantir.Data.Database;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace W542.GandalfReborn.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(ApplicationContext))]
|
||||
[Migration("20240921214234_kl├╢hmpdmpmgr")]
|
||||
partial class klhmpdmpmgr
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.8")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppRelationEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("TenantId");
|
||||
|
||||
b.ToTable("AppRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("AppRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId");
|
||||
|
||||
b.HasIndex("AppId");
|
||||
|
||||
b.ToTable("AppSubjectRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("AppSubjectRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId", "InternalAuthorityId");
|
||||
|
||||
b.HasIndex("InternalAuthorityId");
|
||||
|
||||
b.ToTable("AppSubjectRelationInternalAuthorityRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId", "InternalAuthorityId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("AppSubjectRelationInternalAuthorityRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AuthCodeEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<string>("Algorithm")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Challenge")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTimeOffset>("Expiration")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("IsRevoked")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("AuthCode", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AuthorityEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Type")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Name")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Authority", "gr");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1L,
|
||||
Description = "Allows users to read tenants",
|
||||
Name = "Tenant_Read",
|
||||
Type = "Tenant"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2L,
|
||||
Description = "Allows users to read apps",
|
||||
Name = "App_Read",
|
||||
Type = "App"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId", "InternalAuthorityId");
|
||||
|
||||
b.HasIndex("InternalAuthorityId");
|
||||
|
||||
b.ToTable("TenantSubjectRelationInternalAuthorityRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId", "InternalAuthorityId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("TenantSubjectRelationInternalAuthorityRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TokenMetadataEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<DateTimeOffset>("Expiration")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("IsRevoked")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("TokenType")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("UsedBy")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("TokenMetadata", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Subject.SignIn.SignInEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsLegacy")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Method")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("PasswordHash")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Email")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("SubjectId");
|
||||
|
||||
b.ToTable("SignIn", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Name")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Subject", "gr");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1L,
|
||||
Name = "chris",
|
||||
Visibility = "Active"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("OwnerId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OwnerId");
|
||||
|
||||
b.ToTable("Tenant", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId");
|
||||
|
||||
b.HasIndex("TenantId");
|
||||
|
||||
b.ToTable("TenantSubjectRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("TenantSubjectRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantVersionEntity", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("OwnerId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("TenantVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", "Tenant")
|
||||
.WithMany("Apps")
|
||||
.HasForeignKey("TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Tenant");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.App.AppRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.App.AppRelationEntity", "App")
|
||||
.WithMany()
|
||||
.HasForeignKey("AppId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Subject")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("App");
|
||||
|
||||
b.Navigation("Subject");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "AppId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Security.AuthorityEntity", "InternalAuthority")
|
||||
.WithMany()
|
||||
.HasForeignKey("InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.App.AppSubjectRelationEntity", "AppSubjectRelation")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "AppId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("AppSubjectRelation");
|
||||
|
||||
b.Navigation("InternalAuthority");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "AppId", "InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Security.AuthorityEntity", "InternalAuthority")
|
||||
.WithMany()
|
||||
.HasForeignKey("InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationEntity", "TenantSubjectRelation")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("InternalAuthority");
|
||||
|
||||
b.Navigation("TenantSubjectRelation");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "TenantId", "InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Subject.SignIn.SignInEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Subject")
|
||||
.WithMany("SignInMethods")
|
||||
.HasForeignKey("SubjectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Subject");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Owner")
|
||||
.WithMany()
|
||||
.HasForeignKey("OwnerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Owner");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Subject")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", "Tenant")
|
||||
.WithMany()
|
||||
.HasForeignKey("TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Subject");
|
||||
|
||||
b.Navigation("Tenant");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantSubjectRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Subject.SubjectEntity", b =>
|
||||
{
|
||||
b.Navigation("SignInMethods");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("W542.GandalfReborn.Data.Entities.Tenant.TenantEntity", b =>
|
||||
{
|
||||
b.Navigation("Apps");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,44 +0,0 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace W542.GandalfReborn.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class klhmpdmpmgr : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Algorithm",
|
||||
schema: "gr",
|
||||
table: "AuthCode",
|
||||
type: "text",
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
|
||||
migrationBuilder.AddColumn<long>(
|
||||
name: "SubjectId",
|
||||
schema: "gr",
|
||||
table: "AuthCode",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
defaultValue: 0L);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Algorithm",
|
||||
schema: "gr",
|
||||
table: "AuthCode");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "SubjectId",
|
||||
schema: "gr",
|
||||
table: "AuthCode");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,718 +0,0 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using Suspectus.Gandalf.Palantir.Data.Database;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace W542.GandalfReborn.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(ApplicationContext))]
|
||||
[Migration("20250525155339_cringe1")]
|
||||
partial class cringe1
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "9.0.2")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.App.AppRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("TenantId");
|
||||
|
||||
b.ToTable("AppRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.App.AppRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("AppRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.App.AppSubjectRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId");
|
||||
|
||||
b.HasIndex("AppId");
|
||||
|
||||
b.ToTable("AppSubjectRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.App.AppSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("AppSubjectRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId", "InternalAuthorityId");
|
||||
|
||||
b.HasIndex("InternalAuthorityId");
|
||||
|
||||
b.ToTable("AppSubjectRelationInternalAuthorityRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId", "InternalAuthorityId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("AppSubjectRelationInternalAuthorityRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Security.AuthCodeEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Algorithm")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Challenge")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTimeOffset>("Expiration")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("IsRevoked")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("AuthCode", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Security.AuthorityEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Type")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Name")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Authority", "gr");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1L,
|
||||
Description = "Allows users to read tenants",
|
||||
Name = "Tenant_Read",
|
||||
Type = "Tenant"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2L,
|
||||
Description = "Allows users to read apps",
|
||||
Name = "App_Read",
|
||||
Type = "App"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId", "InternalAuthorityId");
|
||||
|
||||
b.HasIndex("InternalAuthorityId");
|
||||
|
||||
b.ToTable("TenantSubjectRelationInternalAuthorityRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId", "InternalAuthorityId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("TenantSubjectRelationInternalAuthorityRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Security.TokenMetadataEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<DateTimeOffset>("Expiration")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("IsRevoked")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("TokenType")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("UsedBy")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("TokenMetadata", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SignIn.SignInEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsLegacy")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Method")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("PasswordHash")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Email")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("SubjectId");
|
||||
|
||||
b.ToTable("SignIn", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SubjectEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Name")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Subject", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("OwnerId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OwnerId");
|
||||
|
||||
b.ToTable("Tenant", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantSubjectRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId");
|
||||
|
||||
b.HasIndex("TenantId");
|
||||
|
||||
b.ToTable("TenantSubjectRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("TenantSubjectRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("OwnerId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("TenantVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.App.AppRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantEntity", "Tenant")
|
||||
.WithMany("Apps")
|
||||
.HasForeignKey("TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Tenant");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.App.AppRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.App.AppRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.App.AppSubjectRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.App.AppRelationEntity", "App")
|
||||
.WithMany()
|
||||
.HasForeignKey("AppId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SubjectEntity", "Subject")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("App");
|
||||
|
||||
b.Navigation("Subject");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.App.AppSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.App.AppSubjectRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "AppId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Security.AuthorityEntity", "InternalAuthority")
|
||||
.WithMany()
|
||||
.HasForeignKey("InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.App.AppSubjectRelationEntity", "AppSubjectRelation")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "AppId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("AppSubjectRelation");
|
||||
|
||||
b.Navigation("InternalAuthority");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "AppId", "InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Security.AuthorityEntity", "InternalAuthority")
|
||||
.WithMany()
|
||||
.HasForeignKey("InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantSubjectRelationEntity", "TenantSubjectRelation")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("InternalAuthority");
|
||||
|
||||
b.Navigation("TenantSubjectRelation");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "TenantId", "InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SignIn.SignInEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SubjectEntity", "Subject")
|
||||
.WithMany("SignInMethods")
|
||||
.HasForeignKey("SubjectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Subject");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SubjectEntity", "Owner")
|
||||
.WithMany()
|
||||
.HasForeignKey("OwnerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Owner");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantSubjectRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SubjectEntity", "Subject")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantEntity", "Tenant")
|
||||
.WithMany()
|
||||
.HasForeignKey("TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Subject");
|
||||
|
||||
b.Navigation("Tenant");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantSubjectRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SubjectEntity", b =>
|
||||
{
|
||||
b.Navigation("SignInMethods");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantEntity", b =>
|
||||
{
|
||||
b.Navigation("Apps");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,30 +0,0 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace W542.GandalfReborn.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class cringe1 : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DeleteData(
|
||||
schema: "gr",
|
||||
table: "Subject",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1L);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.InsertData(
|
||||
schema: "gr",
|
||||
table: "Subject",
|
||||
columns: new[] { "Id", "Name", "Visibility" },
|
||||
values: new object[] { 1L, "chris", "Active" });
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,718 +0,0 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using Suspectus.Gandalf.Palantir.Data.Database;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace W542.GandalfReborn.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(ApplicationContext))]
|
||||
[Migration("20250525162427_cringe2")]
|
||||
partial class cringe2
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "9.0.2")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.App.AppEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("TenantId");
|
||||
|
||||
b.ToTable("App", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.App.AppSubjectRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId");
|
||||
|
||||
b.HasIndex("AppId");
|
||||
|
||||
b.ToTable("AppSubjectRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.App.AppSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("AppSubjectRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.App.AppVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("AppVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId", "InternalAuthorityId");
|
||||
|
||||
b.HasIndex("InternalAuthorityId");
|
||||
|
||||
b.ToTable("AppSubjectRelationInternalAuthorityRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId", "InternalAuthorityId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("AppSubjectRelationInternalAuthorityRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Security.AuthCodeEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Algorithm")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Challenge")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTimeOffset>("Expiration")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("IsRevoked")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("AuthCode", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Security.AuthorityEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Type")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Name")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Authority", "gr");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1L,
|
||||
Description = "Allows users to read tenants",
|
||||
Name = "Tenant_Read",
|
||||
Type = "Tenant"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2L,
|
||||
Description = "Allows users to read apps",
|
||||
Name = "App_Read",
|
||||
Type = "App"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId", "InternalAuthorityId");
|
||||
|
||||
b.HasIndex("InternalAuthorityId");
|
||||
|
||||
b.ToTable("TenantSubjectRelationInternalAuthorityRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId", "InternalAuthorityId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("TenantSubjectRelationInternalAuthorityRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Security.TokenMetadataEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<DateTimeOffset>("Expiration")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("IsRevoked")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("TokenType")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("UsedBy")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("TokenMetadata", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SignIn.SignInEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsLegacy")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Method")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("PasswordHash")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Email")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("SubjectId");
|
||||
|
||||
b.ToTable("SignIn", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SubjectEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Name")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Subject", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("OwnerId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OwnerId");
|
||||
|
||||
b.ToTable("Tenant", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantSubjectRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId");
|
||||
|
||||
b.HasIndex("TenantId");
|
||||
|
||||
b.ToTable("TenantSubjectRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("TenantSubjectRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("OwnerId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("TenantVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.App.AppEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantEntity", "Tenant")
|
||||
.WithMany("Apps")
|
||||
.HasForeignKey("TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Tenant");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.App.AppSubjectRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.App.AppEntity", "App")
|
||||
.WithMany()
|
||||
.HasForeignKey("AppId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SubjectEntity", "Subject")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("App");
|
||||
|
||||
b.Navigation("Subject");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.App.AppSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.App.AppSubjectRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "AppId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.App.AppVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.App.AppEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Security.AuthorityEntity", "InternalAuthority")
|
||||
.WithMany()
|
||||
.HasForeignKey("InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.App.AppSubjectRelationEntity", "AppSubjectRelation")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "AppId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("AppSubjectRelation");
|
||||
|
||||
b.Navigation("InternalAuthority");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "AppId", "InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Security.AuthorityEntity", "InternalAuthority")
|
||||
.WithMany()
|
||||
.HasForeignKey("InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantSubjectRelationEntity", "TenantSubjectRelation")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("InternalAuthority");
|
||||
|
||||
b.Navigation("TenantSubjectRelation");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "TenantId", "InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SignIn.SignInEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SubjectEntity", "Subject")
|
||||
.WithMany("SignInMethods")
|
||||
.HasForeignKey("SubjectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Subject");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SubjectEntity", "Owner")
|
||||
.WithMany()
|
||||
.HasForeignKey("OwnerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Owner");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantSubjectRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SubjectEntity", "Subject")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantEntity", "Tenant")
|
||||
.WithMany()
|
||||
.HasForeignKey("TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Subject");
|
||||
|
||||
b.Navigation("Tenant");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantSubjectRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SubjectEntity", b =>
|
||||
{
|
||||
b.Navigation("SignInMethods");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantEntity", b =>
|
||||
{
|
||||
b.Navigation("Apps");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,230 +0,0 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace W542.GandalfReborn.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class cringe2 : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_AppRelation_Tenant_TenantId",
|
||||
schema: "gr",
|
||||
table: "AppRelation");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_AppRelationVersion_AppRelation_Id",
|
||||
schema: "gr",
|
||||
table: "AppRelationVersion");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_AppRelationVersion_Subject_SuspectId",
|
||||
schema: "gr",
|
||||
table: "AppRelationVersion");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_AppSubjectRelation_AppRelation_AppId",
|
||||
schema: "gr",
|
||||
table: "AppSubjectRelation");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_AppRelationVersion",
|
||||
schema: "gr",
|
||||
table: "AppRelationVersion");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_AppRelation",
|
||||
schema: "gr",
|
||||
table: "AppRelation");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "AppRelationVersion",
|
||||
schema: "gr",
|
||||
newName: "AppVersion",
|
||||
newSchema: "gr");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "AppRelation",
|
||||
schema: "gr",
|
||||
newName: "App",
|
||||
newSchema: "gr");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_AppRelationVersion_SuspectId",
|
||||
schema: "gr",
|
||||
table: "AppVersion",
|
||||
newName: "IX_AppVersion_SuspectId");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_AppRelation_TenantId",
|
||||
schema: "gr",
|
||||
table: "App",
|
||||
newName: "IX_App_TenantId");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_AppVersion",
|
||||
schema: "gr",
|
||||
table: "AppVersion",
|
||||
columns: new[] { "Id", "At" });
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_App",
|
||||
schema: "gr",
|
||||
table: "App",
|
||||
column: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_App_Tenant_TenantId",
|
||||
schema: "gr",
|
||||
table: "App",
|
||||
column: "TenantId",
|
||||
principalSchema: "gr",
|
||||
principalTable: "Tenant",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_AppSubjectRelation_App_AppId",
|
||||
schema: "gr",
|
||||
table: "AppSubjectRelation",
|
||||
column: "AppId",
|
||||
principalSchema: "gr",
|
||||
principalTable: "App",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_AppVersion_App_Id",
|
||||
schema: "gr",
|
||||
table: "AppVersion",
|
||||
column: "Id",
|
||||
principalSchema: "gr",
|
||||
principalTable: "App",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_AppVersion_Subject_SuspectId",
|
||||
schema: "gr",
|
||||
table: "AppVersion",
|
||||
column: "SuspectId",
|
||||
principalSchema: "gr",
|
||||
principalTable: "Subject",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_App_Tenant_TenantId",
|
||||
schema: "gr",
|
||||
table: "App");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_AppSubjectRelation_App_AppId",
|
||||
schema: "gr",
|
||||
table: "AppSubjectRelation");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_AppVersion_App_Id",
|
||||
schema: "gr",
|
||||
table: "AppVersion");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_AppVersion_Subject_SuspectId",
|
||||
schema: "gr",
|
||||
table: "AppVersion");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_AppVersion",
|
||||
schema: "gr",
|
||||
table: "AppVersion");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_App",
|
||||
schema: "gr",
|
||||
table: "App");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "AppVersion",
|
||||
schema: "gr",
|
||||
newName: "AppRelationVersion",
|
||||
newSchema: "gr");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "App",
|
||||
schema: "gr",
|
||||
newName: "AppRelation",
|
||||
newSchema: "gr");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_AppVersion_SuspectId",
|
||||
schema: "gr",
|
||||
table: "AppRelationVersion",
|
||||
newName: "IX_AppRelationVersion_SuspectId");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_App_TenantId",
|
||||
schema: "gr",
|
||||
table: "AppRelation",
|
||||
newName: "IX_AppRelation_TenantId");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_AppRelationVersion",
|
||||
schema: "gr",
|
||||
table: "AppRelationVersion",
|
||||
columns: new[] { "Id", "At" });
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_AppRelation",
|
||||
schema: "gr",
|
||||
table: "AppRelation",
|
||||
column: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_AppRelation_Tenant_TenantId",
|
||||
schema: "gr",
|
||||
table: "AppRelation",
|
||||
column: "TenantId",
|
||||
principalSchema: "gr",
|
||||
principalTable: "Tenant",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_AppRelationVersion_AppRelation_Id",
|
||||
schema: "gr",
|
||||
table: "AppRelationVersion",
|
||||
column: "Id",
|
||||
principalSchema: "gr",
|
||||
principalTable: "AppRelation",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_AppRelationVersion_Subject_SuspectId",
|
||||
schema: "gr",
|
||||
table: "AppRelationVersion",
|
||||
column: "SuspectId",
|
||||
principalSchema: "gr",
|
||||
principalTable: "Subject",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_AppSubjectRelation_AppRelation_AppId",
|
||||
schema: "gr",
|
||||
table: "AppSubjectRelation",
|
||||
column: "AppId",
|
||||
principalSchema: "gr",
|
||||
principalTable: "AppRelation",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,724 +0,0 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using Suspectus.Gandalf.Palantir.Data.Database;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace W542.GandalfReborn.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(ApplicationContext))]
|
||||
[Migration("20250525174938_addIsMaster")]
|
||||
partial class addIsMaster
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "9.0.2")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.App.AppEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("TenantId");
|
||||
|
||||
b.ToTable("App", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.App.AppSubjectRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId");
|
||||
|
||||
b.HasIndex("AppId");
|
||||
|
||||
b.ToTable("AppSubjectRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.App.AppSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("AppSubjectRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.App.AppVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("AppVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId", "InternalAuthorityId");
|
||||
|
||||
b.HasIndex("InternalAuthorityId");
|
||||
|
||||
b.ToTable("AppSubjectRelationInternalAuthorityRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId", "InternalAuthorityId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("AppSubjectRelationInternalAuthorityRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Security.AuthCodeEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Algorithm")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Challenge")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTimeOffset>("Expiration")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("IsRevoked")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("AuthCode", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Security.AuthorityEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Type")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Name")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Authority", "gr");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1L,
|
||||
Description = "Allows users to read tenants",
|
||||
Name = "Tenant_Read",
|
||||
Type = "Tenant"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2L,
|
||||
Description = "Allows users to read apps",
|
||||
Name = "App_Read",
|
||||
Type = "App"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId", "InternalAuthorityId");
|
||||
|
||||
b.HasIndex("InternalAuthorityId");
|
||||
|
||||
b.ToTable("TenantSubjectRelationInternalAuthorityRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId", "InternalAuthorityId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("TenantSubjectRelationInternalAuthorityRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Security.TokenMetadataEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<DateTimeOffset>("Expiration")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("IsRevoked")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("TokenType")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("UsedBy")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("TokenMetadata", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SignIn.SignInEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsLegacy")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Method")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("PasswordHash")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Email")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("SubjectId");
|
||||
|
||||
b.ToTable("SignIn", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SubjectEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Name")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Subject", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<bool>("IsMaster")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("OwnerId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OwnerId");
|
||||
|
||||
b.ToTable("Tenant", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantSubjectRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId");
|
||||
|
||||
b.HasIndex("TenantId");
|
||||
|
||||
b.ToTable("TenantSubjectRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("TenantSubjectRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsMaster")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("OwnerId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("TenantVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.App.AppEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantEntity", "Tenant")
|
||||
.WithMany("Apps")
|
||||
.HasForeignKey("TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Tenant");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.App.AppSubjectRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.App.AppEntity", "App")
|
||||
.WithMany()
|
||||
.HasForeignKey("AppId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SubjectEntity", "Subject")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("App");
|
||||
|
||||
b.Navigation("Subject");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.App.AppSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.App.AppSubjectRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "AppId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.App.AppVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.App.AppEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Security.AuthorityEntity", "InternalAuthority")
|
||||
.WithMany()
|
||||
.HasForeignKey("InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.App.AppSubjectRelationEntity", "AppSubjectRelation")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "AppId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("AppSubjectRelation");
|
||||
|
||||
b.Navigation("InternalAuthority");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "AppId", "InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Security.AuthorityEntity", "InternalAuthority")
|
||||
.WithMany()
|
||||
.HasForeignKey("InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantSubjectRelationEntity", "TenantSubjectRelation")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("InternalAuthority");
|
||||
|
||||
b.Navigation("TenantSubjectRelation");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "TenantId", "InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SignIn.SignInEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SubjectEntity", "Subject")
|
||||
.WithMany("SignInMethods")
|
||||
.HasForeignKey("SubjectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Subject");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SubjectEntity", "Owner")
|
||||
.WithMany()
|
||||
.HasForeignKey("OwnerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Owner");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantSubjectRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SubjectEntity", "Subject")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantEntity", "Tenant")
|
||||
.WithMany()
|
||||
.HasForeignKey("TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Subject");
|
||||
|
||||
b.Navigation("Tenant");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantSubjectRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SubjectEntity", b =>
|
||||
{
|
||||
b.Navigation("SignInMethods");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantEntity", b =>
|
||||
{
|
||||
b.Navigation("Apps");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,44 +0,0 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace W542.GandalfReborn.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class addIsMaster : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "IsMaster",
|
||||
schema: "gr",
|
||||
table: "TenantVersion",
|
||||
type: "boolean",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "IsMaster",
|
||||
schema: "gr",
|
||||
table: "Tenant",
|
||||
type: "boolean",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "IsMaster",
|
||||
schema: "gr",
|
||||
table: "TenantVersion");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "IsMaster",
|
||||
schema: "gr",
|
||||
table: "Tenant");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,731 +0,0 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using Suspectus.Gandalf.Palantir.Data.Database;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace W542.GandalfReborn.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(ApplicationContext))]
|
||||
[Migration("20250530220220_updateTokenMetadata")]
|
||||
partial class updateTokenMetadata
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "9.0.2")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.App.AppEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("TenantId");
|
||||
|
||||
b.ToTable("App", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.App.AppSubjectRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId");
|
||||
|
||||
b.HasIndex("AppId");
|
||||
|
||||
b.ToTable("AppSubjectRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.App.AppSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("AppSubjectRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.App.AppVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("AppVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId", "InternalAuthorityId");
|
||||
|
||||
b.HasIndex("InternalAuthorityId");
|
||||
|
||||
b.ToTable("AppSubjectRelationInternalAuthorityRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("AppId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "AppId", "InternalAuthorityId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("AppSubjectRelationInternalAuthorityRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Security.AuthCodeEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Algorithm")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Challenge")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTimeOffset>("Expiration")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("IsRevoked")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("AuthCode", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Security.AuthorityEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Type")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Name")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Authority", "gr");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1L,
|
||||
Description = "Allows users to read tenants",
|
||||
Name = "Tenant_Read",
|
||||
Type = "Tenant"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2L,
|
||||
Description = "Allows users to read apps",
|
||||
Name = "App_Read",
|
||||
Type = "App"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId", "InternalAuthorityId");
|
||||
|
||||
b.HasIndex("InternalAuthorityId");
|
||||
|
||||
b.ToTable("TenantSubjectRelationInternalAuthorityRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternalAuthorityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId", "InternalAuthorityId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("TenantSubjectRelationInternalAuthorityRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Security.TokenMetadataEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<DateTimeOffset>("Expiration")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("IsRevoked")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Scope")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("TokenType")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("UsedBy")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("UsedFor")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("TokenMetadata", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SignIn.SignInEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsLegacy")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Method")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("PasswordHash")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Email")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("SubjectId");
|
||||
|
||||
b.ToTable("SignIn", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SubjectEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Name")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Subject", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<bool>("IsMaster")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("OwnerId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OwnerId");
|
||||
|
||||
b.ToTable("Tenant", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantSubjectRelationEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId");
|
||||
|
||||
b.HasIndex("TenantId");
|
||||
|
||||
b.ToTable("TenantSubjectRelation", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("SubjectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("SubjectId", "TenantId", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("TenantSubjectRelationVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantVersionEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("At")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsMaster")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("OwnerId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("SuspectId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Visibility")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id", "At");
|
||||
|
||||
b.HasIndex("SuspectId");
|
||||
|
||||
b.ToTable("TenantVersion", "gr");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.App.AppEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantEntity", "Tenant")
|
||||
.WithMany("Apps")
|
||||
.HasForeignKey("TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Tenant");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.App.AppSubjectRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.App.AppEntity", "App")
|
||||
.WithMany()
|
||||
.HasForeignKey("AppId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SubjectEntity", "Subject")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("App");
|
||||
|
||||
b.Navigation("Subject");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.App.AppSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.App.AppSubjectRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "AppId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.App.AppVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.App.AppEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Security.AuthorityEntity", "InternalAuthority")
|
||||
.WithMany()
|
||||
.HasForeignKey("InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.App.AppSubjectRelationEntity", "AppSubjectRelation")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "AppId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("AppSubjectRelation");
|
||||
|
||||
b.Navigation("InternalAuthority");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Security.AppSubjectRelationInternalAuthorityRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "AppId", "InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Security.AuthorityEntity", "InternalAuthority")
|
||||
.WithMany()
|
||||
.HasForeignKey("InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantSubjectRelationEntity", "TenantSubjectRelation")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("InternalAuthority");
|
||||
|
||||
b.Navigation("TenantSubjectRelation");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Security.TenantSubjectRelationInternalAuthorityRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "TenantId", "InternalAuthorityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SignIn.SignInEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SubjectEntity", "Subject")
|
||||
.WithMany("SignInMethods")
|
||||
.HasForeignKey("SubjectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Subject");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SubjectEntity", "Owner")
|
||||
.WithMany()
|
||||
.HasForeignKey("OwnerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Owner");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantSubjectRelationEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SubjectEntity", "Subject")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantEntity", "Tenant")
|
||||
.WithMany()
|
||||
.HasForeignKey("TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Subject");
|
||||
|
||||
b.Navigation("Tenant");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantSubjectRelationVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantSubjectRelationEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubjectId", "TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantVersionEntity", b =>
|
||||
{
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantEntity", "Reference")
|
||||
.WithMany()
|
||||
.HasForeignKey("Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SubjectEntity", "Suspect")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuspectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reference");
|
||||
|
||||
b.Navigation("Suspect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Subject.SubjectEntity", b =>
|
||||
{
|
||||
b.Navigation("SignInMethods");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Suspectus.Gandalf.Palantir.Data.Entities.Tenant.TenantEntity", b =>
|
||||
{
|
||||
b.Navigation("Apps");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user