Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
ProjectsStatusManagement
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hasan.bahjat
ProjectsStatusManagement
Commits
1d5f4c82
Commit
1d5f4c82
authored
Aug 08, 2024
by
hasan khaddour
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update infrastucture
parent
17a7a1c9
Changes
39
Show whitespace changes
Inline
Side-by-side
Showing
39 changed files
with
1950 additions
and
6766 deletions
+1950
-6766
AppDbContext.cs
...Infrastructure.Persistence/AppDataContext/AppDbContext.cs
+1
-4
DependencyInjection.cs
...ment.Infrastructure.Persistence/DI/DependencyInjection.cs
+3
-0
EmployeeEntityConfiguration.cs
...ence/EntitiesConfiguration/EmployeeEntityConfiguration.cs
+7
-0
FinicialSpendingEntityConfiguration.cs
...itiesConfiguration/FinicialSpendingEntityConfiguration.cs
+29
-0
ItemEntityConfiguration.cs
...sistence/EntitiesConfiguration/ItemEntityConfiguration.cs
+0
-20
ProjectEntityConfiguration.cs
...tence/EntitiesConfiguration/ProjectEntityConfiguration.cs
+3
-2
StepEntityConfiguration.cs
...sistence/EntitiesConfiguration/StepEntityConfiguration.cs
+1
-1
TrackEntityConfiguration.cs
...istence/EntitiesConfiguration/TrackEntityConfiguration.cs
+2
-0
20240803172417_AddDomains.Designer.cs
...sistence/Migrations/20240803172417_AddDomains.Designer.cs
+0
-738
20240803172708_AddDomains2.Designer.cs
...istence/Migrations/20240803172708_AddDomains2.Designer.cs
+0
-738
20240803172708_AddDomains2.cs
...ture.Persistence/Migrations/20240803172708_AddDomains2.cs
+0
-87
20240803173142_AddDomains3.Designer.cs
...istence/Migrations/20240803173142_AddDomains3.Designer.cs
+0
-737
20240803173142_AddDomains3.cs
...ture.Persistence/Migrations/20240803173142_AddDomains3.cs
+0
-107
20240803180549_AddDomains4.Designer.cs
...istence/Migrations/20240803180549_AddDomains4.Designer.cs
+0
-763
20240803190751_AddDomains5.Designer.cs
...istence/Migrations/20240803190751_AddDomains5.Designer.cs
+0
-830
20240803190751_AddDomains5.cs
...ture.Persistence/Migrations/20240803190751_AddDomains5.cs
+0
-92
20240803191817_AddDomains6.Designer.cs
...istence/Migrations/20240803191817_AddDomains6.Designer.cs
+0
-819
20240803192350_AddDomains7.Designer.cs
...istence/Migrations/20240803192350_AddDomains7.Designer.cs
+0
-819
20240803192350_AddDomains7.cs
...ture.Persistence/Migrations/20240803192350_AddDomains7.cs
+0
-17
20240806062155_AddDomainUpdate.cs
....Persistence/Migrations/20240806062155_AddDomainUpdate.cs
+0
-252
20240806132941_AddDomainUpdate3.cs
...Persistence/Migrations/20240806132941_AddDomainUpdate3.cs
+0
-61
20240806133359_AddDomainUpdate4.cs
...Persistence/Migrations/20240806133359_AddDomainUpdate4.cs
+0
-17
20240807105909_Initial.Designer.cs
...Persistence/Migrations/20240807105909_Initial.Designer.cs
+2
-2
20240807105909_Initial.cs
...tructure.Persistence/Migrations/20240807105909_Initial.cs
+223
-101
20240807122646_UpdateDomains.Designer.cs
...tence/Migrations/20240807122646_UpdateDomains.Designer.cs
+6
-61
20240807122646_UpdateDomains.cs
...re.Persistence/Migrations/20240807122646_UpdateDomains.cs
+82
-0
20240807124316_UpdateDomains1.Designer.cs
...ence/Migrations/20240807124316_UpdateDomains1.Designer.cs
+6
-72
20240807124316_UpdateDomains1.cs
...e.Persistence/Migrations/20240807124316_UpdateDomains1.cs
+11
-11
20240808142549_AddDomainsUpdate2.Designer.cs
...e/Migrations/20240808142549_AddDomainsUpdate2.Designer.cs
+201
-154
20240808142549_AddDomainsUpdate2.cs
...ersistence/Migrations/20240808142549_AddDomainsUpdate2.cs
+66
-0
20240808173901_AddDomainsUpdate3.Designer.cs
...e/Migrations/20240808173901_AddDomainsUpdate3.Designer.cs
+929
-0
20240808173901_AddDomainsUpdate3.cs
...ersistence/Migrations/20240808173901_AddDomainsUpdate3.cs
+56
-65
AppDbContextModelSnapshot.cs
...cture.Persistence/Migrations/AppDbContextModelSnapshot.cs
+192
-179
ProjectsRepository.cs
...ence/Repositories/ProjectRepository/ProjectsRepository.cs
+13
-0
DependencyInjection.cs
PSManagement.Infrastructure/DI/DependencyInjection.cs
+1
-1
AuthenticationService.cs
...tructure/Services/Authentication/AuthenticationService.cs
+5
-4
RoleService.cs
...ment.Infrastructure/Services/Authorization/RoleService.cs
+93
-0
DateTimeProvider.cs
PSManagement.Infrastructure/Services/DateTimeProvider.cs
+1
-1
JwtTokenGenerator.cs
PSManagement.Infrastructure/Tokens/JwtTokenGenerator.cs
+17
-11
No files found.
PSManagement.Infrastructure.Persistence/AppDataContext/AppDbContext.cs
View file @
1d5f4c82
...
...
@@ -2,8 +2,7 @@
using
PSManagement.Domain.Customers.Aggregate
;
using
PSManagement.Domain.Employees.Entities
;
using
PSManagement.Domain.Identity.Entities
;
using
PSManagement.Domain.Projects.Aggregate
;
using
PSManagement.Domain.Steps.Entities
;
using
PSManagement.Domain.Projects.Entities
;
using
PSManagement.Domain.Tracking
;
using
PSManagement.Domain.Tracking.Entities
;
...
...
@@ -26,9 +25,7 @@ namespace PSManagement.Infrastructure.Persistence
public
DbSet
<
Project
>
Projects
{
get
;
set
;
}
public
DbSet
<
Step
>
Steps
{
get
;
set
;
}
public
DbSet
<
Item
>
Items
{
get
;
set
;
}
public
DbSet
<
Track
>
Tracks
{
get
;
set
;
}
public
DbSet
<
EmployeeWork
>
EmployeeWorks
{
get
;
set
;
}
public
DbSet
<
StepTrack
>
StepTracks
{
get
;
set
;
}
...
...
PSManagement.Infrastructure.Persistence/DI/DependencyInjection.cs
View file @
1d5f4c82
...
...
@@ -3,7 +3,9 @@ using Microsoft.Extensions.Configuration;
using
Microsoft.Extensions.DependencyInjection
;
using
PSManagement.Domain.Customers.Repositories
;
using
PSManagement.Domain.Identity.Repositories
;
using
PSManagement.Domain.Projects.Repositories
;
using
PSManagement.Infrastructure.Persistence.Repositories.CustomerRepository
;
using
PSManagement.Infrastructure.Persistence.Repositories.ProjectRepository
;
using
PSManagement.Infrastructure.Persistence.Repositories.UserRepository
;
namespace
PSManagement.Infrastructure.Persistence.DI
...
...
@@ -18,6 +20,7 @@ namespace PSManagement.Infrastructure.Persistence.DI
});
services
.
AddScoped
<
IUsersRepository
,
UsersRepository
>();
services
.
AddScoped
<
ICustomersRepository
,
CustomersReposiotry
>();
services
.
AddScoped
<
IProjectsRepository
,
ProjectsRepository
>();
return
services
;
...
...
PSManagement.Infrastructure.Persistence/EntitiesConfiguration/EmployeeEntityConfiguration.cs
View file @
1d5f4c82
...
...
@@ -20,6 +20,13 @@ namespace PSManagement.Infrastructure.Persistence.EntitiesConfiguration
p
.
Property
(
e
=>
e
.
CurrentWorkingHours
).
HasColumnName
(
"CurrentWorkingHours"
);
}
);
builder
.
OwnsOne
(
c
=>
c
.
WorkInfo
,
p
=>
{
p
.
Property
(
e
=>
e
.
WorkJob
).
HasColumnName
(
"WorkJob"
);
p
.
Property
(
e
=>
e
.
WorkType
).
HasColumnName
(
"WorkType"
);
}
);
builder
.
OwnsOne
(
c
=>
c
.
PersonalInfo
,
p
=>
{
p
.
Property
(
e
=>
e
.
LastName
).
HasColumnName
(
"LastName"
);
...
...
PSManagement.Infrastructure.Persistence/EntitiesConfiguration/FinicialSpendingEntityConfiguration.cs
0 → 100644
View file @
1d5f4c82
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Metadata.Builders
;
using
PSManagement.Domain.Projects.Entities
;
namespace
PSManagement.Infrastructure.Persistence.EntitiesConfiguration
{
public
class
FinicialSpendingEntityConfiguration
:
IEntityTypeConfiguration
<
FinincialSpending
>
{
public
void
Configure
(
EntityTypeBuilder
<
FinincialSpending
>
builder
)
{
builder
.
OwnsOne
(
e
=>
e
.
ExternalPurchase
,
p
=>
{
p
.
Property
(
e
=>
e
.
Ammount
).
HasColumnName
(
"ExternalPurchaseAmmount"
);
p
.
Property
(
e
=>
e
.
Currency
).
HasColumnName
(
"ExternalPurchaseCurrency"
).
HasDefaultValue
(
"USD"
);
});
builder
.
OwnsOne
(
e
=>
e
.
LocalPurchase
,
p
=>
{
p
.
Property
(
e
=>
e
.
Ammount
).
HasColumnName
(
"LocalPurchaseAmmount"
);
p
.
Property
(
e
=>
e
.
Currency
).
HasColumnName
(
"LocalPurchaseCurrency"
).
HasDefaultValue
(
"SP"
);
});
}
}
}
PSManagement.Infrastructure.Persistence/EntitiesConfiguration/ItemEntityConfiguration.cs
deleted
100644 → 0
View file @
17a7a1c9
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Metadata.Builders
;
using
PSManagement.Domain.Steps.Entities
;
namespace
PSManagement.Infrastructure.Persistence.EntitiesConfiguration
{
public
class
ItemEntityConfiguration
:
IEntityTypeConfiguration
<
Item
>
{
public
void
Configure
(
EntityTypeBuilder
<
Item
>
builder
)
{
builder
.
OwnsOne
(
c
=>
c
.
Price
,
p
=>
{
p
.
Property
(
e
=>
e
.
Ammount
).
HasColumnName
(
"Ammount"
);
p
.
Property
(
e
=>
e
.
Currency
).
HasColumnName
(
"Currency"
);
}
);
}
}
}
PSManagement.Infrastructure.Persistence/EntitiesConfiguration/ProjectEntityConfiguration.cs
View file @
1d5f4c82
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Metadata.Builders
;
using
PSManagement.Domain.Employees.Entities
;
using
PSManagement.Domain.Projects.Aggregate
;
using
PSManagement.Domain.Projects.Entities
;
namespace
PSManagement.Infrastructure.Persistence.EntitiesConfiguration
...
...
@@ -48,7 +47,7 @@ namespace PSManagement.Infrastructure.Persistence.EntitiesConfiguration
.
OnDelete
(
DeleteBehavior
.
Restrict
)
.
IsRequired
(
false
);
builder
.
HasOne
(
e
=>
e
.
Proposer
).
WithMany
().
HasForeignKey
(
e
=>
e
.
ProposerId
);
builder
.
OwnsOne
(
c
=>
c
.
ProposalInfo
,
p
=>
{
p
.
Property
(
e
=>
e
.
ProposingBookDate
).
HasColumnName
(
"ProposingBookDate"
);
...
...
@@ -61,7 +60,9 @@ namespace PSManagement.Infrastructure.Persistence.EntitiesConfiguration
p
.
Property
(
e
=>
e
.
Source
).
HasColumnName
(
"FinicialSource"
);
}
);
builder
.
HasOne
(
e
=>
e
.
ProjectStatus
).
WithMany
();
builder
.
HasMany
(
e
=>
e
.
FinincialSpending
);
builder
.
HasMany
(
e
=>
e
.
Tracks
).
WithOne
(
e
=>
e
.
Project
).
HasForeignKey
(
e
=>
e
.
ProjectId
);
}
...
...
PSManagement.Infrastructure.Persistence/EntitiesConfiguration/StepEntityConfiguration.cs
View file @
1d5f4c82
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Metadata.Builders
;
using
PSManagement.Domain.
Step
s.Entities
;
using
PSManagement.Domain.
Project
s.Entities
;
namespace
PSManagement.Infrastructure.Persistence.EntitiesConfiguration
{
...
...
PSManagement.Infrastructure.Persistence/EntitiesConfiguration/TrackEntityConfiguration.cs
View file @
1d5f4c82
...
...
@@ -21,6 +21,8 @@ namespace PSManagement.Infrastructure.Persistence.EntitiesConfiguration
.
WithMany
(
p
=>
p
.
Tracks
)
.
HasForeignKey
(
t
=>
t
.
ProjectId
)
.
OnDelete
(
DeleteBehavior
.
Restrict
);
builder
.
Ignore
(
e
=>
e
.
TrackedEmployees
);
//builder.HasMany(e => e.TrackedEmployees)
// .WithMany(e => e.trac)
// .UsingEntity<EmployeeParticipate>(
...
...
PSManagement.Infrastructure.Persistence/Migrations/20240803172417_AddDomains.Designer.cs
deleted
100644 → 0
View file @
17a7a1c9
// <auto-generated />
using
System
;
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Infrastructure
;
using
Microsoft.EntityFrameworkCore.Metadata
;
using
Microsoft.EntityFrameworkCore.Migrations
;
using
Microsoft.EntityFrameworkCore.Storage.ValueConversion
;
using
PSManagement.Infrastructure.Persistence
;
namespace
PSManagement.Infrastructure.Persistence.Migrations
{
[
DbContext
(
typeof
(
AppDbContext
))]
[
Migration
(
"20240803172417_AddDomains"
)]
partial
class
AddDomains
{
protected
override
void
BuildTargetModel
(
ModelBuilder
modelBuilder
)
{
#pragma warning disable 612, 618
modelBuilder
.
HasAnnotation
(
"Relational:Collation"
,
"Arabic_CI_AS"
)
.
HasAnnotation
(
"Relational:MaxIdentifierLength"
,
128
)
.
HasAnnotation
(
"ProductVersion"
,
"5.0.17"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
modelBuilder
.
Entity
(
"PSManagement.Domain.Customers.Aggregate.Customer"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"CustomerName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"Email"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Customers"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Department"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Departments"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Employee"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"HIASTId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"StepId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"UserId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ProjectId"
);
b
.
HasIndex
(
"StepId"
);
b
.
HasIndex
(
"UserId"
)
.
IsUnique
();
b
.
ToTable
(
"Employees"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Identity.Entities.Permission"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
?>(
"PermissionId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"RoleId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"PermissionId"
);
b
.
HasIndex
(
"RoleId"
);
b
.
ToTable
(
"Permission"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Identity.Entities.Role"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Role"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Identity.Entities.User"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Email"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"HashedPassword"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"UserName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Users"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Aggregate.Project"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
?>(
"ExecuterId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"ProposerId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"TeamLeaderId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ExecuterId"
);
b
.
HasIndex
(
"ProposerId"
);
b
.
HasIndex
(
"TeamLeaderId"
);
b
.
ToTable
(
"Projects"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Steps.Entities.Item"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"ItemDescription"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"ItemName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
?>(
"StepId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"StepId"
);
b
.
ToTable
(
"Items"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Steps.Entities.Step"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Description"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"Duration"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
DateTime
>(
"StartDate"
)
.
HasColumnType
(
"datetime2"
);
b
.
Property
<
string
>(
"StepName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
?>(
"TrackId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ProjectId"
);
b
.
HasIndex
(
"TrackId"
);
b
.
ToTable
(
"Steps"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.EmployeeWork"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"ContributingRatio"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"EmployeeId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"EmployeeWorkId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"HoursWorked"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"Notes"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"StepTrackId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"EmployeeId"
);
b
.
HasIndex
(
"StepTrackId"
);
b
.
ToTable
(
"EmployeeWorks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.StepTrack"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"StepId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"TrackId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"StepId"
);
b
.
HasIndex
(
"TrackId"
);
b
.
ToTable
(
"StepTracks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Track"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
DateTime
>(
"TrackDate"
)
.
HasColumnType
(
"datetime2"
);
b
.
Property
<
string
>(
"TrackNote"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ProjectId"
);
b
.
ToTable
(
"Tracks"
);
});
modelBuilder
.
Entity
(
"RoleUser"
,
b
=>
{
b
.
Property
<
int
>(
"RolesId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"UsersId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"RolesId"
,
"UsersId"
);
b
.
HasIndex
(
"UsersId"
);
b
.
ToTable
(
"RoleUser"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Customers.Aggregate.Customer"
,
b
=>
{
b
.
OwnsMany
(
"PSManagement.Domain.Customers.Entities.ContactInfo"
,
"ContactInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"CustomerId"
)
.
HasColumnType
(
"int"
);
b1
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"ContactType"
)
.
HasColumnType
(
"nvarchar(max)"
);
b1
.
Property
<
string
>(
"ContactValue"
)
.
HasColumnType
(
"nvarchar(max)"
);
b1
.
HasKey
(
"CustomerId"
,
"Id"
);
b1
.
ToTable
(
"ContactInfo"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"CustomerId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Customers.ValueObjects.Address"
,
"Address"
,
b1
=>
{
b1
.
Property
<
int
>(
"CustomerId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"City"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"City"
);
b1
.
Property
<
string
>(
"StreetName"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"StreetName"
);
b1
.
Property
<
int
>(
"StreetNumber"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"StreetNumber"
);
b1
.
Property
<
int
>(
"ZipCode"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"ZipCode"
);
b1
.
HasKey
(
"CustomerId"
);
b1
.
ToTable
(
"Customers"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"CustomerId"
);
});
b
.
Navigation
(
"Address"
);
b
.
Navigation
(
"ContactInfo"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Employee"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Aggregate.Project"
,
null
)
.
WithMany
(
"Participants"
)
.
HasForeignKey
(
"ProjectId"
);
b
.
HasOne
(
"PSManagement.Domain.Steps.Entities.Step"
,
null
)
.
WithMany
(
"Participants"
)
.
HasForeignKey
(
"StepId"
);
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.User"
,
"User"
)
.
WithOne
(
"Employee"
)
.
HasForeignKey
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"UserId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
OwnsOne
(
"PSManagement.Domain.Employees.Entities.Availability"
,
"Availability"
,
b1
=>
{
b1
.
Property
<
int
>(
"EmployeeId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
int
>(
"CurrentWorkingHours"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"CurrentWorkingHours"
);
b1
.
Property
<
bool
>(
"IsAvailable"
)
.
HasColumnType
(
"bit"
)
.
HasColumnName
(
"IsAvailable"
);
b1
.
HasKey
(
"EmployeeId"
);
b1
.
ToTable
(
"Employees"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"EmployeeId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Employees.Entities.PersonalInfo"
,
"PersonalInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"EmployeeId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"FirstName"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"FirstName"
);
b1
.
Property
<
string
>(
"LastName"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"LastName"
);
b1
.
HasKey
(
"EmployeeId"
);
b1
.
ToTable
(
"Employees"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"EmployeeId"
);
});
b
.
Navigation
(
"Availability"
);
b
.
Navigation
(
"PersonalInfo"
);
b
.
Navigation
(
"User"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Identity.Entities.Permission"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.Permission"
,
null
)
.
WithMany
(
"Roles"
)
.
HasForeignKey
(
"PermissionId"
);
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.Role"
,
null
)
.
WithMany
(
"Permissions"
)
.
HasForeignKey
(
"RoleId"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Aggregate.Project"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Department"
,
"Executer"
)
.
WithMany
()
.
HasForeignKey
(
"ExecuterId"
);
b
.
HasOne
(
"PSManagement.Domain.Customers.Aggregate.Customer"
,
"Proposer"
)
.
WithMany
(
"Projects"
)
.
HasForeignKey
(
"ProposerId"
);
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"TeamLeader"
)
.
WithMany
()
.
HasForeignKey
(
"TeamLeaderId"
);
b
.
OwnsOne
(
"PSManagement.Domain.Projects.Aggregate.Aggreement"
,
"ProjectAggreement"
,
b1
=>
{
b1
.
Property
<
int
>(
"ProjectId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
DateTime
>(
"AggreementDate"
)
.
HasColumnType
(
"datetime2"
)
.
HasColumnName
(
"AggreementDate"
);
b1
.
Property
<
int
>(
"AggreementNumber"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"AggreementNumber"
);
b1
.
HasKey
(
"ProjectId"
);
b1
.
ToTable
(
"Projects"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"ProjectId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Projects.Aggregate.ProjectInfo"
,
"ProjectInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"ProjectId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"Code"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"Code"
);
b1
.
Property
<
string
>(
"Description"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"Description"
);
b1
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"Name"
);
b1
.
HasKey
(
"ProjectId"
);
b1
.
ToTable
(
"Projects"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"ProjectId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Projects.Aggregate.ProposalInfo"
,
"ProposalInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"ProjectId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
DateTime
>(
"ProposingBookDate"
)
.
HasColumnType
(
"datetime2"
)
.
HasColumnName
(
"ProposingBookDate"
);
b1
.
Property
<
int
>(
"ProposingBookNumber"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"ProposingBookNumber"
);
b1
.
HasKey
(
"ProjectId"
);
b1
.
ToTable
(
"Projects"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"ProjectId"
);
});
b
.
Navigation
(
"Executer"
);
b
.
Navigation
(
"ProjectAggreement"
);
b
.
Navigation
(
"ProjectInfo"
);
b
.
Navigation
(
"ProposalInfo"
);
b
.
Navigation
(
"Proposer"
);
b
.
Navigation
(
"TeamLeader"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Steps.Entities.Item"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Steps.Entities.Step"
,
null
)
.
WithMany
(
"Purchases"
)
.
HasForeignKey
(
"StepId"
);
b
.
OwnsOne
(
"PSManagement.SharedKernel.ValueObjects.Money"
,
"Price"
,
b1
=>
{
b1
.
Property
<
int
>(
"ItemId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
int
>(
"Ammount"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"Ammount"
);
b1
.
Property
<
string
>(
"Currency"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"Currency"
);
b1
.
HasKey
(
"ItemId"
);
b1
.
ToTable
(
"Items"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"ItemId"
);
});
b
.
Navigation
(
"Price"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Steps.Entities.Step"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Aggregate.Project"
,
"Project"
)
.
WithMany
(
"Steps"
)
.
HasForeignKey
(
"ProjectId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Tracking.Track"
,
null
)
.
WithMany
(
"Steps"
)
.
HasForeignKey
(
"TrackId"
);
b
.
Navigation
(
"Project"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.EmployeeWork"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"Employee"
)
.
WithMany
(
"EmployeeWorks"
)
.
HasForeignKey
(
"EmployeeId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Tracking.Entities.StepTrack"
,
"StepTrack"
)
.
WithMany
(
"EmployeeWorks"
)
.
HasForeignKey
(
"StepTrackId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
)
.
IsRequired
();
b
.
Navigation
(
"Employee"
);
b
.
Navigation
(
"StepTrack"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.StepTrack"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Steps.Entities.Step"
,
"Step"
)
.
WithMany
(
"StepTracks"
)
.
HasForeignKey
(
"StepId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Tracking.Track"
,
"Track"
)
.
WithMany
(
"StepTracks"
)
.
HasForeignKey
(
"TrackId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
)
.
IsRequired
();
b
.
Navigation
(
"Step"
);
b
.
Navigation
(
"Track"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Track"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Aggregate.Project"
,
"Project"
)
.
WithMany
(
"Tracks"
)
.
HasForeignKey
(
"ProjectId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
)
.
IsRequired
();
b
.
Navigation
(
"Project"
);
});
modelBuilder
.
Entity
(
"RoleUser"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.Role"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"RolesId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.User"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"UsersId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Customers.Aggregate.Customer"
,
b
=>
{
b
.
Navigation
(
"Projects"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Employee"
,
b
=>
{
b
.
Navigation
(
"EmployeeWorks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Identity.Entities.Permission"
,
b
=>
{
b
.
Navigation
(
"Roles"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Identity.Entities.Role"
,
b
=>
{
b
.
Navigation
(
"Permissions"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Identity.Entities.User"
,
b
=>
{
b
.
Navigation
(
"Employee"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Aggregate.Project"
,
b
=>
{
b
.
Navigation
(
"Participants"
);
b
.
Navigation
(
"Steps"
);
b
.
Navigation
(
"Tracks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Steps.Entities.Step"
,
b
=>
{
b
.
Navigation
(
"Participants"
);
b
.
Navigation
(
"Purchases"
);
b
.
Navigation
(
"StepTracks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.StepTrack"
,
b
=>
{
b
.
Navigation
(
"EmployeeWorks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Track"
,
b
=>
{
b
.
Navigation
(
"Steps"
);
b
.
Navigation
(
"StepTracks"
);
});
#pragma warning restore 612, 618
}
}
}
PSManagement.Infrastructure.Persistence/Migrations/20240803172708_AddDomains2.Designer.cs
deleted
100644 → 0
View file @
17a7a1c9
// <auto-generated />
using
System
;
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Infrastructure
;
using
Microsoft.EntityFrameworkCore.Metadata
;
using
Microsoft.EntityFrameworkCore.Migrations
;
using
Microsoft.EntityFrameworkCore.Storage.ValueConversion
;
using
PSManagement.Infrastructure.Persistence
;
namespace
PSManagement.Infrastructure.Persistence.Migrations
{
[
DbContext
(
typeof
(
AppDbContext
))]
[
Migration
(
"20240803172708_AddDomains2"
)]
partial
class
AddDomains2
{
protected
override
void
BuildTargetModel
(
ModelBuilder
modelBuilder
)
{
#pragma warning disable 612, 618
modelBuilder
.
HasAnnotation
(
"Relational:Collation"
,
"Arabic_CI_AS"
)
.
HasAnnotation
(
"Relational:MaxIdentifierLength"
,
128
)
.
HasAnnotation
(
"ProductVersion"
,
"5.0.17"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
modelBuilder
.
Entity
(
"PSManagement.Domain.Customers.Aggregate.Customer"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"CustomerName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"Email"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Customers"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Department"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Departments"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Employee"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"HIASTId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"StepId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"UserId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ProjectId"
);
b
.
HasIndex
(
"StepId"
);
b
.
HasIndex
(
"UserId"
)
.
IsUnique
();
b
.
ToTable
(
"Employees"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Identity.Entities.Permission"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
?>(
"PermissionId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"RoleId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"PermissionId"
);
b
.
HasIndex
(
"RoleId"
);
b
.
ToTable
(
"Permission"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Identity.Entities.Role"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Roles"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Identity.Entities.User"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Email"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"HashedPassword"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"UserName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Users"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Aggregate.Project"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
?>(
"ExecuterId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"ProposerId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"TeamLeaderId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ExecuterId"
);
b
.
HasIndex
(
"ProposerId"
);
b
.
HasIndex
(
"TeamLeaderId"
);
b
.
ToTable
(
"Projects"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Steps.Entities.Item"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"ItemDescription"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"ItemName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
?>(
"StepId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"StepId"
);
b
.
ToTable
(
"Items"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Steps.Entities.Step"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Description"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"Duration"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
DateTime
>(
"StartDate"
)
.
HasColumnType
(
"datetime2"
);
b
.
Property
<
string
>(
"StepName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
?>(
"TrackId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ProjectId"
);
b
.
HasIndex
(
"TrackId"
);
b
.
ToTable
(
"Steps"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.EmployeeWork"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"ContributingRatio"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"EmployeeId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"EmployeeWorkId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"HoursWorked"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"Notes"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"StepTrackId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"EmployeeId"
);
b
.
HasIndex
(
"StepTrackId"
);
b
.
ToTable
(
"EmployeeWorks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.StepTrack"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"StepId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"TrackId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"StepId"
);
b
.
HasIndex
(
"TrackId"
);
b
.
ToTable
(
"StepTracks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Track"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
DateTime
>(
"TrackDate"
)
.
HasColumnType
(
"datetime2"
);
b
.
Property
<
string
>(
"TrackNote"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ProjectId"
);
b
.
ToTable
(
"Tracks"
);
});
modelBuilder
.
Entity
(
"RoleUser"
,
b
=>
{
b
.
Property
<
int
>(
"RolesId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"UsersId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"RolesId"
,
"UsersId"
);
b
.
HasIndex
(
"UsersId"
);
b
.
ToTable
(
"RoleUser"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Customers.Aggregate.Customer"
,
b
=>
{
b
.
OwnsMany
(
"PSManagement.Domain.Customers.Entities.ContactInfo"
,
"ContactInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"CustomerId"
)
.
HasColumnType
(
"int"
);
b1
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"ContactType"
)
.
HasColumnType
(
"nvarchar(max)"
);
b1
.
Property
<
string
>(
"ContactValue"
)
.
HasColumnType
(
"nvarchar(max)"
);
b1
.
HasKey
(
"CustomerId"
,
"Id"
);
b1
.
ToTable
(
"ContactInfo"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"CustomerId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Customers.ValueObjects.Address"
,
"Address"
,
b1
=>
{
b1
.
Property
<
int
>(
"CustomerId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"City"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"City"
);
b1
.
Property
<
string
>(
"StreetName"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"StreetName"
);
b1
.
Property
<
int
>(
"StreetNumber"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"StreetNumber"
);
b1
.
Property
<
int
>(
"ZipCode"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"ZipCode"
);
b1
.
HasKey
(
"CustomerId"
);
b1
.
ToTable
(
"Customers"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"CustomerId"
);
});
b
.
Navigation
(
"Address"
);
b
.
Navigation
(
"ContactInfo"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Employee"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Aggregate.Project"
,
null
)
.
WithMany
(
"Participants"
)
.
HasForeignKey
(
"ProjectId"
);
b
.
HasOne
(
"PSManagement.Domain.Steps.Entities.Step"
,
null
)
.
WithMany
(
"Participants"
)
.
HasForeignKey
(
"StepId"
);
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.User"
,
"User"
)
.
WithOne
(
"Employee"
)
.
HasForeignKey
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"UserId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
OwnsOne
(
"PSManagement.Domain.Employees.Entities.Availability"
,
"Availability"
,
b1
=>
{
b1
.
Property
<
int
>(
"EmployeeId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
int
>(
"CurrentWorkingHours"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"CurrentWorkingHours"
);
b1
.
Property
<
bool
>(
"IsAvailable"
)
.
HasColumnType
(
"bit"
)
.
HasColumnName
(
"IsAvailable"
);
b1
.
HasKey
(
"EmployeeId"
);
b1
.
ToTable
(
"Employees"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"EmployeeId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Employees.Entities.PersonalInfo"
,
"PersonalInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"EmployeeId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"FirstName"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"FirstName"
);
b1
.
Property
<
string
>(
"LastName"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"LastName"
);
b1
.
HasKey
(
"EmployeeId"
);
b1
.
ToTable
(
"Employees"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"EmployeeId"
);
});
b
.
Navigation
(
"Availability"
);
b
.
Navigation
(
"PersonalInfo"
);
b
.
Navigation
(
"User"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Identity.Entities.Permission"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.Permission"
,
null
)
.
WithMany
(
"Roles"
)
.
HasForeignKey
(
"PermissionId"
);
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.Role"
,
null
)
.
WithMany
(
"Permissions"
)
.
HasForeignKey
(
"RoleId"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Aggregate.Project"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Department"
,
"Executer"
)
.
WithMany
()
.
HasForeignKey
(
"ExecuterId"
);
b
.
HasOne
(
"PSManagement.Domain.Customers.Aggregate.Customer"
,
"Proposer"
)
.
WithMany
(
"Projects"
)
.
HasForeignKey
(
"ProposerId"
);
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"TeamLeader"
)
.
WithMany
()
.
HasForeignKey
(
"TeamLeaderId"
);
b
.
OwnsOne
(
"PSManagement.Domain.Projects.Aggregate.Aggreement"
,
"ProjectAggreement"
,
b1
=>
{
b1
.
Property
<
int
>(
"ProjectId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
DateTime
>(
"AggreementDate"
)
.
HasColumnType
(
"datetime2"
)
.
HasColumnName
(
"AggreementDate"
);
b1
.
Property
<
int
>(
"AggreementNumber"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"AggreementNumber"
);
b1
.
HasKey
(
"ProjectId"
);
b1
.
ToTable
(
"Projects"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"ProjectId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Projects.Aggregate.ProjectInfo"
,
"ProjectInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"ProjectId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"Code"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"Code"
);
b1
.
Property
<
string
>(
"Description"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"Description"
);
b1
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"Name"
);
b1
.
HasKey
(
"ProjectId"
);
b1
.
ToTable
(
"Projects"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"ProjectId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Projects.Aggregate.ProposalInfo"
,
"ProposalInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"ProjectId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
DateTime
>(
"ProposingBookDate"
)
.
HasColumnType
(
"datetime2"
)
.
HasColumnName
(
"ProposingBookDate"
);
b1
.
Property
<
int
>(
"ProposingBookNumber"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"ProposingBookNumber"
);
b1
.
HasKey
(
"ProjectId"
);
b1
.
ToTable
(
"Projects"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"ProjectId"
);
});
b
.
Navigation
(
"Executer"
);
b
.
Navigation
(
"ProjectAggreement"
);
b
.
Navigation
(
"ProjectInfo"
);
b
.
Navigation
(
"ProposalInfo"
);
b
.
Navigation
(
"Proposer"
);
b
.
Navigation
(
"TeamLeader"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Steps.Entities.Item"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Steps.Entities.Step"
,
null
)
.
WithMany
(
"Purchases"
)
.
HasForeignKey
(
"StepId"
);
b
.
OwnsOne
(
"PSManagement.SharedKernel.ValueObjects.Money"
,
"Price"
,
b1
=>
{
b1
.
Property
<
int
>(
"ItemId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
int
>(
"Ammount"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"Ammount"
);
b1
.
Property
<
string
>(
"Currency"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"Currency"
);
b1
.
HasKey
(
"ItemId"
);
b1
.
ToTable
(
"Items"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"ItemId"
);
});
b
.
Navigation
(
"Price"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Steps.Entities.Step"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Aggregate.Project"
,
"Project"
)
.
WithMany
(
"Steps"
)
.
HasForeignKey
(
"ProjectId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Tracking.Track"
,
null
)
.
WithMany
(
"Steps"
)
.
HasForeignKey
(
"TrackId"
);
b
.
Navigation
(
"Project"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.EmployeeWork"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"Employee"
)
.
WithMany
(
"EmployeeWorks"
)
.
HasForeignKey
(
"EmployeeId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Tracking.Entities.StepTrack"
,
"StepTrack"
)
.
WithMany
(
"EmployeeWorks"
)
.
HasForeignKey
(
"StepTrackId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
)
.
IsRequired
();
b
.
Navigation
(
"Employee"
);
b
.
Navigation
(
"StepTrack"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.StepTrack"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Steps.Entities.Step"
,
"Step"
)
.
WithMany
(
"StepTracks"
)
.
HasForeignKey
(
"StepId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Tracking.Track"
,
"Track"
)
.
WithMany
(
"StepTracks"
)
.
HasForeignKey
(
"TrackId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
)
.
IsRequired
();
b
.
Navigation
(
"Step"
);
b
.
Navigation
(
"Track"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Track"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Aggregate.Project"
,
"Project"
)
.
WithMany
(
"Tracks"
)
.
HasForeignKey
(
"ProjectId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
)
.
IsRequired
();
b
.
Navigation
(
"Project"
);
});
modelBuilder
.
Entity
(
"RoleUser"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.Role"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"RolesId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.User"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"UsersId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Customers.Aggregate.Customer"
,
b
=>
{
b
.
Navigation
(
"Projects"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Employee"
,
b
=>
{
b
.
Navigation
(
"EmployeeWorks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Identity.Entities.Permission"
,
b
=>
{
b
.
Navigation
(
"Roles"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Identity.Entities.Role"
,
b
=>
{
b
.
Navigation
(
"Permissions"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Identity.Entities.User"
,
b
=>
{
b
.
Navigation
(
"Employee"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Aggregate.Project"
,
b
=>
{
b
.
Navigation
(
"Participants"
);
b
.
Navigation
(
"Steps"
);
b
.
Navigation
(
"Tracks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Steps.Entities.Step"
,
b
=>
{
b
.
Navigation
(
"Participants"
);
b
.
Navigation
(
"Purchases"
);
b
.
Navigation
(
"StepTracks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.StepTrack"
,
b
=>
{
b
.
Navigation
(
"EmployeeWorks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Track"
,
b
=>
{
b
.
Navigation
(
"Steps"
);
b
.
Navigation
(
"StepTracks"
);
});
#pragma warning restore 612, 618
}
}
}
PSManagement.Infrastructure.Persistence/Migrations/20240803172708_AddDomains2.cs
deleted
100644 → 0
View file @
17a7a1c9
using
Microsoft.EntityFrameworkCore.Migrations
;
namespace
PSManagement.Infrastructure.Persistence.Migrations
{
public
partial
class
AddDomains2
:
Migration
{
protected
override
void
Up
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
DropForeignKey
(
name
:
"FK_Permission_Role_RoleId"
,
table
:
"Permission"
);
migrationBuilder
.
DropForeignKey
(
name
:
"FK_RoleUser_Role_RolesId"
,
table
:
"RoleUser"
);
migrationBuilder
.
DropPrimaryKey
(
name
:
"PK_Role"
,
table
:
"Role"
);
migrationBuilder
.
RenameTable
(
name
:
"Role"
,
newName
:
"Roles"
);
migrationBuilder
.
AddPrimaryKey
(
name
:
"PK_Roles"
,
table
:
"Roles"
,
column
:
"Id"
);
migrationBuilder
.
AddForeignKey
(
name
:
"FK_Permission_Roles_RoleId"
,
table
:
"Permission"
,
column
:
"RoleId"
,
principalTable
:
"Roles"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Restrict
);
migrationBuilder
.
AddForeignKey
(
name
:
"FK_RoleUser_Roles_RolesId"
,
table
:
"RoleUser"
,
column
:
"RolesId"
,
principalTable
:
"Roles"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Cascade
);
}
protected
override
void
Down
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
DropForeignKey
(
name
:
"FK_Permission_Roles_RoleId"
,
table
:
"Permission"
);
migrationBuilder
.
DropForeignKey
(
name
:
"FK_RoleUser_Roles_RolesId"
,
table
:
"RoleUser"
);
migrationBuilder
.
DropPrimaryKey
(
name
:
"PK_Roles"
,
table
:
"Roles"
);
migrationBuilder
.
RenameTable
(
name
:
"Roles"
,
newName
:
"Role"
);
migrationBuilder
.
AddPrimaryKey
(
name
:
"PK_Role"
,
table
:
"Role"
,
column
:
"Id"
);
migrationBuilder
.
AddForeignKey
(
name
:
"FK_Permission_Role_RoleId"
,
table
:
"Permission"
,
column
:
"RoleId"
,
principalTable
:
"Role"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Restrict
);
migrationBuilder
.
AddForeignKey
(
name
:
"FK_RoleUser_Role_RolesId"
,
table
:
"RoleUser"
,
column
:
"RolesId"
,
principalTable
:
"Role"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Cascade
);
}
}
}
PSManagement.Infrastructure.Persistence/Migrations/20240803173142_AddDomains3.Designer.cs
deleted
100644 → 0
View file @
17a7a1c9
// <auto-generated />
using
System
;
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Infrastructure
;
using
Microsoft.EntityFrameworkCore.Metadata
;
using
Microsoft.EntityFrameworkCore.Migrations
;
using
Microsoft.EntityFrameworkCore.Storage.ValueConversion
;
using
PSManagement.Infrastructure.Persistence
;
namespace
PSManagement.Infrastructure.Persistence.Migrations
{
[
DbContext
(
typeof
(
AppDbContext
))]
[
Migration
(
"20240803173142_AddDomains3"
)]
partial
class
AddDomains3
{
protected
override
void
BuildTargetModel
(
ModelBuilder
modelBuilder
)
{
#pragma warning disable 612, 618
modelBuilder
.
HasAnnotation
(
"Relational:Collation"
,
"Arabic_CI_AS"
)
.
HasAnnotation
(
"Relational:MaxIdentifierLength"
,
128
)
.
HasAnnotation
(
"ProductVersion"
,
"5.0.17"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
modelBuilder
.
Entity
(
"PSManagement.Domain.Customers.Aggregate.Customer"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"CustomerName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"Email"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Customers"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Department"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Departments"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Employee"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"HIASTId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"StepId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"UserId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ProjectId"
);
b
.
HasIndex
(
"StepId"
);
b
.
HasIndex
(
"UserId"
)
.
IsUnique
();
b
.
ToTable
(
"Employees"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Identity.Entities.Permission"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Permission"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Identity.Entities.Role"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Roles"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Identity.Entities.User"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Email"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"HashedPassword"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"UserName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Users"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Aggregate.Project"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
?>(
"ExecuterId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"ProposerId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"TeamLeaderId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ExecuterId"
);
b
.
HasIndex
(
"ProposerId"
);
b
.
HasIndex
(
"TeamLeaderId"
);
b
.
ToTable
(
"Projects"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Steps.Entities.Item"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"ItemDescription"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"ItemName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
?>(
"StepId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"StepId"
);
b
.
ToTable
(
"Items"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Steps.Entities.Step"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Description"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"Duration"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
DateTime
>(
"StartDate"
)
.
HasColumnType
(
"datetime2"
);
b
.
Property
<
string
>(
"StepName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
?>(
"TrackId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ProjectId"
);
b
.
HasIndex
(
"TrackId"
);
b
.
ToTable
(
"Steps"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.EmployeeWork"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"ContributingRatio"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"EmployeeId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"EmployeeWorkId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"HoursWorked"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"Notes"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"StepTrackId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"EmployeeId"
);
b
.
HasIndex
(
"StepTrackId"
);
b
.
ToTable
(
"EmployeeWorks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.StepTrack"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"StepId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"TrackId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"StepId"
);
b
.
HasIndex
(
"TrackId"
);
b
.
ToTable
(
"StepTracks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Track"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
DateTime
>(
"TrackDate"
)
.
HasColumnType
(
"datetime2"
);
b
.
Property
<
string
>(
"TrackNote"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ProjectId"
);
b
.
ToTable
(
"Tracks"
);
});
modelBuilder
.
Entity
(
"PermissionRole"
,
b
=>
{
b
.
Property
<
int
>(
"PermissionsId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"RolesId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"PermissionsId"
,
"RolesId"
);
b
.
HasIndex
(
"RolesId"
);
b
.
ToTable
(
"PermissionRole"
);
});
modelBuilder
.
Entity
(
"RoleUser"
,
b
=>
{
b
.
Property
<
int
>(
"RolesId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"UsersId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"RolesId"
,
"UsersId"
);
b
.
HasIndex
(
"UsersId"
);
b
.
ToTable
(
"RoleUser"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Customers.Aggregate.Customer"
,
b
=>
{
b
.
OwnsMany
(
"PSManagement.Domain.Customers.Entities.ContactInfo"
,
"ContactInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"CustomerId"
)
.
HasColumnType
(
"int"
);
b1
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"ContactType"
)
.
HasColumnType
(
"nvarchar(max)"
);
b1
.
Property
<
string
>(
"ContactValue"
)
.
HasColumnType
(
"nvarchar(max)"
);
b1
.
HasKey
(
"CustomerId"
,
"Id"
);
b1
.
ToTable
(
"ContactInfo"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"CustomerId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Customers.ValueObjects.Address"
,
"Address"
,
b1
=>
{
b1
.
Property
<
int
>(
"CustomerId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"City"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"City"
);
b1
.
Property
<
string
>(
"StreetName"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"StreetName"
);
b1
.
Property
<
int
>(
"StreetNumber"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"StreetNumber"
);
b1
.
Property
<
int
>(
"ZipCode"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"ZipCode"
);
b1
.
HasKey
(
"CustomerId"
);
b1
.
ToTable
(
"Customers"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"CustomerId"
);
});
b
.
Navigation
(
"Address"
);
b
.
Navigation
(
"ContactInfo"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Employee"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Aggregate.Project"
,
null
)
.
WithMany
(
"Participants"
)
.
HasForeignKey
(
"ProjectId"
);
b
.
HasOne
(
"PSManagement.Domain.Steps.Entities.Step"
,
null
)
.
WithMany
(
"Participants"
)
.
HasForeignKey
(
"StepId"
);
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.User"
,
"User"
)
.
WithOne
(
"Employee"
)
.
HasForeignKey
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"UserId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
OwnsOne
(
"PSManagement.Domain.Employees.Entities.Availability"
,
"Availability"
,
b1
=>
{
b1
.
Property
<
int
>(
"EmployeeId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
int
>(
"CurrentWorkingHours"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"CurrentWorkingHours"
);
b1
.
Property
<
bool
>(
"IsAvailable"
)
.
HasColumnType
(
"bit"
)
.
HasColumnName
(
"IsAvailable"
);
b1
.
HasKey
(
"EmployeeId"
);
b1
.
ToTable
(
"Employees"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"EmployeeId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Employees.Entities.PersonalInfo"
,
"PersonalInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"EmployeeId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"FirstName"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"FirstName"
);
b1
.
Property
<
string
>(
"LastName"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"LastName"
);
b1
.
HasKey
(
"EmployeeId"
);
b1
.
ToTable
(
"Employees"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"EmployeeId"
);
});
b
.
Navigation
(
"Availability"
);
b
.
Navigation
(
"PersonalInfo"
);
b
.
Navigation
(
"User"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Aggregate.Project"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Department"
,
"Executer"
)
.
WithMany
()
.
HasForeignKey
(
"ExecuterId"
);
b
.
HasOne
(
"PSManagement.Domain.Customers.Aggregate.Customer"
,
"Proposer"
)
.
WithMany
(
"Projects"
)
.
HasForeignKey
(
"ProposerId"
);
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"TeamLeader"
)
.
WithMany
()
.
HasForeignKey
(
"TeamLeaderId"
);
b
.
OwnsOne
(
"PSManagement.Domain.Projects.Aggregate.Aggreement"
,
"ProjectAggreement"
,
b1
=>
{
b1
.
Property
<
int
>(
"ProjectId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
DateTime
>(
"AggreementDate"
)
.
HasColumnType
(
"datetime2"
)
.
HasColumnName
(
"AggreementDate"
);
b1
.
Property
<
int
>(
"AggreementNumber"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"AggreementNumber"
);
b1
.
HasKey
(
"ProjectId"
);
b1
.
ToTable
(
"Projects"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"ProjectId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Projects.Aggregate.ProjectInfo"
,
"ProjectInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"ProjectId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"Code"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"Code"
);
b1
.
Property
<
string
>(
"Description"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"Description"
);
b1
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"Name"
);
b1
.
HasKey
(
"ProjectId"
);
b1
.
ToTable
(
"Projects"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"ProjectId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Projects.Aggregate.ProposalInfo"
,
"ProposalInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"ProjectId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
DateTime
>(
"ProposingBookDate"
)
.
HasColumnType
(
"datetime2"
)
.
HasColumnName
(
"ProposingBookDate"
);
b1
.
Property
<
int
>(
"ProposingBookNumber"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"ProposingBookNumber"
);
b1
.
HasKey
(
"ProjectId"
);
b1
.
ToTable
(
"Projects"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"ProjectId"
);
});
b
.
Navigation
(
"Executer"
);
b
.
Navigation
(
"ProjectAggreement"
);
b
.
Navigation
(
"ProjectInfo"
);
b
.
Navigation
(
"ProposalInfo"
);
b
.
Navigation
(
"Proposer"
);
b
.
Navigation
(
"TeamLeader"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Steps.Entities.Item"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Steps.Entities.Step"
,
null
)
.
WithMany
(
"Purchases"
)
.
HasForeignKey
(
"StepId"
);
b
.
OwnsOne
(
"PSManagement.SharedKernel.ValueObjects.Money"
,
"Price"
,
b1
=>
{
b1
.
Property
<
int
>(
"ItemId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
int
>(
"Ammount"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"Ammount"
);
b1
.
Property
<
string
>(
"Currency"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"Currency"
);
b1
.
HasKey
(
"ItemId"
);
b1
.
ToTable
(
"Items"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"ItemId"
);
});
b
.
Navigation
(
"Price"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Steps.Entities.Step"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Aggregate.Project"
,
"Project"
)
.
WithMany
(
"Steps"
)
.
HasForeignKey
(
"ProjectId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Tracking.Track"
,
null
)
.
WithMany
(
"Steps"
)
.
HasForeignKey
(
"TrackId"
);
b
.
Navigation
(
"Project"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.EmployeeWork"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"Employee"
)
.
WithMany
(
"EmployeeWorks"
)
.
HasForeignKey
(
"EmployeeId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Tracking.Entities.StepTrack"
,
"StepTrack"
)
.
WithMany
(
"EmployeeWorks"
)
.
HasForeignKey
(
"StepTrackId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
)
.
IsRequired
();
b
.
Navigation
(
"Employee"
);
b
.
Navigation
(
"StepTrack"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.StepTrack"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Steps.Entities.Step"
,
"Step"
)
.
WithMany
(
"StepTracks"
)
.
HasForeignKey
(
"StepId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Tracking.Track"
,
"Track"
)
.
WithMany
(
"StepTracks"
)
.
HasForeignKey
(
"TrackId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
)
.
IsRequired
();
b
.
Navigation
(
"Step"
);
b
.
Navigation
(
"Track"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Track"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Aggregate.Project"
,
"Project"
)
.
WithMany
(
"Tracks"
)
.
HasForeignKey
(
"ProjectId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
)
.
IsRequired
();
b
.
Navigation
(
"Project"
);
});
modelBuilder
.
Entity
(
"PermissionRole"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.Permission"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"PermissionsId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.Role"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"RolesId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
});
modelBuilder
.
Entity
(
"RoleUser"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.Role"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"RolesId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.User"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"UsersId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Customers.Aggregate.Customer"
,
b
=>
{
b
.
Navigation
(
"Projects"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Employee"
,
b
=>
{
b
.
Navigation
(
"EmployeeWorks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Identity.Entities.User"
,
b
=>
{
b
.
Navigation
(
"Employee"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Aggregate.Project"
,
b
=>
{
b
.
Navigation
(
"Participants"
);
b
.
Navigation
(
"Steps"
);
b
.
Navigation
(
"Tracks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Steps.Entities.Step"
,
b
=>
{
b
.
Navigation
(
"Participants"
);
b
.
Navigation
(
"Purchases"
);
b
.
Navigation
(
"StepTracks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.StepTrack"
,
b
=>
{
b
.
Navigation
(
"EmployeeWorks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Track"
,
b
=>
{
b
.
Navigation
(
"Steps"
);
b
.
Navigation
(
"StepTracks"
);
});
#pragma warning restore 612, 618
}
}
}
PSManagement.Infrastructure.Persistence/Migrations/20240803173142_AddDomains3.cs
deleted
100644 → 0
View file @
17a7a1c9
using
Microsoft.EntityFrameworkCore.Migrations
;
namespace
PSManagement.Infrastructure.Persistence.Migrations
{
public
partial
class
AddDomains3
:
Migration
{
protected
override
void
Up
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
DropForeignKey
(
name
:
"FK_Permission_Permission_PermissionId"
,
table
:
"Permission"
);
migrationBuilder
.
DropForeignKey
(
name
:
"FK_Permission_Roles_RoleId"
,
table
:
"Permission"
);
migrationBuilder
.
DropIndex
(
name
:
"IX_Permission_PermissionId"
,
table
:
"Permission"
);
migrationBuilder
.
DropIndex
(
name
:
"IX_Permission_RoleId"
,
table
:
"Permission"
);
migrationBuilder
.
DropColumn
(
name
:
"PermissionId"
,
table
:
"Permission"
);
migrationBuilder
.
DropColumn
(
name
:
"RoleId"
,
table
:
"Permission"
);
migrationBuilder
.
CreateTable
(
name
:
"PermissionRole"
,
columns
:
table
=>
new
{
PermissionsId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
RolesId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_PermissionRole"
,
x
=>
new
{
x
.
PermissionsId
,
x
.
RolesId
});
table
.
ForeignKey
(
name
:
"FK_PermissionRole_Permission_PermissionsId"
,
column
:
x
=>
x
.
PermissionsId
,
principalTable
:
"Permission"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Cascade
);
table
.
ForeignKey
(
name
:
"FK_PermissionRole_Roles_RolesId"
,
column
:
x
=>
x
.
RolesId
,
principalTable
:
"Roles"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Cascade
);
});
migrationBuilder
.
CreateIndex
(
name
:
"IX_PermissionRole_RolesId"
,
table
:
"PermissionRole"
,
column
:
"RolesId"
);
}
protected
override
void
Down
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
DropTable
(
name
:
"PermissionRole"
);
migrationBuilder
.
AddColumn
<
int
>(
name
:
"PermissionId"
,
table
:
"Permission"
,
type
:
"int"
,
nullable
:
true
);
migrationBuilder
.
AddColumn
<
int
>(
name
:
"RoleId"
,
table
:
"Permission"
,
type
:
"int"
,
nullable
:
true
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_Permission_PermissionId"
,
table
:
"Permission"
,
column
:
"PermissionId"
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_Permission_RoleId"
,
table
:
"Permission"
,
column
:
"RoleId"
);
migrationBuilder
.
AddForeignKey
(
name
:
"FK_Permission_Permission_PermissionId"
,
table
:
"Permission"
,
column
:
"PermissionId"
,
principalTable
:
"Permission"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Restrict
);
migrationBuilder
.
AddForeignKey
(
name
:
"FK_Permission_Roles_RoleId"
,
table
:
"Permission"
,
column
:
"RoleId"
,
principalTable
:
"Roles"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Restrict
);
}
}
}
PSManagement.Infrastructure.Persistence/Migrations/20240803180549_AddDomains4.Designer.cs
deleted
100644 → 0
View file @
17a7a1c9
// <auto-generated />
using
System
;
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Infrastructure
;
using
Microsoft.EntityFrameworkCore.Metadata
;
using
Microsoft.EntityFrameworkCore.Migrations
;
using
Microsoft.EntityFrameworkCore.Storage.ValueConversion
;
using
PSManagement.Infrastructure.Persistence
;
namespace
PSManagement.Infrastructure.Persistence.Migrations
{
[
DbContext
(
typeof
(
AppDbContext
))]
[
Migration
(
"20240803180549_AddDomains4"
)]
partial
class
AddDomains4
{
protected
override
void
BuildTargetModel
(
ModelBuilder
modelBuilder
)
{
#pragma warning disable 612, 618
modelBuilder
.
HasAnnotation
(
"Relational:Collation"
,
"Arabic_CI_AS"
)
.
HasAnnotation
(
"Relational:MaxIdentifierLength"
,
128
)
.
HasAnnotation
(
"ProductVersion"
,
"5.0.17"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
modelBuilder
.
Entity
(
"PSManagement.Domain.Customers.Aggregate.Customer"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"CustomerName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"Email"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Customers"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Department"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Departments"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Employee"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"HIASTId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"StepId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"UserId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"StepId"
);
b
.
HasIndex
(
"UserId"
)
.
IsUnique
();
b
.
ToTable
(
"Employees"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Identity.Entities.Permission"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Permission"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Identity.Entities.Role"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Roles"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Identity.Entities.User"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Email"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"HashedPassword"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"UserName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Users"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.ProjectTypes.Entities.ProjectType"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Description"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"TypeName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"WorkerCount"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"ProjectType"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Aggregate.Project"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
?>(
"ExecuterId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"ProjectTypeId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"ProposerId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"TeamLeaderId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ExecuterId"
);
b
.
HasIndex
(
"ProjectTypeId"
);
b
.
HasIndex
(
"ProposerId"
);
b
.
HasIndex
(
"TeamLeaderId"
);
b
.
ToTable
(
"Projects"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Steps.Entities.Item"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"ItemDescription"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"ItemName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
?>(
"StepId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"StepId"
);
b
.
ToTable
(
"Items"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Steps.Entities.Step"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Description"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"Duration"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
DateTime
>(
"StartDate"
)
.
HasColumnType
(
"datetime2"
);
b
.
Property
<
string
>(
"StepName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
?>(
"TrackId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ProjectId"
);
b
.
HasIndex
(
"TrackId"
);
b
.
ToTable
(
"Steps"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.EmployeeWork"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"ContributingRatio"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"EmployeeId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"EmployeeWorkId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"HoursWorked"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"Notes"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"StepTrackId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"EmployeeId"
);
b
.
HasIndex
(
"StepTrackId"
);
b
.
ToTable
(
"EmployeeWorks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.StepTrack"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"StepId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"TrackId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"StepId"
);
b
.
HasIndex
(
"TrackId"
);
b
.
ToTable
(
"StepTracks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Track"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
DateTime
>(
"TrackDate"
)
.
HasColumnType
(
"datetime2"
);
b
.
Property
<
string
>(
"TrackNote"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ProjectId"
);
b
.
ToTable
(
"Tracks"
);
});
modelBuilder
.
Entity
(
"PermissionRole"
,
b
=>
{
b
.
Property
<
int
>(
"PermissionsId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"RolesId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"PermissionsId"
,
"RolesId"
);
b
.
HasIndex
(
"RolesId"
);
b
.
ToTable
(
"PermissionRole"
);
});
modelBuilder
.
Entity
(
"RoleUser"
,
b
=>
{
b
.
Property
<
int
>(
"RolesId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"UsersId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"RolesId"
,
"UsersId"
);
b
.
HasIndex
(
"UsersId"
);
b
.
ToTable
(
"RoleUser"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Customers.Aggregate.Customer"
,
b
=>
{
b
.
OwnsMany
(
"PSManagement.Domain.Customers.Entities.ContactInfo"
,
"ContactInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"CustomerId"
)
.
HasColumnType
(
"int"
);
b1
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"ContactType"
)
.
HasColumnType
(
"nvarchar(max)"
);
b1
.
Property
<
string
>(
"ContactValue"
)
.
HasColumnType
(
"nvarchar(max)"
);
b1
.
HasKey
(
"CustomerId"
,
"Id"
);
b1
.
ToTable
(
"ContactInfo"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"CustomerId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Customers.ValueObjects.Address"
,
"Address"
,
b1
=>
{
b1
.
Property
<
int
>(
"CustomerId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"City"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"City"
);
b1
.
Property
<
string
>(
"StreetName"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"StreetName"
);
b1
.
Property
<
int
>(
"StreetNumber"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"StreetNumber"
);
b1
.
Property
<
int
>(
"ZipCode"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"ZipCode"
);
b1
.
HasKey
(
"CustomerId"
);
b1
.
ToTable
(
"Customers"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"CustomerId"
);
});
b
.
Navigation
(
"Address"
);
b
.
Navigation
(
"ContactInfo"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Employee"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Steps.Entities.Step"
,
null
)
.
WithMany
(
"Participants"
)
.
HasForeignKey
(
"StepId"
);
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.User"
,
"User"
)
.
WithOne
(
"Employee"
)
.
HasForeignKey
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"UserId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
OwnsOne
(
"PSManagement.Domain.Employees.Entities.Availability"
,
"Availability"
,
b1
=>
{
b1
.
Property
<
int
>(
"EmployeeId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
int
>(
"CurrentWorkingHours"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"CurrentWorkingHours"
);
b1
.
Property
<
bool
>(
"IsAvailable"
)
.
HasColumnType
(
"bit"
)
.
HasColumnName
(
"IsAvailable"
);
b1
.
HasKey
(
"EmployeeId"
);
b1
.
ToTable
(
"Employees"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"EmployeeId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Employees.Entities.PersonalInfo"
,
"PersonalInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"EmployeeId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"FirstName"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"FirstName"
);
b1
.
Property
<
string
>(
"LastName"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"LastName"
);
b1
.
HasKey
(
"EmployeeId"
);
b1
.
ToTable
(
"Employees"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"EmployeeId"
);
});
b
.
Navigation
(
"Availability"
);
b
.
Navigation
(
"PersonalInfo"
);
b
.
Navigation
(
"User"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Aggregate.Project"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Department"
,
"Executer"
)
.
WithMany
()
.
HasForeignKey
(
"ExecuterId"
);
b
.
HasOne
(
"PSManagement.Domain.ProjectTypes.Entities.ProjectType"
,
"ProjectType"
)
.
WithMany
(
"Projects"
)
.
HasForeignKey
(
"ProjectTypeId"
);
b
.
HasOne
(
"PSManagement.Domain.Customers.Aggregate.Customer"
,
"Proposer"
)
.
WithMany
(
"Projects"
)
.
HasForeignKey
(
"ProposerId"
);
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"TeamLeader"
)
.
WithMany
()
.
HasForeignKey
(
"TeamLeaderId"
);
b
.
OwnsOne
(
"PSManagement.Domain.Projects.Aggregate.Aggreement"
,
"ProjectAggreement"
,
b1
=>
{
b1
.
Property
<
int
>(
"ProjectId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
DateTime
>(
"AggreementDate"
)
.
HasColumnType
(
"datetime2"
)
.
HasColumnName
(
"AggreementDate"
);
b1
.
Property
<
int
>(
"AggreementNumber"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"AggreementNumber"
);
b1
.
HasKey
(
"ProjectId"
);
b1
.
ToTable
(
"Projects"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"ProjectId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Projects.Aggregate.ProjectInfo"
,
"ProjectInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"ProjectId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"Code"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"Code"
);
b1
.
Property
<
string
>(
"Description"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"Description"
);
b1
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"Name"
);
b1
.
HasKey
(
"ProjectId"
);
b1
.
ToTable
(
"Projects"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"ProjectId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Projects.Aggregate.ProposalInfo"
,
"ProposalInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"ProjectId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
DateTime
>(
"ProposingBookDate"
)
.
HasColumnType
(
"datetime2"
)
.
HasColumnName
(
"ProposingBookDate"
);
b1
.
Property
<
int
>(
"ProposingBookNumber"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"ProposingBookNumber"
);
b1
.
HasKey
(
"ProjectId"
);
b1
.
ToTable
(
"Projects"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"ProjectId"
);
});
b
.
Navigation
(
"Executer"
);
b
.
Navigation
(
"ProjectAggreement"
);
b
.
Navigation
(
"ProjectInfo"
);
b
.
Navigation
(
"ProjectType"
);
b
.
Navigation
(
"ProposalInfo"
);
b
.
Navigation
(
"Proposer"
);
b
.
Navigation
(
"TeamLeader"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Steps.Entities.Item"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Steps.Entities.Step"
,
null
)
.
WithMany
(
"Purchases"
)
.
HasForeignKey
(
"StepId"
);
b
.
OwnsOne
(
"PSManagement.SharedKernel.ValueObjects.Money"
,
"Price"
,
b1
=>
{
b1
.
Property
<
int
>(
"ItemId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
int
>(
"Ammount"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"Ammount"
);
b1
.
Property
<
string
>(
"Currency"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"Currency"
);
b1
.
HasKey
(
"ItemId"
);
b1
.
ToTable
(
"Items"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"ItemId"
);
});
b
.
Navigation
(
"Price"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Steps.Entities.Step"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Aggregate.Project"
,
"Project"
)
.
WithMany
(
"Steps"
)
.
HasForeignKey
(
"ProjectId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Tracking.Track"
,
null
)
.
WithMany
(
"Steps"
)
.
HasForeignKey
(
"TrackId"
);
b
.
Navigation
(
"Project"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.EmployeeWork"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"Employee"
)
.
WithMany
(
"EmployeeWorks"
)
.
HasForeignKey
(
"EmployeeId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Tracking.Entities.StepTrack"
,
"StepTrack"
)
.
WithMany
(
"EmployeeWorks"
)
.
HasForeignKey
(
"StepTrackId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
)
.
IsRequired
();
b
.
Navigation
(
"Employee"
);
b
.
Navigation
(
"StepTrack"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.StepTrack"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Steps.Entities.Step"
,
"Step"
)
.
WithMany
(
"StepTracks"
)
.
HasForeignKey
(
"StepId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Tracking.Track"
,
"Track"
)
.
WithMany
(
"StepTracks"
)
.
HasForeignKey
(
"TrackId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
)
.
IsRequired
();
b
.
Navigation
(
"Step"
);
b
.
Navigation
(
"Track"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Track"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Aggregate.Project"
,
"Project"
)
.
WithMany
(
"Tracks"
)
.
HasForeignKey
(
"ProjectId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
)
.
IsRequired
();
b
.
Navigation
(
"Project"
);
});
modelBuilder
.
Entity
(
"PermissionRole"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.Permission"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"PermissionsId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.Role"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"RolesId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
});
modelBuilder
.
Entity
(
"RoleUser"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.Role"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"RolesId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.User"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"UsersId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Customers.Aggregate.Customer"
,
b
=>
{
b
.
Navigation
(
"Projects"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Employee"
,
b
=>
{
b
.
Navigation
(
"EmployeeWorks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Identity.Entities.User"
,
b
=>
{
b
.
Navigation
(
"Employee"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.ProjectTypes.Entities.ProjectType"
,
b
=>
{
b
.
Navigation
(
"Projects"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Aggregate.Project"
,
b
=>
{
b
.
Navigation
(
"Steps"
);
b
.
Navigation
(
"Tracks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Steps.Entities.Step"
,
b
=>
{
b
.
Navigation
(
"Participants"
);
b
.
Navigation
(
"Purchases"
);
b
.
Navigation
(
"StepTracks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.StepTrack"
,
b
=>
{
b
.
Navigation
(
"EmployeeWorks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Track"
,
b
=>
{
b
.
Navigation
(
"Steps"
);
b
.
Navigation
(
"StepTracks"
);
});
#pragma warning restore 612, 618
}
}
}
PSManagement.Infrastructure.Persistence/Migrations/20240803190751_AddDomains5.Designer.cs
deleted
100644 → 0
View file @
17a7a1c9
// <auto-generated />
using
System
;
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Infrastructure
;
using
Microsoft.EntityFrameworkCore.Metadata
;
using
Microsoft.EntityFrameworkCore.Migrations
;
using
Microsoft.EntityFrameworkCore.Storage.ValueConversion
;
using
PSManagement.Infrastructure.Persistence
;
namespace
PSManagement.Infrastructure.Persistence.Migrations
{
[
DbContext
(
typeof
(
AppDbContext
))]
[
Migration
(
"20240803190751_AddDomains5"
)]
partial
class
AddDomains5
{
protected
override
void
BuildTargetModel
(
ModelBuilder
modelBuilder
)
{
#pragma warning disable 612, 618
modelBuilder
.
HasAnnotation
(
"Relational:Collation"
,
"Arabic_CI_AS"
)
.
HasAnnotation
(
"Relational:MaxIdentifierLength"
,
128
)
.
HasAnnotation
(
"ProductVersion"
,
"5.0.17"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
modelBuilder
.
Entity
(
"PSManagement.Domain.Customers.Aggregate.Customer"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"CustomerName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"Email"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Customers"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Department"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Departments"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Employee"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"HIASTId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"StepId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"UserId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"StepId"
);
b
.
HasIndex
(
"UserId"
)
.
IsUnique
();
b
.
ToTable
(
"Employees"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Identity.Entities.Permission"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Permission"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Identity.Entities.Role"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Roles"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Identity.Entities.User"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Email"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"HashedPassword"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"UserName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Users"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.ProjectTypes.Entities.ProjectType"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Description"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"TypeName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"WorkerCount"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"ProjectType"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Aggregate.Project"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
?>(
"ExecuterId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"ProjectStatusId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"ProjectTypeId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"ProposerId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"TeamLeaderId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ExecuterId"
);
b
.
HasIndex
(
"ProjectStatusId"
);
b
.
HasIndex
(
"ProjectTypeId"
);
b
.
HasIndex
(
"ProposerId"
);
b
.
HasIndex
(
"TeamLeaderId"
);
b
.
ToTable
(
"Projects"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Attachment"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"AttachmenDescription"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"AttachmentName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"AttachmentUrl"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
?>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ProjectId"
);
b
.
ToTable
(
"Attachment"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.ProjectStatus"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Code"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"Details"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"ProjectStatus"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Steps.Entities.Item"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"ItemDescription"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"ItemName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
?>(
"StepId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"StepId"
);
b
.
ToTable
(
"Items"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Steps.Entities.Step"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Description"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"Duration"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
DateTime
>(
"StartDate"
)
.
HasColumnType
(
"datetime2"
);
b
.
Property
<
string
>(
"StepName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
?>(
"TrackId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ProjectId"
);
b
.
HasIndex
(
"TrackId"
);
b
.
ToTable
(
"Steps"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.EmployeeWork"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"ContributingRatio"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"EmployeeId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"EmployeeWorkId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"HoursWorked"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"Notes"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"StepTrackId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"EmployeeId"
);
b
.
HasIndex
(
"StepTrackId"
);
b
.
ToTable
(
"EmployeeWorks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.StepTrack"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"StepId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"TrackId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"StepId"
);
b
.
HasIndex
(
"TrackId"
);
b
.
ToTable
(
"StepTracks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Track"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
DateTime
>(
"TrackDate"
)
.
HasColumnType
(
"datetime2"
);
b
.
Property
<
string
>(
"TrackNote"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ProjectId"
);
b
.
ToTable
(
"Tracks"
);
});
modelBuilder
.
Entity
(
"PermissionRole"
,
b
=>
{
b
.
Property
<
int
>(
"PermissionsId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"RolesId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"PermissionsId"
,
"RolesId"
);
b
.
HasIndex
(
"RolesId"
);
b
.
ToTable
(
"PermissionRole"
);
});
modelBuilder
.
Entity
(
"RoleUser"
,
b
=>
{
b
.
Property
<
int
>(
"RolesId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"UsersId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"RolesId"
,
"UsersId"
);
b
.
HasIndex
(
"UsersId"
);
b
.
ToTable
(
"RoleUser"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Customers.Aggregate.Customer"
,
b
=>
{
b
.
OwnsMany
(
"PSManagement.Domain.Customers.Entities.ContactInfo"
,
"ContactInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"CustomerId"
)
.
HasColumnType
(
"int"
);
b1
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"ContactType"
)
.
HasColumnType
(
"nvarchar(max)"
);
b1
.
Property
<
string
>(
"ContactValue"
)
.
HasColumnType
(
"nvarchar(max)"
);
b1
.
HasKey
(
"CustomerId"
,
"Id"
);
b1
.
ToTable
(
"ContactInfo"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"CustomerId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Customers.ValueObjects.Address"
,
"Address"
,
b1
=>
{
b1
.
Property
<
int
>(
"CustomerId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"City"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"City"
);
b1
.
Property
<
string
>(
"StreetName"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"StreetName"
);
b1
.
Property
<
int
>(
"StreetNumber"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"StreetNumber"
);
b1
.
Property
<
int
>(
"ZipCode"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"ZipCode"
);
b1
.
HasKey
(
"CustomerId"
);
b1
.
ToTable
(
"Customers"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"CustomerId"
);
});
b
.
Navigation
(
"Address"
);
b
.
Navigation
(
"ContactInfo"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Employee"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Steps.Entities.Step"
,
null
)
.
WithMany
(
"Participants"
)
.
HasForeignKey
(
"StepId"
);
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.User"
,
"User"
)
.
WithOne
(
"Employee"
)
.
HasForeignKey
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"UserId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
OwnsOne
(
"PSManagement.Domain.Employees.Entities.Availability"
,
"Availability"
,
b1
=>
{
b1
.
Property
<
int
>(
"EmployeeId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
int
>(
"CurrentWorkingHours"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"CurrentWorkingHours"
);
b1
.
Property
<
bool
>(
"IsAvailable"
)
.
HasColumnType
(
"bit"
)
.
HasColumnName
(
"IsAvailable"
);
b1
.
HasKey
(
"EmployeeId"
);
b1
.
ToTable
(
"Employees"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"EmployeeId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Employees.Entities.PersonalInfo"
,
"PersonalInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"EmployeeId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"FirstName"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"FirstName"
);
b1
.
Property
<
string
>(
"LastName"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"LastName"
);
b1
.
HasKey
(
"EmployeeId"
);
b1
.
ToTable
(
"Employees"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"EmployeeId"
);
});
b
.
Navigation
(
"Availability"
);
b
.
Navigation
(
"PersonalInfo"
);
b
.
Navigation
(
"User"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Aggregate.Project"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Department"
,
"Executer"
)
.
WithMany
()
.
HasForeignKey
(
"ExecuterId"
);
b
.
HasOne
(
"PSManagement.Domain.Projects.Entities.ProjectStatus"
,
"ProjectStatus"
)
.
WithMany
()
.
HasForeignKey
(
"ProjectStatusId"
);
b
.
HasOne
(
"PSManagement.Domain.ProjectTypes.Entities.ProjectType"
,
"ProjectType"
)
.
WithMany
(
"Projects"
)
.
HasForeignKey
(
"ProjectTypeId"
);
b
.
HasOne
(
"PSManagement.Domain.Customers.Aggregate.Customer"
,
"Proposer"
)
.
WithMany
(
"Projects"
)
.
HasForeignKey
(
"ProposerId"
);
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"TeamLeader"
)
.
WithMany
()
.
HasForeignKey
(
"TeamLeaderId"
);
b
.
OwnsOne
(
"PSManagement.Domain.Projects.Aggregate.Aggreement"
,
"ProjectAggreement"
,
b1
=>
{
b1
.
Property
<
int
>(
"ProjectId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
DateTime
>(
"AggreementDate"
)
.
HasColumnType
(
"datetime2"
)
.
HasColumnName
(
"AggreementDate"
);
b1
.
Property
<
int
>(
"AggreementNumber"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"AggreementNumber"
);
b1
.
HasKey
(
"ProjectId"
);
b1
.
ToTable
(
"Projects"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"ProjectId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Projects.Aggregate.ProjectInfo"
,
"ProjectInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"ProjectId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"Code"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"Code"
);
b1
.
Property
<
string
>(
"Description"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"Description"
);
b1
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"Name"
);
b1
.
HasKey
(
"ProjectId"
);
b1
.
ToTable
(
"Projects"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"ProjectId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Projects.Aggregate.ProposalInfo"
,
"ProposalInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"ProjectId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
DateTime
>(
"ProposingBookDate"
)
.
HasColumnType
(
"datetime2"
)
.
HasColumnName
(
"ProposingBookDate"
);
b1
.
Property
<
int
>(
"ProposingBookNumber"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"ProposingBookNumber"
);
b1
.
HasKey
(
"ProjectId"
);
b1
.
ToTable
(
"Projects"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"ProjectId"
);
});
b
.
Navigation
(
"Executer"
);
b
.
Navigation
(
"ProjectAggreement"
);
b
.
Navigation
(
"ProjectInfo"
);
b
.
Navigation
(
"ProjectStatus"
);
b
.
Navigation
(
"ProjectType"
);
b
.
Navigation
(
"ProposalInfo"
);
b
.
Navigation
(
"Proposer"
);
b
.
Navigation
(
"TeamLeader"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Attachment"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Aggregate.Project"
,
null
)
.
WithMany
(
"Attachments"
)
.
HasForeignKey
(
"ProjectId"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Steps.Entities.Item"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Steps.Entities.Step"
,
null
)
.
WithMany
(
"Purchases"
)
.
HasForeignKey
(
"StepId"
);
b
.
OwnsOne
(
"PSManagement.SharedKernel.ValueObjects.Money"
,
"Price"
,
b1
=>
{
b1
.
Property
<
int
>(
"ItemId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
int
>(
"Ammount"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"Ammount"
);
b1
.
Property
<
string
>(
"Currency"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"Currency"
);
b1
.
HasKey
(
"ItemId"
);
b1
.
ToTable
(
"Items"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"ItemId"
);
});
b
.
Navigation
(
"Price"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Steps.Entities.Step"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Aggregate.Project"
,
"Project"
)
.
WithMany
(
"Steps"
)
.
HasForeignKey
(
"ProjectId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Tracking.Track"
,
null
)
.
WithMany
(
"Steps"
)
.
HasForeignKey
(
"TrackId"
);
b
.
Navigation
(
"Project"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.EmployeeWork"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"Employee"
)
.
WithMany
(
"EmployeeWorks"
)
.
HasForeignKey
(
"EmployeeId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Tracking.Entities.StepTrack"
,
"StepTrack"
)
.
WithMany
(
"EmployeeWorks"
)
.
HasForeignKey
(
"StepTrackId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
)
.
IsRequired
();
b
.
Navigation
(
"Employee"
);
b
.
Navigation
(
"StepTrack"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.StepTrack"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Steps.Entities.Step"
,
"Step"
)
.
WithMany
(
"StepTracks"
)
.
HasForeignKey
(
"StepId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Tracking.Track"
,
"Track"
)
.
WithMany
(
"StepTracks"
)
.
HasForeignKey
(
"TrackId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
)
.
IsRequired
();
b
.
Navigation
(
"Step"
);
b
.
Navigation
(
"Track"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Track"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Aggregate.Project"
,
"Project"
)
.
WithMany
(
"Tracks"
)
.
HasForeignKey
(
"ProjectId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
)
.
IsRequired
();
b
.
Navigation
(
"Project"
);
});
modelBuilder
.
Entity
(
"PermissionRole"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.Permission"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"PermissionsId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.Role"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"RolesId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
});
modelBuilder
.
Entity
(
"RoleUser"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.Role"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"RolesId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.User"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"UsersId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Customers.Aggregate.Customer"
,
b
=>
{
b
.
Navigation
(
"Projects"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Employee"
,
b
=>
{
b
.
Navigation
(
"EmployeeWorks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Identity.Entities.User"
,
b
=>
{
b
.
Navigation
(
"Employee"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.ProjectTypes.Entities.ProjectType"
,
b
=>
{
b
.
Navigation
(
"Projects"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Aggregate.Project"
,
b
=>
{
b
.
Navigation
(
"Attachments"
);
b
.
Navigation
(
"Steps"
);
b
.
Navigation
(
"Tracks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Steps.Entities.Step"
,
b
=>
{
b
.
Navigation
(
"Participants"
);
b
.
Navigation
(
"Purchases"
);
b
.
Navigation
(
"StepTracks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.StepTrack"
,
b
=>
{
b
.
Navigation
(
"EmployeeWorks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Track"
,
b
=>
{
b
.
Navigation
(
"Steps"
);
b
.
Navigation
(
"StepTracks"
);
});
#pragma warning restore 612, 618
}
}
}
PSManagement.Infrastructure.Persistence/Migrations/20240803190751_AddDomains5.cs
deleted
100644 → 0
View file @
17a7a1c9
using
Microsoft.EntityFrameworkCore.Migrations
;
namespace
PSManagement.Infrastructure.Persistence.Migrations
{
public
partial
class
AddDomains5
:
Migration
{
protected
override
void
Up
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
AddColumn
<
int
>(
name
:
"ProjectStatusId"
,
table
:
"Projects"
,
type
:
"int"
,
nullable
:
true
);
migrationBuilder
.
CreateTable
(
name
:
"Attachment"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
.
Annotation
(
"SqlServer:Identity"
,
"1, 1"
),
AttachmentUrl
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
),
AttachmentName
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
),
AttachmenDescription
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
),
ProjectId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
true
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_Attachment"
,
x
=>
x
.
Id
);
table
.
ForeignKey
(
name
:
"FK_Attachment_Projects_ProjectId"
,
column
:
x
=>
x
.
ProjectId
,
principalTable
:
"Projects"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Restrict
);
});
migrationBuilder
.
CreateTable
(
name
:
"ProjectStatus"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
.
Annotation
(
"SqlServer:Identity"
,
"1, 1"
),
Name
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
),
Details
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
),
Code
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_ProjectStatus"
,
x
=>
x
.
Id
);
});
migrationBuilder
.
CreateIndex
(
name
:
"IX_Projects_ProjectStatusId"
,
table
:
"Projects"
,
column
:
"ProjectStatusId"
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_Attachment_ProjectId"
,
table
:
"Attachment"
,
column
:
"ProjectId"
);
migrationBuilder
.
AddForeignKey
(
name
:
"FK_Projects_ProjectStatus_ProjectStatusId"
,
table
:
"Projects"
,
column
:
"ProjectStatusId"
,
principalTable
:
"ProjectStatus"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Restrict
);
}
protected
override
void
Down
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
DropForeignKey
(
name
:
"FK_Projects_ProjectStatus_ProjectStatusId"
,
table
:
"Projects"
);
migrationBuilder
.
DropTable
(
name
:
"Attachment"
);
migrationBuilder
.
DropTable
(
name
:
"ProjectStatus"
);
migrationBuilder
.
DropIndex
(
name
:
"IX_Projects_ProjectStatusId"
,
table
:
"Projects"
);
migrationBuilder
.
DropColumn
(
name
:
"ProjectStatusId"
,
table
:
"Projects"
);
}
}
}
PSManagement.Infrastructure.Persistence/Migrations/20240803191817_AddDomains6.Designer.cs
deleted
100644 → 0
View file @
17a7a1c9
// <auto-generated />
using
System
;
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Infrastructure
;
using
Microsoft.EntityFrameworkCore.Metadata
;
using
Microsoft.EntityFrameworkCore.Migrations
;
using
Microsoft.EntityFrameworkCore.Storage.ValueConversion
;
using
PSManagement.Infrastructure.Persistence
;
namespace
PSManagement.Infrastructure.Persistence.Migrations
{
[
DbContext
(
typeof
(
AppDbContext
))]
[
Migration
(
"20240803191817_AddDomains6"
)]
partial
class
AddDomains6
{
protected
override
void
BuildTargetModel
(
ModelBuilder
modelBuilder
)
{
#pragma warning disable 612, 618
modelBuilder
.
HasAnnotation
(
"Relational:Collation"
,
"Arabic_CI_AS"
)
.
HasAnnotation
(
"Relational:MaxIdentifierLength"
,
128
)
.
HasAnnotation
(
"ProductVersion"
,
"5.0.17"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
modelBuilder
.
Entity
(
"PSManagement.Domain.Customers.Aggregate.Customer"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"CustomerName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"Email"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Customers"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Department"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Departments"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Employee"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"HIASTId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"StepId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"UserId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"StepId"
);
b
.
HasIndex
(
"UserId"
)
.
IsUnique
();
b
.
ToTable
(
"Employees"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Identity.Entities.Permission"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Permission"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Identity.Entities.Role"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Roles"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Identity.Entities.User"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Email"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"HashedPassword"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"UserName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Users"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.ProjectTypes.Entities.ProjectType"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Description"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"TypeName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"WorkerCount"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"ProjectType"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Aggregate.Project"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
?>(
"ExecuterId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"ProjectStatusId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"ProjectTypeId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"ProposerId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"TeamLeaderId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ExecuterId"
);
b
.
HasIndex
(
"ProjectStatusId"
);
b
.
HasIndex
(
"ProjectTypeId"
);
b
.
HasIndex
(
"ProposerId"
);
b
.
HasIndex
(
"TeamLeaderId"
);
b
.
ToTable
(
"Projects"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Attachment"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"AttachmenDescription"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"AttachmentName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"AttachmentUrl"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
?>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ProjectId"
);
b
.
ToTable
(
"Attachment"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.ProjectStatus"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Code"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"Details"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"ProjectStatus"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Steps.Entities.Item"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"ItemDescription"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"ItemName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
?>(
"StepId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"StepId"
);
b
.
ToTable
(
"Items"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Steps.Entities.Step"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Description"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"Duration"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
DateTime
>(
"StartDate"
)
.
HasColumnType
(
"datetime2"
);
b
.
Property
<
string
>(
"StepName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ProjectId"
);
b
.
ToTable
(
"Steps"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.EmployeeWork"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"ContributingRatio"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"EmployeeId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"EmployeeWorkId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"HoursWorked"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"Notes"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"StepTrackId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"EmployeeId"
);
b
.
HasIndex
(
"StepTrackId"
);
b
.
ToTable
(
"EmployeeWorks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.StepTrack"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"StepId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"TrackId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"StepId"
);
b
.
HasIndex
(
"TrackId"
);
b
.
ToTable
(
"StepTracks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Track"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
DateTime
>(
"TrackDate"
)
.
HasColumnType
(
"datetime2"
);
b
.
Property
<
string
>(
"TrackNote"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ProjectId"
);
b
.
ToTable
(
"Tracks"
);
});
modelBuilder
.
Entity
(
"PermissionRole"
,
b
=>
{
b
.
Property
<
int
>(
"PermissionsId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"RolesId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"PermissionsId"
,
"RolesId"
);
b
.
HasIndex
(
"RolesId"
);
b
.
ToTable
(
"PermissionRole"
);
});
modelBuilder
.
Entity
(
"RoleUser"
,
b
=>
{
b
.
Property
<
int
>(
"RolesId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"UsersId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"RolesId"
,
"UsersId"
);
b
.
HasIndex
(
"UsersId"
);
b
.
ToTable
(
"RoleUser"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Customers.Aggregate.Customer"
,
b
=>
{
b
.
OwnsMany
(
"PSManagement.Domain.Customers.Entities.ContactInfo"
,
"ContactInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"CustomerId"
)
.
HasColumnType
(
"int"
);
b1
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"ContactType"
)
.
HasColumnType
(
"nvarchar(max)"
);
b1
.
Property
<
string
>(
"ContactValue"
)
.
HasColumnType
(
"nvarchar(max)"
);
b1
.
HasKey
(
"CustomerId"
,
"Id"
);
b1
.
ToTable
(
"ContactInfo"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"CustomerId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Customers.ValueObjects.Address"
,
"Address"
,
b1
=>
{
b1
.
Property
<
int
>(
"CustomerId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"City"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"City"
);
b1
.
Property
<
string
>(
"StreetName"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"StreetName"
);
b1
.
Property
<
int
>(
"StreetNumber"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"StreetNumber"
);
b1
.
Property
<
int
>(
"ZipCode"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"ZipCode"
);
b1
.
HasKey
(
"CustomerId"
);
b1
.
ToTable
(
"Customers"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"CustomerId"
);
});
b
.
Navigation
(
"Address"
);
b
.
Navigation
(
"ContactInfo"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Employee"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Steps.Entities.Step"
,
null
)
.
WithMany
(
"Participants"
)
.
HasForeignKey
(
"StepId"
);
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.User"
,
"User"
)
.
WithOne
(
"Employee"
)
.
HasForeignKey
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"UserId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
OwnsOne
(
"PSManagement.Domain.Employees.Entities.Availability"
,
"Availability"
,
b1
=>
{
b1
.
Property
<
int
>(
"EmployeeId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
int
>(
"CurrentWorkingHours"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"CurrentWorkingHours"
);
b1
.
Property
<
bool
>(
"IsAvailable"
)
.
HasColumnType
(
"bit"
)
.
HasColumnName
(
"IsAvailable"
);
b1
.
HasKey
(
"EmployeeId"
);
b1
.
ToTable
(
"Employees"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"EmployeeId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Employees.Entities.PersonalInfo"
,
"PersonalInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"EmployeeId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"FirstName"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"FirstName"
);
b1
.
Property
<
string
>(
"LastName"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"LastName"
);
b1
.
HasKey
(
"EmployeeId"
);
b1
.
ToTable
(
"Employees"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"EmployeeId"
);
});
b
.
Navigation
(
"Availability"
);
b
.
Navigation
(
"PersonalInfo"
);
b
.
Navigation
(
"User"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Aggregate.Project"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Department"
,
"Executer"
)
.
WithMany
()
.
HasForeignKey
(
"ExecuterId"
);
b
.
HasOne
(
"PSManagement.Domain.Projects.Entities.ProjectStatus"
,
"ProjectStatus"
)
.
WithMany
()
.
HasForeignKey
(
"ProjectStatusId"
);
b
.
HasOne
(
"PSManagement.Domain.ProjectTypes.Entities.ProjectType"
,
"ProjectType"
)
.
WithMany
(
"Projects"
)
.
HasForeignKey
(
"ProjectTypeId"
);
b
.
HasOne
(
"PSManagement.Domain.Customers.Aggregate.Customer"
,
"Proposer"
)
.
WithMany
(
"Projects"
)
.
HasForeignKey
(
"ProposerId"
);
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"TeamLeader"
)
.
WithMany
()
.
HasForeignKey
(
"TeamLeaderId"
);
b
.
OwnsOne
(
"PSManagement.Domain.Projects.Aggregate.Aggreement"
,
"ProjectAggreement"
,
b1
=>
{
b1
.
Property
<
int
>(
"ProjectId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
DateTime
>(
"AggreementDate"
)
.
HasColumnType
(
"datetime2"
)
.
HasColumnName
(
"AggreementDate"
);
b1
.
Property
<
int
>(
"AggreementNumber"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"AggreementNumber"
);
b1
.
HasKey
(
"ProjectId"
);
b1
.
ToTable
(
"Projects"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"ProjectId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Projects.Aggregate.ProjectInfo"
,
"ProjectInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"ProjectId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"Code"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"Code"
);
b1
.
Property
<
string
>(
"Description"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"Description"
);
b1
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"Name"
);
b1
.
HasKey
(
"ProjectId"
);
b1
.
ToTable
(
"Projects"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"ProjectId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Projects.Aggregate.ProposalInfo"
,
"ProposalInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"ProjectId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
DateTime
>(
"ProposingBookDate"
)
.
HasColumnType
(
"datetime2"
)
.
HasColumnName
(
"ProposingBookDate"
);
b1
.
Property
<
int
>(
"ProposingBookNumber"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"ProposingBookNumber"
);
b1
.
HasKey
(
"ProjectId"
);
b1
.
ToTable
(
"Projects"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"ProjectId"
);
});
b
.
Navigation
(
"Executer"
);
b
.
Navigation
(
"ProjectAggreement"
);
b
.
Navigation
(
"ProjectInfo"
);
b
.
Navigation
(
"ProjectStatus"
);
b
.
Navigation
(
"ProjectType"
);
b
.
Navigation
(
"ProposalInfo"
);
b
.
Navigation
(
"Proposer"
);
b
.
Navigation
(
"TeamLeader"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Attachment"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Aggregate.Project"
,
null
)
.
WithMany
(
"Attachments"
)
.
HasForeignKey
(
"ProjectId"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Steps.Entities.Item"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Steps.Entities.Step"
,
null
)
.
WithMany
(
"Purchases"
)
.
HasForeignKey
(
"StepId"
);
b
.
OwnsOne
(
"PSManagement.SharedKernel.ValueObjects.Money"
,
"Price"
,
b1
=>
{
b1
.
Property
<
int
>(
"ItemId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
int
>(
"Ammount"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"Ammount"
);
b1
.
Property
<
string
>(
"Currency"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"Currency"
);
b1
.
HasKey
(
"ItemId"
);
b1
.
ToTable
(
"Items"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"ItemId"
);
});
b
.
Navigation
(
"Price"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Steps.Entities.Step"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Aggregate.Project"
,
"Project"
)
.
WithMany
(
"Steps"
)
.
HasForeignKey
(
"ProjectId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
Navigation
(
"Project"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.EmployeeWork"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"Employee"
)
.
WithMany
(
"EmployeeWorks"
)
.
HasForeignKey
(
"EmployeeId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Tracking.Entities.StepTrack"
,
"StepTrack"
)
.
WithMany
(
"EmployeeWorks"
)
.
HasForeignKey
(
"StepTrackId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
)
.
IsRequired
();
b
.
Navigation
(
"Employee"
);
b
.
Navigation
(
"StepTrack"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.StepTrack"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Steps.Entities.Step"
,
"Step"
)
.
WithMany
(
"StepTracks"
)
.
HasForeignKey
(
"StepId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Tracking.Track"
,
"Track"
)
.
WithMany
(
"StepTracks"
)
.
HasForeignKey
(
"TrackId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
)
.
IsRequired
();
b
.
Navigation
(
"Step"
);
b
.
Navigation
(
"Track"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Track"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Aggregate.Project"
,
"Project"
)
.
WithMany
(
"Tracks"
)
.
HasForeignKey
(
"ProjectId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
)
.
IsRequired
();
b
.
Navigation
(
"Project"
);
});
modelBuilder
.
Entity
(
"PermissionRole"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.Permission"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"PermissionsId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.Role"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"RolesId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
});
modelBuilder
.
Entity
(
"RoleUser"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.Role"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"RolesId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.User"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"UsersId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Customers.Aggregate.Customer"
,
b
=>
{
b
.
Navigation
(
"Projects"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Employee"
,
b
=>
{
b
.
Navigation
(
"EmployeeWorks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Identity.Entities.User"
,
b
=>
{
b
.
Navigation
(
"Employee"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.ProjectTypes.Entities.ProjectType"
,
b
=>
{
b
.
Navigation
(
"Projects"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Aggregate.Project"
,
b
=>
{
b
.
Navigation
(
"Attachments"
);
b
.
Navigation
(
"Steps"
);
b
.
Navigation
(
"Tracks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Steps.Entities.Step"
,
b
=>
{
b
.
Navigation
(
"Participants"
);
b
.
Navigation
(
"Purchases"
);
b
.
Navigation
(
"StepTracks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.StepTrack"
,
b
=>
{
b
.
Navigation
(
"EmployeeWorks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Track"
,
b
=>
{
b
.
Navigation
(
"StepTracks"
);
});
#pragma warning restore 612, 618
}
}
}
PSManagement.Infrastructure.Persistence/Migrations/20240803192350_AddDomains7.Designer.cs
deleted
100644 → 0
View file @
17a7a1c9
// <auto-generated />
using
System
;
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Infrastructure
;
using
Microsoft.EntityFrameworkCore.Metadata
;
using
Microsoft.EntityFrameworkCore.Migrations
;
using
Microsoft.EntityFrameworkCore.Storage.ValueConversion
;
using
PSManagement.Infrastructure.Persistence
;
namespace
PSManagement.Infrastructure.Persistence.Migrations
{
[
DbContext
(
typeof
(
AppDbContext
))]
[
Migration
(
"20240803192350_AddDomains7"
)]
partial
class
AddDomains7
{
protected
override
void
BuildTargetModel
(
ModelBuilder
modelBuilder
)
{
#pragma warning disable 612, 618
modelBuilder
.
HasAnnotation
(
"Relational:Collation"
,
"Arabic_CI_AS"
)
.
HasAnnotation
(
"Relational:MaxIdentifierLength"
,
128
)
.
HasAnnotation
(
"ProductVersion"
,
"5.0.17"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
modelBuilder
.
Entity
(
"PSManagement.Domain.Customers.Aggregate.Customer"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"CustomerName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"Email"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Customers"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Department"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Departments"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Employee"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"HIASTId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"StepId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"UserId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"StepId"
);
b
.
HasIndex
(
"UserId"
)
.
IsUnique
();
b
.
ToTable
(
"Employees"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Identity.Entities.Permission"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Permission"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Identity.Entities.Role"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Roles"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Identity.Entities.User"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Email"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"HashedPassword"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"UserName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Users"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.ProjectTypes.Entities.ProjectType"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Description"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"TypeName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"WorkerCount"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"ProjectType"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Aggregate.Project"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
?>(
"ExecuterId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"ProjectStatusId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"ProjectTypeId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"ProposerId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"TeamLeaderId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ExecuterId"
);
b
.
HasIndex
(
"ProjectStatusId"
);
b
.
HasIndex
(
"ProjectTypeId"
);
b
.
HasIndex
(
"ProposerId"
);
b
.
HasIndex
(
"TeamLeaderId"
);
b
.
ToTable
(
"Projects"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Attachment"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"AttachmenDescription"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"AttachmentName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"AttachmentUrl"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
?>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ProjectId"
);
b
.
ToTable
(
"Attachment"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.ProjectStatus"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Code"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"Details"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"ProjectStatus"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Steps.Entities.Item"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"ItemDescription"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"ItemName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
?>(
"StepId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"StepId"
);
b
.
ToTable
(
"Items"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Steps.Entities.Step"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Description"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"Duration"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
DateTime
>(
"StartDate"
)
.
HasColumnType
(
"datetime2"
);
b
.
Property
<
string
>(
"StepName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ProjectId"
);
b
.
ToTable
(
"Steps"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.EmployeeWork"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"ContributingRatio"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"EmployeeId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"EmployeeWorkId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"HoursWorked"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"Notes"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"StepTrackId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"EmployeeId"
);
b
.
HasIndex
(
"StepTrackId"
);
b
.
ToTable
(
"EmployeeWorks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.StepTrack"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"StepId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"TrackId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"StepId"
);
b
.
HasIndex
(
"TrackId"
);
b
.
ToTable
(
"StepTracks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Track"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
DateTime
>(
"TrackDate"
)
.
HasColumnType
(
"datetime2"
);
b
.
Property
<
string
>(
"TrackNote"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ProjectId"
);
b
.
ToTable
(
"Tracks"
);
});
modelBuilder
.
Entity
(
"PermissionRole"
,
b
=>
{
b
.
Property
<
int
>(
"PermissionsId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"RolesId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"PermissionsId"
,
"RolesId"
);
b
.
HasIndex
(
"RolesId"
);
b
.
ToTable
(
"PermissionRole"
);
});
modelBuilder
.
Entity
(
"RoleUser"
,
b
=>
{
b
.
Property
<
int
>(
"RolesId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"UsersId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"RolesId"
,
"UsersId"
);
b
.
HasIndex
(
"UsersId"
);
b
.
ToTable
(
"RoleUser"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Customers.Aggregate.Customer"
,
b
=>
{
b
.
OwnsMany
(
"PSManagement.Domain.Customers.Entities.ContactInfo"
,
"ContactInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"CustomerId"
)
.
HasColumnType
(
"int"
);
b1
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"ContactType"
)
.
HasColumnType
(
"nvarchar(max)"
);
b1
.
Property
<
string
>(
"ContactValue"
)
.
HasColumnType
(
"nvarchar(max)"
);
b1
.
HasKey
(
"CustomerId"
,
"Id"
);
b1
.
ToTable
(
"ContactInfo"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"CustomerId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Customers.ValueObjects.Address"
,
"Address"
,
b1
=>
{
b1
.
Property
<
int
>(
"CustomerId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"City"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"City"
);
b1
.
Property
<
string
>(
"StreetName"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"StreetName"
);
b1
.
Property
<
int
>(
"StreetNumber"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"StreetNumber"
);
b1
.
Property
<
int
>(
"ZipCode"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"ZipCode"
);
b1
.
HasKey
(
"CustomerId"
);
b1
.
ToTable
(
"Customers"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"CustomerId"
);
});
b
.
Navigation
(
"Address"
);
b
.
Navigation
(
"ContactInfo"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Employee"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Steps.Entities.Step"
,
null
)
.
WithMany
(
"Participants"
)
.
HasForeignKey
(
"StepId"
);
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.User"
,
"User"
)
.
WithOne
(
"Employee"
)
.
HasForeignKey
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"UserId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
OwnsOne
(
"PSManagement.Domain.Employees.Entities.Availability"
,
"Availability"
,
b1
=>
{
b1
.
Property
<
int
>(
"EmployeeId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
int
>(
"CurrentWorkingHours"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"CurrentWorkingHours"
);
b1
.
Property
<
bool
>(
"IsAvailable"
)
.
HasColumnType
(
"bit"
)
.
HasColumnName
(
"IsAvailable"
);
b1
.
HasKey
(
"EmployeeId"
);
b1
.
ToTable
(
"Employees"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"EmployeeId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Employees.Entities.PersonalInfo"
,
"PersonalInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"EmployeeId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"FirstName"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"FirstName"
);
b1
.
Property
<
string
>(
"LastName"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"LastName"
);
b1
.
HasKey
(
"EmployeeId"
);
b1
.
ToTable
(
"Employees"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"EmployeeId"
);
});
b
.
Navigation
(
"Availability"
);
b
.
Navigation
(
"PersonalInfo"
);
b
.
Navigation
(
"User"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Aggregate.Project"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Department"
,
"Executer"
)
.
WithMany
()
.
HasForeignKey
(
"ExecuterId"
);
b
.
HasOne
(
"PSManagement.Domain.Projects.Entities.ProjectStatus"
,
"ProjectStatus"
)
.
WithMany
()
.
HasForeignKey
(
"ProjectStatusId"
);
b
.
HasOne
(
"PSManagement.Domain.ProjectTypes.Entities.ProjectType"
,
"ProjectType"
)
.
WithMany
(
"Projects"
)
.
HasForeignKey
(
"ProjectTypeId"
);
b
.
HasOne
(
"PSManagement.Domain.Customers.Aggregate.Customer"
,
"Proposer"
)
.
WithMany
(
"Projects"
)
.
HasForeignKey
(
"ProposerId"
);
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"TeamLeader"
)
.
WithMany
()
.
HasForeignKey
(
"TeamLeaderId"
);
b
.
OwnsOne
(
"PSManagement.Domain.Projects.Aggregate.Aggreement"
,
"ProjectAggreement"
,
b1
=>
{
b1
.
Property
<
int
>(
"ProjectId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
DateTime
>(
"AggreementDate"
)
.
HasColumnType
(
"datetime2"
)
.
HasColumnName
(
"AggreementDate"
);
b1
.
Property
<
int
>(
"AggreementNumber"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"AggreementNumber"
);
b1
.
HasKey
(
"ProjectId"
);
b1
.
ToTable
(
"Projects"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"ProjectId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Projects.Aggregate.ProjectInfo"
,
"ProjectInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"ProjectId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"Code"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"Code"
);
b1
.
Property
<
string
>(
"Description"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"Description"
);
b1
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"Name"
);
b1
.
HasKey
(
"ProjectId"
);
b1
.
ToTable
(
"Projects"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"ProjectId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Projects.Aggregate.ProposalInfo"
,
"ProposalInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"ProjectId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
DateTime
>(
"ProposingBookDate"
)
.
HasColumnType
(
"datetime2"
)
.
HasColumnName
(
"ProposingBookDate"
);
b1
.
Property
<
int
>(
"ProposingBookNumber"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"ProposingBookNumber"
);
b1
.
HasKey
(
"ProjectId"
);
b1
.
ToTable
(
"Projects"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"ProjectId"
);
});
b
.
Navigation
(
"Executer"
);
b
.
Navigation
(
"ProjectAggreement"
);
b
.
Navigation
(
"ProjectInfo"
);
b
.
Navigation
(
"ProjectStatus"
);
b
.
Navigation
(
"ProjectType"
);
b
.
Navigation
(
"ProposalInfo"
);
b
.
Navigation
(
"Proposer"
);
b
.
Navigation
(
"TeamLeader"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Attachment"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Aggregate.Project"
,
null
)
.
WithMany
(
"Attachments"
)
.
HasForeignKey
(
"ProjectId"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Steps.Entities.Item"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Steps.Entities.Step"
,
null
)
.
WithMany
(
"Purchases"
)
.
HasForeignKey
(
"StepId"
);
b
.
OwnsOne
(
"PSManagement.SharedKernel.ValueObjects.Money"
,
"Price"
,
b1
=>
{
b1
.
Property
<
int
>(
"ItemId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
int
>(
"Ammount"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"Ammount"
);
b1
.
Property
<
string
>(
"Currency"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"Currency"
);
b1
.
HasKey
(
"ItemId"
);
b1
.
ToTable
(
"Items"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"ItemId"
);
});
b
.
Navigation
(
"Price"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Steps.Entities.Step"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Aggregate.Project"
,
"Project"
)
.
WithMany
(
"Steps"
)
.
HasForeignKey
(
"ProjectId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
Navigation
(
"Project"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.EmployeeWork"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"Employee"
)
.
WithMany
(
"EmployeeWorks"
)
.
HasForeignKey
(
"EmployeeId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Tracking.Entities.StepTrack"
,
"StepTrack"
)
.
WithMany
(
"EmployeeWorks"
)
.
HasForeignKey
(
"StepTrackId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
)
.
IsRequired
();
b
.
Navigation
(
"Employee"
);
b
.
Navigation
(
"StepTrack"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.StepTrack"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Steps.Entities.Step"
,
"Step"
)
.
WithMany
(
"StepTracks"
)
.
HasForeignKey
(
"StepId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Tracking.Track"
,
"Track"
)
.
WithMany
(
"StepTracks"
)
.
HasForeignKey
(
"TrackId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
)
.
IsRequired
();
b
.
Navigation
(
"Step"
);
b
.
Navigation
(
"Track"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Track"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Aggregate.Project"
,
"Project"
)
.
WithMany
(
"Tracks"
)
.
HasForeignKey
(
"ProjectId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
)
.
IsRequired
();
b
.
Navigation
(
"Project"
);
});
modelBuilder
.
Entity
(
"PermissionRole"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.Permission"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"PermissionsId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.Role"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"RolesId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
});
modelBuilder
.
Entity
(
"RoleUser"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.Role"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"RolesId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.User"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"UsersId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Customers.Aggregate.Customer"
,
b
=>
{
b
.
Navigation
(
"Projects"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Employee"
,
b
=>
{
b
.
Navigation
(
"EmployeeWorks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Identity.Entities.User"
,
b
=>
{
b
.
Navigation
(
"Employee"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.ProjectTypes.Entities.ProjectType"
,
b
=>
{
b
.
Navigation
(
"Projects"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Aggregate.Project"
,
b
=>
{
b
.
Navigation
(
"Attachments"
);
b
.
Navigation
(
"Steps"
);
b
.
Navigation
(
"Tracks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Steps.Entities.Step"
,
b
=>
{
b
.
Navigation
(
"Participants"
);
b
.
Navigation
(
"Purchases"
);
b
.
Navigation
(
"StepTracks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.StepTrack"
,
b
=>
{
b
.
Navigation
(
"EmployeeWorks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Track"
,
b
=>
{
b
.
Navigation
(
"StepTracks"
);
});
#pragma warning restore 612, 618
}
}
}
PSManagement.Infrastructure.Persistence/Migrations/20240803192350_AddDomains7.cs
deleted
100644 → 0
View file @
17a7a1c9
using
Microsoft.EntityFrameworkCore.Migrations
;
namespace
PSManagement.Infrastructure.Persistence.Migrations
{
public
partial
class
AddDomains7
:
Migration
{
protected
override
void
Up
(
MigrationBuilder
migrationBuilder
)
{
}
protected
override
void
Down
(
MigrationBuilder
migrationBuilder
)
{
}
}
}
PSManagement.Infrastructure.Persistence/Migrations/20240806062155_AddDomainUpdate.cs
deleted
100644 → 0
View file @
17a7a1c9
using
Microsoft.EntityFrameworkCore.Migrations
;
namespace
PSManagement.Infrastructure.Persistence.Migrations
{
public
partial
class
AddDomainUpdate
:
Migration
{
protected
override
void
Up
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
DropForeignKey
(
name
:
"FK_Employees_Steps_StepId"
,
table
:
"Employees"
);
migrationBuilder
.
DropForeignKey
(
name
:
"FK_EmployeeWorks_Employees_EmployeeId"
,
table
:
"EmployeeWorks"
);
migrationBuilder
.
DropForeignKey
(
name
:
"FK_EmployeeWorks_StepTracks_StepTrackId"
,
table
:
"EmployeeWorks"
);
migrationBuilder
.
DropForeignKey
(
name
:
"FK_Items_Steps_StepId"
,
table
:
"Items"
);
migrationBuilder
.
DropIndex
(
name
:
"IX_Items_StepId"
,
table
:
"Items"
);
migrationBuilder
.
DropColumn
(
name
:
"StepId"
,
table
:
"Items"
);
migrationBuilder
.
RenameColumn
(
name
:
"StepId"
,
table
:
"Employees"
,
newName
:
"TrackId"
);
migrationBuilder
.
RenameIndex
(
name
:
"IX_Employees_StepId"
,
table
:
"Employees"
,
newName
:
"IX_Employees_TrackId"
);
migrationBuilder
.
AddColumn
<
int
>(
name
:
"ExecutionRatio"
,
table
:
"StepTracks"
,
type
:
"int"
,
nullable
:
false
,
defaultValue
:
0
);
migrationBuilder
.
AddColumn
<
int
>(
name
:
"CurrentCompletionRatio"
,
table
:
"Steps"
,
type
:
"int"
,
nullable
:
false
,
defaultValue
:
0
);
migrationBuilder
.
AddColumn
<
int
>(
name
:
"Weight"
,
table
:
"Steps"
,
type
:
"int"
,
nullable
:
false
,
defaultValue
:
0
);
migrationBuilder
.
CreateTable
(
name
:
"EmployeeParticipate"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
.
Annotation
(
"SqlServer:Identity"
,
"1, 1"
),
EmployeeId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
ProjectId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
PartialTimeRatio
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
Role
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_EmployeeParticipate"
,
x
=>
x
.
Id
);
table
.
ForeignKey
(
name
:
"FK_EmployeeParticipate_Employees_EmployeeId"
,
column
:
x
=>
x
.
EmployeeId
,
principalTable
:
"Employees"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Cascade
);
table
.
ForeignKey
(
name
:
"FK_EmployeeParticipate_Projects_ProjectId"
,
column
:
x
=>
x
.
ProjectId
,
principalTable
:
"Projects"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Cascade
);
});
migrationBuilder
.
CreateTable
(
name
:
"EmployeeTrack"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
.
Annotation
(
"SqlServer:Identity"
,
"1, 1"
),
EmloyeeId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
TrackId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
WorkingHours
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
PerformedWork
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
),
AssignedWork
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_EmployeeTrack"
,
x
=>
x
.
Id
);
table
.
ForeignKey
(
name
:
"FK_EmployeeTrack_Employees_EmloyeeId"
,
column
:
x
=>
x
.
EmloyeeId
,
principalTable
:
"Employees"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Cascade
);
table
.
ForeignKey
(
name
:
"FK_EmployeeTrack_Tracks_TrackId"
,
column
:
x
=>
x
.
TrackId
,
principalTable
:
"Tracks"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Cascade
);
});
migrationBuilder
.
CreateIndex
(
name
:
"IX_EmployeeParticipate_EmployeeId"
,
table
:
"EmployeeParticipate"
,
column
:
"EmployeeId"
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_EmployeeParticipate_ProjectId"
,
table
:
"EmployeeParticipate"
,
column
:
"ProjectId"
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_EmployeeTrack_EmloyeeId"
,
table
:
"EmployeeTrack"
,
column
:
"EmloyeeId"
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_EmployeeTrack_TrackId"
,
table
:
"EmployeeTrack"
,
column
:
"TrackId"
);
migrationBuilder
.
AddForeignKey
(
name
:
"FK_Employees_Tracks_TrackId"
,
table
:
"Employees"
,
column
:
"TrackId"
,
principalTable
:
"Tracks"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Restrict
);
migrationBuilder
.
AddForeignKey
(
name
:
"FK_EmployeeWorks_Employees_EmployeeId"
,
table
:
"EmployeeWorks"
,
column
:
"EmployeeId"
,
principalTable
:
"Employees"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Cascade
);
migrationBuilder
.
AddForeignKey
(
name
:
"FK_EmployeeWorks_StepTracks_StepTrackId"
,
table
:
"EmployeeWorks"
,
column
:
"StepTrackId"
,
principalTable
:
"StepTracks"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Cascade
);
}
protected
override
void
Down
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
DropForeignKey
(
name
:
"FK_Employees_Tracks_TrackId"
,
table
:
"Employees"
);
migrationBuilder
.
DropForeignKey
(
name
:
"FK_EmployeeWorks_Employees_EmployeeId"
,
table
:
"EmployeeWorks"
);
migrationBuilder
.
DropForeignKey
(
name
:
"FK_EmployeeWorks_StepTracks_StepTrackId"
,
table
:
"EmployeeWorks"
);
migrationBuilder
.
DropTable
(
name
:
"EmployeeParticipate"
);
migrationBuilder
.
DropTable
(
name
:
"EmployeeTrack"
);
migrationBuilder
.
DropColumn
(
name
:
"ExecutionRatio"
,
table
:
"StepTracks"
);
migrationBuilder
.
DropColumn
(
name
:
"CurrentCompletionRatio"
,
table
:
"Steps"
);
migrationBuilder
.
DropColumn
(
name
:
"Weight"
,
table
:
"Steps"
);
migrationBuilder
.
RenameColumn
(
name
:
"TrackId"
,
table
:
"Employees"
,
newName
:
"StepId"
);
migrationBuilder
.
RenameIndex
(
name
:
"IX_Employees_TrackId"
,
table
:
"Employees"
,
newName
:
"IX_Employees_StepId"
);
migrationBuilder
.
AddColumn
<
int
>(
name
:
"StepId"
,
table
:
"Items"
,
type
:
"int"
,
nullable
:
true
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_Items_StepId"
,
table
:
"Items"
,
column
:
"StepId"
);
migrationBuilder
.
AddForeignKey
(
name
:
"FK_Employees_Steps_StepId"
,
table
:
"Employees"
,
column
:
"StepId"
,
principalTable
:
"Steps"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Restrict
);
migrationBuilder
.
AddForeignKey
(
name
:
"FK_EmployeeWorks_Employees_EmployeeId"
,
table
:
"EmployeeWorks"
,
column
:
"EmployeeId"
,
principalTable
:
"Employees"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Restrict
);
migrationBuilder
.
AddForeignKey
(
name
:
"FK_EmployeeWorks_StepTracks_StepTrackId"
,
table
:
"EmployeeWorks"
,
column
:
"StepTrackId"
,
principalTable
:
"StepTracks"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Restrict
);
migrationBuilder
.
AddForeignKey
(
name
:
"FK_Items_Steps_StepId"
,
table
:
"Items"
,
column
:
"StepId"
,
principalTable
:
"Steps"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Restrict
);
}
}
}
PSManagement.Infrastructure.Persistence/Migrations/20240806132941_AddDomainUpdate3.cs
deleted
100644 → 0
View file @
17a7a1c9
using
Microsoft.EntityFrameworkCore.Migrations
;
namespace
PSManagement.Infrastructure.Persistence.Migrations
{
public
partial
class
AddDomainUpdate3
:
Migration
{
protected
override
void
Up
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
DropForeignKey
(
name
:
"FK_Projects_Employees_ProjectManagerId"
,
table
:
"Projects"
);
migrationBuilder
.
DropForeignKey
(
name
:
"FK_Projects_Employees_TeamLeaderId"
,
table
:
"Projects"
);
migrationBuilder
.
AddForeignKey
(
name
:
"FK_Projects_Employees_ProjectManagerId"
,
table
:
"Projects"
,
column
:
"ProjectManagerId"
,
principalTable
:
"Employees"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Restrict
);
migrationBuilder
.
AddForeignKey
(
name
:
"FK_Projects_Employees_TeamLeaderId"
,
table
:
"Projects"
,
column
:
"TeamLeaderId"
,
principalTable
:
"Employees"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Restrict
);
}
protected
override
void
Down
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
DropForeignKey
(
name
:
"FK_Projects_Employees_ProjectManagerId"
,
table
:
"Projects"
);
migrationBuilder
.
DropForeignKey
(
name
:
"FK_Projects_Employees_TeamLeaderId"
,
table
:
"Projects"
);
migrationBuilder
.
AddForeignKey
(
name
:
"FK_Projects_Employees_ProjectManagerId"
,
table
:
"Projects"
,
column
:
"ProjectManagerId"
,
principalTable
:
"Employees"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Cascade
);
migrationBuilder
.
AddForeignKey
(
name
:
"FK_Projects_Employees_TeamLeaderId"
,
table
:
"Projects"
,
column
:
"TeamLeaderId"
,
principalTable
:
"Employees"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Cascade
);
}
}
}
PSManagement.Infrastructure.Persistence/Migrations/20240806133359_AddDomainUpdate4.cs
deleted
100644 → 0
View file @
17a7a1c9
using
Microsoft.EntityFrameworkCore.Migrations
;
namespace
PSManagement.Infrastructure.Persistence.Migrations
{
public
partial
class
AddDomainUpdate4
:
Migration
{
protected
override
void
Up
(
MigrationBuilder
migrationBuilder
)
{
}
protected
override
void
Down
(
MigrationBuilder
migrationBuilder
)
{
}
}
}
PSManagement.Infrastructure.Persistence/Migrations/2024080
6133359_AddDomainUpdate4
.Designer.cs
→
PSManagement.Infrastructure.Persistence/Migrations/2024080
7105909_Initial
.Designer.cs
View file @
1d5f4c82
...
...
@@ -10,8 +10,8 @@ using PSManagement.Infrastructure.Persistence;
namespace
PSManagement.Infrastructure.Persistence.Migrations
{
[
DbContext
(
typeof
(
AppDbContext
))]
[
Migration
(
"2024080
6133359_AddDomainUpdate4
"
)]
partial
class
AddDomainUpdate4
[
Migration
(
"2024080
7105909_Initial
"
)]
partial
class
Initial
{
protected
override
void
BuildTargetModel
(
ModelBuilder
modelBuilder
)
{
...
...
PSManagement.Infrastructure.Persistence/Migrations/2024080
3172417_AddDomains
.cs
→
PSManagement.Infrastructure.Persistence/Migrations/2024080
7105909_Initial
.cs
View file @
1d5f4c82
...
...
@@ -3,7 +3,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
namespace
PSManagement.Infrastructure.Persistence.Migrations
{
public
partial
class
AddDomains
:
Migration
public
partial
class
Initial
:
Migration
{
protected
override
void
Up
(
MigrationBuilder
migrationBuilder
)
{
...
...
@@ -39,7 +39,23 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
});
migrationBuilder
.
CreateTable
(
name
:
"Role"
,
name
:
"Items"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
.
Annotation
(
"SqlServer:Identity"
,
"1, 1"
),
ItemName
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
),
ItemDescription
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
),
Ammount
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
true
),
Currency
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_Items"
,
x
=>
x
.
Id
);
});
migrationBuilder
.
CreateTable
(
name
:
"Permission"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
...
...
@@ -48,7 +64,35 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_Role"
,
x
=>
x
.
Id
);
table
.
PrimaryKey
(
"PK_Permission"
,
x
=>
x
.
Id
);
});
migrationBuilder
.
CreateTable
(
name
:
"ProjectStatus"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
.
Annotation
(
"SqlServer:Identity"
,
"1, 1"
),
Name
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
),
Details
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
),
Code
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_ProjectStatus"
,
x
=>
x
.
Id
);
});
migrationBuilder
.
CreateTable
(
name
:
"Roles"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
.
Annotation
(
"SqlServer:Identity"
,
"1, 1"
),
Name
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_Roles"
,
x
=>
x
.
Id
);
});
migrationBuilder
.
CreateTable
(
...
...
@@ -88,30 +132,27 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
});
migrationBuilder
.
CreateTable
(
name
:
"Permission"
,
name
:
"Permission
Role
"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
.
Annotation
(
"SqlServer:Identity"
,
"1, 1"
),
Name
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
),
PermissionId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
true
),
RoleId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
true
)
PermissionsId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
RolesId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_Permission
"
,
x
=>
x
.
Id
);
table
.
PrimaryKey
(
"PK_Permission
Role"
,
x
=>
new
{
x
.
PermissionsId
,
x
.
RolesId
}
);
table
.
ForeignKey
(
name
:
"FK_Permission
_Permission_Permission
Id"
,
column
:
x
=>
x
.
PermissionId
,
name
:
"FK_Permission
Role_Permission_Permissions
Id"
,
column
:
x
=>
x
.
Permission
s
Id
,
principalTable
:
"Permission"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Restrict
);
onDelete
:
ReferentialAction
.
Cascade
);
table
.
ForeignKey
(
name
:
"FK_Permission
_Role_Role
Id"
,
column
:
x
=>
x
.
RoleId
,
principalTable
:
"Role"
,
name
:
"FK_Permission
Role_Roles_Roles
Id"
,
column
:
x
=>
x
.
Role
s
Id
,
principalTable
:
"Role
s
"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Restrict
);
onDelete
:
ReferentialAction
.
Cascade
);
});
migrationBuilder
.
CreateTable
(
...
...
@@ -125,9 +166,9 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
{
table
.
PrimaryKey
(
"PK_RoleUser"
,
x
=>
new
{
x
.
RolesId
,
x
.
UsersId
});
table
.
ForeignKey
(
name
:
"FK_RoleUser_Role_RolesId"
,
name
:
"FK_RoleUser_Role
s
_RolesId"
,
column
:
x
=>
x
.
RolesId
,
principalTable
:
"Role"
,
principalTable
:
"Role
s
"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Cascade
);
table
.
ForeignKey
(
...
...
@@ -149,11 +190,15 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
Name
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
),
Code
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
),
Description
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
),
ProjectStatusId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
true
),
AggreementNumber
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
true
),
AggreementDate
=
table
.
Column
<
DateTime
>(
type
:
"datetime2"
,
nullable
:
true
),
TeamLeaderId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
true
),
TeamLeaderId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
ProjectManagerId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
ExecuterId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
true
),
ProposerId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
true
)
ProposerId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
true
),
FinicialStatus
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
),
FinicialSource
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
)
},
constraints
:
table
=>
{
...
...
@@ -170,23 +215,30 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
principalTable
:
"Departments"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Restrict
);
table
.
ForeignKey
(
name
:
"FK_Projects_ProjectStatus_ProjectStatusId"
,
column
:
x
=>
x
.
ProjectStatusId
,
principalTable
:
"ProjectStatus"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Restrict
);
});
migrationBuilder
.
CreateTable
(
name
:
"
Tracks
"
,
name
:
"
Attachment
"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
.
Annotation
(
"SqlServer:Identity"
,
"1, 1"
),
TrackDate
=
table
.
Column
<
DateTime
>(
type
:
"datetime2"
,
nullable
:
false
),
TrackNote
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
),
ProjectId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
AttachmentUrl
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
),
AttachmentName
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
),
AttachmenDescription
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
),
ProjectId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
true
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_
Tracks
"
,
x
=>
x
.
Id
);
table
.
PrimaryKey
(
"PK_
Attachment
"
,
x
=>
x
.
Id
);
table
.
ForeignKey
(
name
:
"FK_
Tracks
_Projects_ProjectId"
,
name
:
"FK_
Attachment
_Projects_ProjectId"
,
column
:
x
=>
x
.
ProjectId
,
principalTable
:
"Projects"
,
principalColumn
:
"Id"
,
...
...
@@ -202,9 +254,10 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
StepName
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
),
Description
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
),
Duration
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
CurrentCompletionRatio
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
Weight
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
StartDate
=
table
.
Column
<
DateTime
>(
type
:
"datetime2"
,
nullable
:
false
),
ProjectId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
TrackId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
true
)
ProjectId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
},
constraints
:
table
=>
{
...
...
@@ -215,10 +268,25 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
principalTable
:
"Projects"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Cascade
);
});
migrationBuilder
.
CreateTable
(
name
:
"Tracks"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
.
Annotation
(
"SqlServer:Identity"
,
"1, 1"
),
TrackDate
=
table
.
Column
<
DateTime
>(
type
:
"datetime2"
,
nullable
:
false
),
TrackNote
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
),
ProjectId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_Tracks"
,
x
=>
x
.
Id
);
table
.
ForeignKey
(
name
:
"FK_
Steps_Tracks_Track
Id"
,
column
:
x
=>
x
.
Track
Id
,
principalTable
:
"
Track
s"
,
name
:
"FK_
Tracks_Projects_Project
Id"
,
column
:
x
=>
x
.
Project
Id
,
principalTable
:
"
Project
s"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Restrict
);
});
...
...
@@ -235,22 +303,15 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
LastName
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
),
CurrentWorkingHours
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
true
),
IsAvailable
=
table
.
Column
<
bool
>(
type
:
"bit"
,
nullable
:
true
),
ProjectId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
true
),
StepId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
true
)
TrackId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
true
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_Employees"
,
x
=>
x
.
Id
);
table
.
ForeignKey
(
name
:
"FK_Employees_Projects_ProjectId"
,
column
:
x
=>
x
.
ProjectId
,
principalTable
:
"Projects"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Restrict
);
table
.
ForeignKey
(
name
:
"FK_Employees_Steps_StepId"
,
column
:
x
=>
x
.
StepId
,
principalTable
:
"Steps"
,
name
:
"FK_Employees_Tracks_TrackId"
,
column
:
x
=>
x
.
TrackId
,
principalTable
:
"Tracks"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Restrict
);
table
.
ForeignKey
(
...
...
@@ -262,52 +323,87 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
});
migrationBuilder
.
CreateTable
(
name
:
"
Item
s"
,
name
:
"
StepTrack
s"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
.
Annotation
(
"SqlServer:Identity"
,
"1, 1"
),
ItemName
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
),
ItemDescription
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
),
Ammount
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
true
),
Currency
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
),
StepId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
true
)
StepId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
TrackId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
ExecutionRatio
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_
Item
s"
,
x
=>
x
.
Id
);
table
.
PrimaryKey
(
"PK_
StepTrack
s"
,
x
=>
x
.
Id
);
table
.
ForeignKey
(
name
:
"FK_
Item
s_Steps_StepId"
,
name
:
"FK_
StepTrack
s_Steps_StepId"
,
column
:
x
=>
x
.
StepId
,
principalTable
:
"Steps"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Restrict
);
table
.
ForeignKey
(
name
:
"FK_StepTracks_Tracks_TrackId"
,
column
:
x
=>
x
.
TrackId
,
principalTable
:
"Tracks"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Restrict
);
});
migrationBuilder
.
CreateTable
(
name
:
"
StepTracks
"
,
name
:
"
EmployeeParticipate
"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
.
Annotation
(
"SqlServer:Identity"
,
"1, 1"
),
StepId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
TrackId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
EmployeeId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
ProjectId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
PartialTimeRatio
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
Role
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_
StepTracks
"
,
x
=>
x
.
Id
);
table
.
PrimaryKey
(
"PK_
EmployeeParticipate
"
,
x
=>
x
.
Id
);
table
.
ForeignKey
(
name
:
"FK_
StepTracks_Steps_Step
Id"
,
column
:
x
=>
x
.
Step
Id
,
principalTable
:
"
Step
s"
,
name
:
"FK_
EmployeeParticipate_Employees_Employee
Id"
,
column
:
x
=>
x
.
Employee
Id
,
principalTable
:
"
Employee
s"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Restrict
);
onDelete
:
ReferentialAction
.
Cascade
);
table
.
ForeignKey
(
name
:
"FK_StepTracks_Tracks_TrackId"
,
name
:
"FK_EmployeeParticipate_Projects_ProjectId"
,
column
:
x
=>
x
.
ProjectId
,
principalTable
:
"Projects"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Cascade
);
});
migrationBuilder
.
CreateTable
(
name
:
"EmployeeTrack"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
.
Annotation
(
"SqlServer:Identity"
,
"1, 1"
),
EmloyeeId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
TrackId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
WorkingHours
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
PerformedWork
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
),
AssignedWork
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_EmployeeTrack"
,
x
=>
x
.
Id
);
table
.
ForeignKey
(
name
:
"FK_EmployeeTrack_Employees_EmloyeeId"
,
column
:
x
=>
x
.
EmloyeeId
,
principalTable
:
"Employees"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Cascade
);
table
.
ForeignKey
(
name
:
"FK_EmployeeTrack_Tracks_TrackId"
,
column
:
x
=>
x
.
TrackId
,
principalTable
:
"Tracks"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Restrict
);
onDelete
:
ReferentialAction
.
Cascade
);
});
migrationBuilder
.
CreateTable
(
...
...
@@ -331,24 +427,34 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
column
:
x
=>
x
.
EmployeeId
,
principalTable
:
"Employees"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Restrict
);
onDelete
:
ReferentialAction
.
Cascade
);
table
.
ForeignKey
(
name
:
"FK_EmployeeWorks_StepTracks_StepTrackId"
,
column
:
x
=>
x
.
StepTrackId
,
principalTable
:
"StepTracks"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Restrict
);
onDelete
:
ReferentialAction
.
Cascade
);
});
migrationBuilder
.
CreateIndex
(
name
:
"IX_Employees_ProjectId"
,
table
:
"Employees"
,
name
:
"IX_Attachment_ProjectId"
,
table
:
"Attachment"
,
column
:
"ProjectId"
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_EmployeeParticipate_EmployeeId"
,
table
:
"EmployeeParticipate"
,
column
:
"EmployeeId"
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_EmployeeParticipate_ProjectId"
,
table
:
"EmployeeParticipate"
,
column
:
"ProjectId"
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_Employees_
Step
Id"
,
name
:
"IX_Employees_
Track
Id"
,
table
:
"Employees"
,
column
:
"
Step
Id"
);
column
:
"
Track
Id"
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_Employees_UserId"
,
...
...
@@ -356,6 +462,16 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
column
:
"UserId"
,
unique
:
true
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_EmployeeTrack_EmloyeeId"
,
table
:
"EmployeeTrack"
,
column
:
"EmloyeeId"
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_EmployeeTrack_TrackId"
,
table
:
"EmployeeTrack"
,
column
:
"TrackId"
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_EmployeeWorks_EmployeeId"
,
table
:
"EmployeeWorks"
,
...
...
@@ -367,24 +483,24 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
column
:
"StepTrackId"
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_
Items_Step
Id"
,
table
:
"
Items
"
,
column
:
"
Step
Id"
);
name
:
"IX_
PermissionRole_Roles
Id"
,
table
:
"
PermissionRole
"
,
column
:
"
Roles
Id"
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_P
ermission_Permission
Id"
,
table
:
"P
ermission
"
,
column
:
"
Permission
Id"
);
name
:
"IX_P
rojects_Executer
Id"
,
table
:
"P
rojects
"
,
column
:
"
Executer
Id"
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_P
ermission_Role
Id"
,
table
:
"P
ermission
"
,
column
:
"
Role
Id"
);
name
:
"IX_P
rojects_ProjectManager
Id"
,
table
:
"P
rojects
"
,
column
:
"
ProjectManager
Id"
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_Projects_
Executer
Id"
,
name
:
"IX_Projects_
ProjectStatus
Id"
,
table
:
"Projects"
,
column
:
"
Executer
Id"
);
column
:
"
ProjectStatus
Id"
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_Projects_ProposerId"
,
...
...
@@ -406,11 +522,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
table
:
"Steps"
,
column
:
"ProjectId"
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_Steps_TrackId"
,
table
:
"Steps"
,
column
:
"TrackId"
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_StepTracks_StepId"
,
table
:
"StepTracks"
,
...
...
@@ -426,6 +537,14 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
table
:
"Tracks"
,
column
:
"ProjectId"
);
migrationBuilder
.
AddForeignKey
(
name
:
"FK_Projects_Employees_ProjectManagerId"
,
table
:
"Projects"
,
column
:
"ProjectManagerId"
,
principalTable
:
"Employees"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Restrict
);
migrationBuilder
.
AddForeignKey
(
name
:
"FK_Projects_Employees_TeamLeaderId"
,
table
:
"Projects"
,
...
...
@@ -437,25 +556,22 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
protected
override
void
Down
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
DropForeignKey
(
name
:
"FK_Projects_Customers_ProposerId"
,
table
:
"Projects"
);
migrationBuilder
.
DropForeignKey
(
name
:
"FK_Employees_Projects_ProjectId"
,
table
:
"Employees"
);
migrationBuilder
.
DropForeignKey
(
name
:
"FK_Steps_Projects_ProjectId"
,
table
:
"Steps"
);
migrationBuilder
.
DropForeignKey
(
name
:
"FK_Tracks_Projects_ProjectId"
,
table
:
"Tracks"
);
migrationBuilder
.
DropTable
(
name
:
"Attachment"
);
migrationBuilder
.
DropTable
(
name
:
"ContactInfo"
);
migrationBuilder
.
DropTable
(
name
:
"EmployeeParticipate"
);
migrationBuilder
.
DropTable
(
name
:
"EmployeeTrack"
);
migrationBuilder
.
DropTable
(
name
:
"EmployeeWorks"
);
...
...
@@ -463,7 +579,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
name
:
"Items"
);
migrationBuilder
.
DropTable
(
name
:
"Permission"
);
name
:
"Permission
Role
"
);
migrationBuilder
.
DropTable
(
name
:
"RoleUser"
);
...
...
@@ -472,14 +588,20 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
name
:
"StepTracks"
);
migrationBuilder
.
DropTable
(
name
:
"
Role
"
);
name
:
"
Permission
"
);
migrationBuilder
.
DropTable
(
name
:
"Customers"
);
name
:
"Roles"
);
migrationBuilder
.
DropTable
(
name
:
"Steps"
);
migrationBuilder
.
DropTable
(
name
:
"Projects"
);
migrationBuilder
.
DropTable
(
name
:
"Customers"
);
migrationBuilder
.
DropTable
(
name
:
"Departments"
);
...
...
@@ -487,13 +609,13 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
name
:
"Employees"
);
migrationBuilder
.
DropTable
(
name
:
"
Step
s"
);
name
:
"
ProjectStatu
s"
);
migrationBuilder
.
DropTable
(
name
:
"
User
s"
);
name
:
"
Track
s"
);
migrationBuilder
.
DropTable
(
name
:
"
Track
s"
);
name
:
"
User
s"
);
}
}
}
PSManagement.Infrastructure.Persistence/Migrations/2024080
6125539_AddDomainUpdate2
.Designer.cs
→
PSManagement.Infrastructure.Persistence/Migrations/2024080
7122646_UpdateDomains
.Designer.cs
View file @
1d5f4c82
...
...
@@ -10,8 +10,8 @@ using PSManagement.Infrastructure.Persistence;
namespace
PSManagement.Infrastructure.Persistence.Migrations
{
[
DbContext
(
typeof
(
AppDbContext
))]
[
Migration
(
"2024080
6125539_AddDomainUpdate2
"
)]
partial
class
AddDomainUpdate2
[
Migration
(
"2024080
7122646_UpdateDomains
"
)]
partial
class
UpdateDomains
{
protected
override
void
BuildTargetModel
(
ModelBuilder
modelBuilder
)
{
...
...
@@ -259,7 +259,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Item
s
"
);
b
.
ToTable
(
"Item"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Steps.Entities.Step"
,
b
=>
...
...
@@ -328,40 +328,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b
.
ToTable
(
"EmployeeTrack"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.EmployeeWork"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"ContributingRatio"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"EmployeeId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"EmployeeWorkId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"HoursWorked"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"Notes"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"StepTrackId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"EmployeeId"
);
b
.
HasIndex
(
"StepTrackId"
);
b
.
ToTable
(
"EmployeeWorks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.StepTrack"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
...
...
@@ -576,8 +542,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"ProjectManager"
)
.
WithMany
()
.
HasForeignKey
(
"ProjectManagerId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
.
OnDelete
(
DeleteBehavior
.
Restrict
);
b
.
HasOne
(
"PSManagement.Domain.Projects.Entities.ProjectStatus"
,
"ProjectStatus"
)
.
WithMany
()
...
...
@@ -590,8 +555,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"TeamLeader"
)
.
WithMany
()
.
HasForeignKey
(
"TeamLeaderId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
.
OnDelete
(
DeleteBehavior
.
Restrict
);
b
.
OwnsOne
(
"PSManagement.Domain.Projects.Aggregate.Aggreement"
,
"ProjectAggreement"
,
b1
=>
{
...
...
@@ -753,7 +717,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b1
.
HasKey
(
"ItemId"
);
b1
.
ToTable
(
"Item
s
"
);
b1
.
ToTable
(
"Item"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"ItemId"
);
...
...
@@ -792,25 +756,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b
.
Navigation
(
"Track"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.EmployeeWork"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"Employee"
)
.
WithMany
()
.
HasForeignKey
(
"EmployeeId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Tracking.Entities.StepTrack"
,
"StepTrack"
)
.
WithMany
()
.
HasForeignKey
(
"StepTrackId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
Navigation
(
"Employee"
);
b
.
Navigation
(
"StepTrack"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.StepTrack"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Steps.Entities.Step"
,
"Step"
)
...
...
PSManagement.Infrastructure.Persistence/Migrations/20240807122646_UpdateDomains.cs
0 → 100644
View file @
1d5f4c82
using
Microsoft.EntityFrameworkCore.Migrations
;
namespace
PSManagement.Infrastructure.Persistence.Migrations
{
public
partial
class
UpdateDomains
:
Migration
{
protected
override
void
Up
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
DropTable
(
name
:
"EmployeeWorks"
);
migrationBuilder
.
DropPrimaryKey
(
name
:
"PK_Items"
,
table
:
"Items"
);
migrationBuilder
.
RenameTable
(
name
:
"Items"
,
newName
:
"Item"
);
migrationBuilder
.
AddPrimaryKey
(
name
:
"PK_Item"
,
table
:
"Item"
,
column
:
"Id"
);
}
protected
override
void
Down
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
DropPrimaryKey
(
name
:
"PK_Item"
,
table
:
"Item"
);
migrationBuilder
.
RenameTable
(
name
:
"Item"
,
newName
:
"Items"
);
migrationBuilder
.
AddPrimaryKey
(
name
:
"PK_Items"
,
table
:
"Items"
,
column
:
"Id"
);
migrationBuilder
.
CreateTable
(
name
:
"EmployeeWorks"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
.
Annotation
(
"SqlServer:Identity"
,
"1, 1"
),
ContributingRatio
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
EmployeeId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
EmployeeWorkId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
HoursWorked
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
Notes
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
),
StepTrackId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_EmployeeWorks"
,
x
=>
x
.
Id
);
table
.
ForeignKey
(
name
:
"FK_EmployeeWorks_Employees_EmployeeId"
,
column
:
x
=>
x
.
EmployeeId
,
principalTable
:
"Employees"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Cascade
);
table
.
ForeignKey
(
name
:
"FK_EmployeeWorks_StepTracks_StepTrackId"
,
column
:
x
=>
x
.
StepTrackId
,
principalTable
:
"StepTracks"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Cascade
);
});
migrationBuilder
.
CreateIndex
(
name
:
"IX_EmployeeWorks_EmployeeId"
,
table
:
"EmployeeWorks"
,
column
:
"EmployeeId"
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_EmployeeWorks_StepTrackId"
,
table
:
"EmployeeWorks"
,
column
:
"StepTrackId"
);
}
}
}
PSManagement.Infrastructure.Persistence/Migrations/2024080
6132941_AddDomainUpdate3
.Designer.cs
→
PSManagement.Infrastructure.Persistence/Migrations/2024080
7124316_UpdateDomains1
.Designer.cs
View file @
1d5f4c82
...
...
@@ -10,8 +10,8 @@ using PSManagement.Infrastructure.Persistence;
namespace
PSManagement.Infrastructure.Persistence.Migrations
{
[
DbContext
(
typeof
(
AppDbContext
))]
[
Migration
(
"2024080
6132941_AddDomainUpdate3
"
)]
partial
class
AddDomainUpdate3
[
Migration
(
"2024080
7124316_UpdateDomains1
"
)]
partial
class
UpdateDomains1
{
protected
override
void
BuildTargetModel
(
ModelBuilder
modelBuilder
)
{
...
...
@@ -65,16 +65,11 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b
.
Property
<
int
>(
"HIASTId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"TrackId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"UserId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"TrackId"
);
b
.
HasIndex
(
"UserId"
)
.
IsUnique
();
...
...
@@ -259,7 +254,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Item
s
"
);
b
.
ToTable
(
"Item"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Steps.Entities.Step"
,
b
=>
...
...
@@ -328,40 +323,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b
.
ToTable
(
"EmployeeTrack"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.EmployeeWork"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"ContributingRatio"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"EmployeeId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"EmployeeWorkId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"HoursWorked"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"Notes"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"StepTrackId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"EmployeeId"
);
b
.
HasIndex
(
"StepTrackId"
);
b
.
ToTable
(
"EmployeeWorks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.StepTrack"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
...
...
@@ -504,10 +465,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Employee"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Tracking.Track"
,
null
)
.
WithMany
(
"TrackedEmployees"
)
.
HasForeignKey
(
"TrackId"
);
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.User"
,
"User"
)
.
WithOne
(
"Employee"
)
.
HasForeignKey
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"UserId"
)
...
...
@@ -576,8 +533,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"ProjectManager"
)
.
WithMany
()
.
HasForeignKey
(
"ProjectManagerId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
)
.
IsRequired
();
.
OnDelete
(
DeleteBehavior
.
Restrict
);
b
.
HasOne
(
"PSManagement.Domain.Projects.Entities.ProjectStatus"
,
"ProjectStatus"
)
.
WithMany
()
...
...
@@ -590,8 +546,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"TeamLeader"
)
.
WithMany
()
.
HasForeignKey
(
"TeamLeaderId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
)
.
IsRequired
();
.
OnDelete
(
DeleteBehavior
.
Restrict
);
b
.
OwnsOne
(
"PSManagement.Domain.Projects.Aggregate.Aggreement"
,
"ProjectAggreement"
,
b1
=>
{
...
...
@@ -753,7 +708,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b1
.
HasKey
(
"ItemId"
);
b1
.
ToTable
(
"Item
s
"
);
b1
.
ToTable
(
"Item"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"ItemId"
);
...
...
@@ -792,25 +747,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b
.
Navigation
(
"Track"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.EmployeeWork"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"Employee"
)
.
WithMany
()
.
HasForeignKey
(
"EmployeeId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Tracking.Entities.StepTrack"
,
"StepTrack"
)
.
WithMany
()
.
HasForeignKey
(
"StepTrackId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
Navigation
(
"Employee"
);
b
.
Navigation
(
"StepTrack"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.StepTrack"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Steps.Entities.Step"
,
"Step"
)
...
...
@@ -909,8 +845,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b
.
Navigation
(
"EmployeeTracks"
);
b
.
Navigation
(
"StepTracks"
);
b
.
Navigation
(
"TrackedEmployees"
);
});
#pragma warning restore 612, 618
}
...
...
PSManagement.Infrastructure.Persistence/Migrations/2024080
3191817_AddDomains6
.cs
→
PSManagement.Infrastructure.Persistence/Migrations/2024080
7124316_UpdateDomains1
.cs
View file @
1d5f4c82
...
...
@@ -2,39 +2,39 @@
namespace
PSManagement.Infrastructure.Persistence.Migrations
{
public
partial
class
AddDomains6
:
Migration
public
partial
class
UpdateDomains1
:
Migration
{
protected
override
void
Up
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
DropForeignKey
(
name
:
"FK_
Step
s_Tracks_TrackId"
,
table
:
"
Step
s"
);
name
:
"FK_
Employee
s_Tracks_TrackId"
,
table
:
"
Employee
s"
);
migrationBuilder
.
DropIndex
(
name
:
"IX_
Step
s_TrackId"
,
table
:
"
Step
s"
);
name
:
"IX_
Employee
s_TrackId"
,
table
:
"
Employee
s"
);
migrationBuilder
.
DropColumn
(
name
:
"TrackId"
,
table
:
"
Step
s"
);
table
:
"
Employee
s"
);
}
protected
override
void
Down
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
AddColumn
<
int
>(
name
:
"TrackId"
,
table
:
"
Step
s"
,
table
:
"
Employee
s"
,
type
:
"int"
,
nullable
:
true
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_
Step
s_TrackId"
,
table
:
"
Step
s"
,
name
:
"IX_
Employee
s_TrackId"
,
table
:
"
Employee
s"
,
column
:
"TrackId"
);
migrationBuilder
.
AddForeignKey
(
name
:
"FK_
Step
s_Tracks_TrackId"
,
table
:
"
Step
s"
,
name
:
"FK_
Employee
s_Tracks_TrackId"
,
table
:
"
Employee
s"
,
column
:
"TrackId"
,
principalTable
:
"Tracks"
,
principalColumn
:
"Id"
,
...
...
PSManagement.Infrastructure.Persistence/Migrations/2024080
6062155_AddDomainUpdate
.Designer.cs
→
PSManagement.Infrastructure.Persistence/Migrations/2024080
8142549_AddDomainsUpdate2
.Designer.cs
View file @
1d5f4c82
...
...
@@ -10,8 +10,8 @@ using PSManagement.Infrastructure.Persistence;
namespace
PSManagement.Infrastructure.Persistence.Migrations
{
[
DbContext
(
typeof
(
AppDbContext
))]
[
Migration
(
"2024080
6062155_AddDomainUpdate
"
)]
partial
class
AddDomain
Update
[
Migration
(
"2024080
8142549_AddDomainsUpdate2
"
)]
partial
class
AddDomain
sUpdate2
{
protected
override
void
BuildTargetModel
(
ModelBuilder
modelBuilder
)
{
...
...
@@ -65,16 +65,11 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b
.
Property
<
int
>(
"HIASTId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"TrackId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"UserId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"TrackId"
);
b
.
HasIndex
(
"UserId"
)
.
IsUnique
();
...
...
@@ -132,78 +127,71 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b
.
ToTable
(
"Users"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Project
Types.Entities.ProjectType
"
,
b
=>
modelBuilder
.
Entity
(
"PSManagement.Domain.Project
s.Entities.Attachment
"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Description"
)
b
.
Property
<
string
>(
"AttachmenDescription"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"AttachmentName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"
TypeName
"
)
b
.
Property
<
string
>(
"
AttachmentUrl
"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"WorkerCount
"
)
b
.
Property
<
int
?>(
"ProjectId
"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"ProjectType"
);
b
.
HasIndex
(
"ProjectId"
);
b
.
ToTable
(
"Attachment"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.
Aggregate.Project
"
,
b
=>
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.
Entities.EmployeeParticipate
"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
?>(
"ExecuterId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"ProjectStatusId"
)
b
.
Property
<
int
>(
"EmployeeId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"ProjectTypeId
"
)
b
.
Property
<
int
>(
"PartialTimeRatio
"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"Proposer
Id"
)
b
.
Property
<
int
>(
"Project
Id"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"TeamLeaderId
"
)
.
HasColumnType
(
"
int
"
);
b
.
Property
<
string
>(
"Role
"
)
.
HasColumnType
(
"
nvarchar(max)
"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ExecuterId"
);
b
.
HasIndex
(
"ProjectStatusId"
);
b
.
HasIndex
(
"ProjectTypeId"
);
b
.
HasIndex
(
"ProposerId"
);
b
.
HasIndex
(
"EmployeeId"
);
b
.
HasIndex
(
"
TeamLeader
Id"
);
b
.
HasIndex
(
"
Project
Id"
);
b
.
ToTable
(
"
Projects
"
);
b
.
ToTable
(
"
EmployeeParticipate
"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.
Attachment
"
,
b
=>
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.
FinincialSpending
"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"AttachmenDescription"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"AttachmentName"
)
b
.
Property
<
string
>(
"CostType"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"
AttachmentUrl
"
)
b
.
Property
<
string
>(
"
Description
"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
?>(
"ProjectId"
)
...
...
@@ -213,38 +201,47 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b
.
HasIndex
(
"ProjectId"
);
b
.
ToTable
(
"
Attachment
"
);
b
.
ToTable
(
"
FinincialSpending
"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.
EmployeeParticipate
"
,
b
=>
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.
Project
"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"Employee
Id"
)
b
.
Property
<
int
?>(
"Executer
Id"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"P
artialTimeRatio
"
)
b
.
Property
<
int
>(
"P
rojectManagerId
"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"Project
Id"
)
b
.
Property
<
int
?>(
"ProjectStatus
Id"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"Role"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
?>(
"ProposerId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"TeamLeaderId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"E
mployee
Id"
);
b
.
HasIndex
(
"E
xecuter
Id"
);
b
.
HasIndex
(
"ProjectId"
);
b
.
HasIndex
(
"Project
Manager
Id"
);
b
.
ToTable
(
"EmployeeParticipate"
);
b
.
HasIndex
(
"ProjectStatusId"
);
b
.
HasIndex
(
"ProposerId"
);
b
.
HasIndex
(
"TeamLeaderId"
);
b
.
ToTable
(
"Projects"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects
.Entiti
es.ProjectStatus"
,
b
=>
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects
Status.Entit
es.ProjectStatus"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
...
...
@@ -280,7 +277,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Item
s
"
);
b
.
ToTable
(
"Item"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Steps.Entities.Step"
,
b
=>
...
...
@@ -349,40 +346,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b
.
ToTable
(
"EmployeeTrack"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.EmployeeWork"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"ContributingRatio"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"EmployeeId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"EmployeeWorkId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"HoursWorked"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"Notes"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"StepTrackId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"EmployeeId"
);
b
.
HasIndex
(
"StepTrackId"
);
b
.
ToTable
(
"EmployeeWorks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.StepTrack"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
...
...
@@ -525,10 +488,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Employee"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Tracking.Track"
,
null
)
.
WithMany
(
"TrackedEmployees"
)
.
HasForeignKey
(
"TrackId"
);
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.User"
,
"User"
)
.
WithOne
(
"Employee"
)
.
HasForeignKey
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"UserId"
)
...
...
@@ -581,26 +540,138 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
.
HasForeignKey
(
"EmployeeId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Employees.Entities.WorkInfo"
,
"WorkInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"EmployeeId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"WorkJob"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"WorkJob"
);
b1
.
Property
<
string
>(
"WorkType"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"WorkType"
);
b1
.
HasKey
(
"EmployeeId"
);
b1
.
ToTable
(
"Employees"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"EmployeeId"
);
});
b
.
Navigation
(
"Availability"
);
b
.
Navigation
(
"PersonalInfo"
);
b
.
Navigation
(
"User"
);
b
.
Navigation
(
"WorkInfo"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Attachment"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Entities.Project"
,
null
)
.
WithMany
(
"Attachments"
)
.
HasForeignKey
(
"ProjectId"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.EmployeeParticipate"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"Employee"
)
.
WithMany
(
"EmployeeParticipates"
)
.
HasForeignKey
(
"EmployeeId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Projects.Entities.Project"
,
"Project"
)
.
WithMany
(
"EmployeeParticipates"
)
.
HasForeignKey
(
"ProjectId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
Navigation
(
"Employee"
);
b
.
Navigation
(
"Project"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.FinincialSpending"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Entities.Project"
,
null
)
.
WithMany
(
"FinincialSpending"
)
.
HasForeignKey
(
"ProjectId"
);
b
.
OwnsOne
(
"PSManagement.SharedKernel.ValueObjects.Money"
,
"ExternalPurchase"
,
b1
=>
{
b1
.
Property
<
int
>(
"FinincialSpendingId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
int
>(
"Ammount"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"ExternalPurchaseAmmount"
);
b1
.
Property
<
string
>(
"Currency"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasDefaultValue
(
"USD"
)
.
HasColumnName
(
"ExternalPurchaseCurrency"
);
b1
.
HasKey
(
"FinincialSpendingId"
);
b1
.
ToTable
(
"FinincialSpending"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"FinincialSpendingId"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Aggregate.Project"
,
b
=>
b
.
OwnsOne
(
"PSManagement.SharedKernel.ValueObjects.Money"
,
"LocalPurchase"
,
b1
=>
{
b1
.
Property
<
int
>(
"FinincialSpendingId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
int
>(
"Ammount"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"LocalPurchaseAmmount"
);
b1
.
Property
<
string
>(
"Currency"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"nvarchar(max)"
)
.
HasDefaultValue
(
"SP"
)
.
HasColumnName
(
"LocalPurchaseCurrency"
);
b1
.
HasKey
(
"FinincialSpendingId"
);
b1
.
ToTable
(
"FinincialSpending"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"FinincialSpendingId"
);
});
b
.
Navigation
(
"ExternalPurchase"
);
b
.
Navigation
(
"LocalPurchase"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Project"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Department"
,
"Executer"
)
.
WithMany
()
.
HasForeignKey
(
"ExecuterId"
);
b
.
HasOne
(
"PSManagement.Domain.
Projects.Entities.ProjectStatus"
,
"ProjectStatus
"
)
b
.
HasOne
(
"PSManagement.Domain.
Employees.Entities.Employee"
,
"ProjectManager
"
)
.
WithMany
()
.
HasForeignKey
(
"ProjectStatusId"
);
.
HasForeignKey
(
"ProjectManagerId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
);
b
.
HasOne
(
"PSManagement.Domain.Project
Types.Entities.ProjectType"
,
"ProjectType
"
)
.
WithMany
(
"Projects"
)
.
HasForeignKey
(
"Project
Type
Id"
);
b
.
HasOne
(
"PSManagement.Domain.Project
sStatus.Entites.ProjectStatus"
,
"ProjectStatus
"
)
.
WithMany
()
.
HasForeignKey
(
"Project
Status
Id"
);
b
.
HasOne
(
"PSManagement.Domain.Customers.Aggregate.Customer"
,
"Proposer"
)
.
WithMany
(
"Projects"
)
...
...
@@ -608,9 +679,10 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"TeamLeader"
)
.
WithMany
()
.
HasForeignKey
(
"TeamLeaderId"
);
.
HasForeignKey
(
"TeamLeaderId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
);
b
.
OwnsOne
(
"PSManagement.Domain.Projects.
Aggregate
.Aggreement"
,
"ProjectAggreement"
,
b1
=>
b
.
OwnsOne
(
"PSManagement.Domain.Projects.
ValueObjects
.Aggreement"
,
"ProjectAggreement"
,
b1
=>
{
b1
.
Property
<
int
>(
"ProjectId"
)
.
ValueGeneratedOnAdd
()
...
...
@@ -633,7 +705,30 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
.
HasForeignKey
(
"ProjectId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Projects.Aggregate.ProjectInfo"
,
"ProjectInfo"
,
b1
=>
b
.
OwnsOne
(
"PSManagement.Domain.Projects.ValueObjects.FinincialFund"
,
"FinincialFund"
,
b1
=>
{
b1
.
Property
<
int
>(
"ProjectId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"FinicialStatus"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"FinicialStatus"
);
b1
.
Property
<
string
>(
"Source"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"FinicialSource"
);
b1
.
HasKey
(
"ProjectId"
);
b1
.
ToTable
(
"Projects"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"ProjectId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Projects.ValueObjects.ProjectInfo"
,
"ProjectInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"ProjectId"
)
.
ValueGeneratedOnAdd
()
...
...
@@ -660,7 +755,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
.
HasForeignKey
(
"ProjectId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Projects.
Aggregate
.ProposalInfo"
,
"ProposalInfo"
,
b1
=>
b
.
OwnsOne
(
"PSManagement.Domain.Projects.
ValueObjects
.ProposalInfo"
,
"ProposalInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"ProjectId"
)
.
ValueGeneratedOnAdd
()
...
...
@@ -685,13 +780,15 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b
.
Navigation
(
"Executer"
);
b
.
Navigation
(
"FinincialFund"
);
b
.
Navigation
(
"ProjectAggreement"
);
b
.
Navigation
(
"ProjectInfo"
);
b
.
Navigation
(
"Project
Status
"
);
b
.
Navigation
(
"Project
Manager
"
);
b
.
Navigation
(
"Project
Type
"
);
b
.
Navigation
(
"Project
Status
"
);
b
.
Navigation
(
"ProposalInfo"
);
...
...
@@ -700,32 +797,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b
.
Navigation
(
"TeamLeader"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Attachment"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Aggregate.Project"
,
null
)
.
WithMany
(
"Attachments"
)
.
HasForeignKey
(
"ProjectId"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.EmployeeParticipate"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"Employee"
)
.
WithMany
(
"EmployeeParticipates"
)
.
HasForeignKey
(
"EmployeeId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Projects.Aggregate.Project"
,
"Project"
)
.
WithMany
(
"EmployeeParticipates"
)
.
HasForeignKey
(
"ProjectId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
Navigation
(
"Employee"
);
b
.
Navigation
(
"Project"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Steps.Entities.Item"
,
b
=>
{
b
.
OwnsOne
(
"PSManagement.SharedKernel.ValueObjects.Money"
,
"Price"
,
b1
=>
...
...
@@ -745,7 +816,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b1
.
HasKey
(
"ItemId"
);
b1
.
ToTable
(
"Item
s
"
);
b1
.
ToTable
(
"Item"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"ItemId"
);
...
...
@@ -756,7 +827,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
modelBuilder
.
Entity
(
"PSManagement.Domain.Steps.Entities.Step"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.
Aggregate
.Project"
,
"Project"
)
b
.
HasOne
(
"PSManagement.Domain.Projects.
Entities
.Project"
,
"Project"
)
.
WithMany
(
"Steps"
)
.
HasForeignKey
(
"ProjectId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
...
...
@@ -784,25 +855,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b
.
Navigation
(
"Track"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.EmployeeWork"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"Employee"
)
.
WithMany
()
.
HasForeignKey
(
"EmployeeId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Tracking.Entities.StepTrack"
,
"StepTrack"
)
.
WithMany
()
.
HasForeignKey
(
"StepTrackId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
Navigation
(
"Employee"
);
b
.
Navigation
(
"StepTrack"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.StepTrack"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Steps.Entities.Step"
,
"Step"
)
...
...
@@ -824,7 +876,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Track"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.
Aggregate
.Project"
,
"Project"
)
b
.
HasOne
(
"PSManagement.Domain.Projects.
Entities
.Project"
,
"Project"
)
.
WithMany
(
"Tracks"
)
.
HasForeignKey
(
"ProjectId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
)
...
...
@@ -880,17 +932,14 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b
.
Navigation
(
"Employee"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.ProjectTypes.Entities.ProjectType"
,
b
=>
{
b
.
Navigation
(
"Projects"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Aggregate.Project"
,
b
=>
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Project"
,
b
=>
{
b
.
Navigation
(
"Attachments"
);
b
.
Navigation
(
"EmployeeParticipates"
);
b
.
Navigation
(
"FinincialSpending"
);
b
.
Navigation
(
"Steps"
);
b
.
Navigation
(
"Tracks"
);
...
...
@@ -906,8 +955,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b
.
Navigation
(
"EmployeeTracks"
);
b
.
Navigation
(
"StepTracks"
);
b
.
Navigation
(
"TrackedEmployees"
);
});
#pragma warning restore 612, 618
}
...
...
PSManagement.Infrastructure.Persistence/Migrations/2024080
3180549_AddDomains4
.cs
→
PSManagement.Infrastructure.Persistence/Migrations/2024080
8142549_AddDomainsUpdate2
.cs
View file @
1d5f4c82
...
...
@@ -2,92 +2,65 @@
namespace
PSManagement.Infrastructure.Persistence.Migrations
{
public
partial
class
AddDomains
4
:
Migration
public
partial
class
AddDomains
Update2
:
Migration
{
protected
override
void
Up
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
DropForeignKey
(
name
:
"FK_Employees_Projects_ProjectId"
,
table
:
"Employees"
);
migrationBuilder
.
DropIndex
(
name
:
"IX_Employees_ProjectId"
,
table
:
"Employees"
);
migrationBuilder
.
DropColumn
(
name
:
"ProjectId"
,
table
:
"Employees"
);
migrationBuilder
.
AddColumn
<
string
>(
name
:
"WorkJob"
,
table
:
"Employees"
,
type
:
"nvarchar(max)"
,
nullable
:
true
);
migrationBuilder
.
AddColumn
<
int
>(
name
:
"
ProjectTypeId
"
,
table
:
"
Project
s"
,
type
:
"
int
"
,
migrationBuilder
.
AddColumn
<
string
>(
name
:
"
WorkType
"
,
table
:
"
Employee
s"
,
type
:
"
nvarchar(max)
"
,
nullable
:
true
);
migrationBuilder
.
CreateTable
(
name
:
"
ProjectType
"
,
name
:
"
FinincialSpending
"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
.
Annotation
(
"SqlServer:Identity"
,
"1, 1"
),
TypeNam
e
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
),
CostTyp
e
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
),
Description
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
),
WorkerCount
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
LocalPurchaseAmmount
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
true
),
LocalPurchaseCurrency
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
,
defaultValue
:
"SP"
),
ExternalPurchaseAmmount
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
true
),
ExternalPurchaseCurrency
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
,
defaultValue
:
"USD"
),
ProjectId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
true
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_ProjectType"
,
x
=>
x
.
Id
);
table
.
PrimaryKey
(
"PK_FinincialSpending"
,
x
=>
x
.
Id
);
table
.
ForeignKey
(
name
:
"FK_FinincialSpending_Projects_ProjectId"
,
column
:
x
=>
x
.
ProjectId
,
principalTable
:
"Projects"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Restrict
);
});
migrationBuilder
.
CreateIndex
(
name
:
"IX_Projects_ProjectTypeId"
,
table
:
"Projects"
,
column
:
"ProjectTypeId"
);
migrationBuilder
.
AddForeignKey
(
name
:
"FK_Projects_ProjectType_ProjectTypeId"
,
table
:
"Projects"
,
column
:
"ProjectTypeId"
,
principalTable
:
"ProjectType"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Restrict
);
name
:
"IX_FinincialSpending_ProjectId"
,
table
:
"FinincialSpending"
,
column
:
"ProjectId"
);
}
protected
override
void
Down
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
DropForeignKey
(
name
:
"FK_Projects_ProjectType_ProjectTypeId"
,
table
:
"Projects"
);
migrationBuilder
.
DropTable
(
name
:
"ProjectType"
);
migrationBuilder
.
DropIndex
(
name
:
"IX_Projects_ProjectTypeId"
,
table
:
"Projects"
);
name
:
"FinincialSpending"
);
migrationBuilder
.
DropColumn
(
name
:
"ProjectTypeId"
,
table
:
"Projects"
);
migrationBuilder
.
AddColumn
<
int
>(
name
:
"ProjectId"
,
table
:
"Employees"
,
type
:
"int"
,
nullable
:
true
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_Employees_ProjectId"
,
table
:
"Employees"
,
column
:
"ProjectId"
);
name
:
"WorkJob"
,
table
:
"Employees"
);
migrationBuilder
.
AddForeignKey
(
name
:
"FK_Employees_Projects_ProjectId"
,
table
:
"Employees"
,
column
:
"ProjectId"
,
principalTable
:
"Projects"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Restrict
);
migrationBuilder
.
DropColumn
(
name
:
"WorkType"
,
table
:
"Employees"
);
}
}
}
PSManagement.Infrastructure.Persistence/Migrations/20240808173901_AddDomainsUpdate3.Designer.cs
0 → 100644
View file @
1d5f4c82
// <auto-generated />
using
System
;
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Infrastructure
;
using
Microsoft.EntityFrameworkCore.Metadata
;
using
Microsoft.EntityFrameworkCore.Migrations
;
using
Microsoft.EntityFrameworkCore.Storage.ValueConversion
;
using
PSManagement.Infrastructure.Persistence
;
namespace
PSManagement.Infrastructure.Persistence.Migrations
{
[
DbContext
(
typeof
(
AppDbContext
))]
[
Migration
(
"20240808173901_AddDomainsUpdate3"
)]
partial
class
AddDomainsUpdate3
{
protected
override
void
BuildTargetModel
(
ModelBuilder
modelBuilder
)
{
#pragma warning disable 612, 618
modelBuilder
.
HasAnnotation
(
"Relational:Collation"
,
"Arabic_CI_AS"
)
.
HasAnnotation
(
"Relational:MaxIdentifierLength"
,
128
)
.
HasAnnotation
(
"ProductVersion"
,
"5.0.17"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
modelBuilder
.
Entity
(
"PSManagement.Domain.Customers.Aggregate.Customer"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"CustomerName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"Email"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Customers"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Department"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Departments"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Employee"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"HIASTId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"UserId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"UserId"
)
.
IsUnique
();
b
.
ToTable
(
"Employees"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Identity.Entities.Permission"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Permission"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Identity.Entities.Role"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Roles"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Identity.Entities.User"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Email"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"HashedPassword"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"UserName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Users"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Attachment"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"AttachmenDescription"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"AttachmentName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"AttachmentUrl"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
?>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ProjectId"
);
b
.
ToTable
(
"Attachment"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.EmployeeParticipate"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"EmployeeId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"PartialTimeRatio"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"Role"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"EmployeeId"
);
b
.
HasIndex
(
"ProjectId"
);
b
.
ToTable
(
"EmployeeParticipate"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.FinincialSpending"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"CostType"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"Description"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
?>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ProjectId"
);
b
.
ToTable
(
"FinincialSpending"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Project"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
?>(
"CustomerId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"ExecuterId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"ProjectManagerId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"ProjectStatusId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"ProposerId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"TeamLeaderId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"CustomerId"
);
b
.
HasIndex
(
"ExecuterId"
);
b
.
HasIndex
(
"ProjectManagerId"
);
b
.
HasIndex
(
"ProjectStatusId"
);
b
.
HasIndex
(
"ProposerId"
);
b
.
HasIndex
(
"TeamLeaderId"
);
b
.
ToTable
(
"Projects"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Step"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"CurrentCompletionRatio"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"Description"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"Duration"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
DateTime
>(
"StartDate"
)
.
HasColumnType
(
"datetime2"
);
b
.
Property
<
string
>(
"StepName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"Weight"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ProjectId"
);
b
.
ToTable
(
"Steps"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.ProjectsStatus.Entites.ProjectStatus"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Code"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"Details"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"ProjectStatus"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.EmployeeTrack"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"AssignedWork"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"EmloyeeId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"PerformedWork"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"TrackId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"WorkingHours"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"EmloyeeId"
);
b
.
HasIndex
(
"TrackId"
);
b
.
ToTable
(
"EmployeeTrack"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.StepTrack"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"ExecutionRatio"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"StepId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"TrackId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"StepId"
);
b
.
HasIndex
(
"TrackId"
);
b
.
ToTable
(
"StepTracks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Track"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
DateTime
>(
"TrackDate"
)
.
HasColumnType
(
"datetime2"
);
b
.
Property
<
string
>(
"TrackNote"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ProjectId"
);
b
.
ToTable
(
"Tracks"
);
});
modelBuilder
.
Entity
(
"PermissionRole"
,
b
=>
{
b
.
Property
<
int
>(
"PermissionsId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"RolesId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"PermissionsId"
,
"RolesId"
);
b
.
HasIndex
(
"RolesId"
);
b
.
ToTable
(
"PermissionRole"
);
});
modelBuilder
.
Entity
(
"RoleUser"
,
b
=>
{
b
.
Property
<
int
>(
"RolesId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"UsersId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"RolesId"
,
"UsersId"
);
b
.
HasIndex
(
"UsersId"
);
b
.
ToTable
(
"RoleUser"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Customers.Aggregate.Customer"
,
b
=>
{
b
.
OwnsMany
(
"PSManagement.Domain.Customers.Entities.ContactInfo"
,
"ContactInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"CustomerId"
)
.
HasColumnType
(
"int"
);
b1
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"ContactType"
)
.
HasColumnType
(
"nvarchar(max)"
);
b1
.
Property
<
string
>(
"ContactValue"
)
.
HasColumnType
(
"nvarchar(max)"
);
b1
.
HasKey
(
"CustomerId"
,
"Id"
);
b1
.
ToTable
(
"ContactInfo"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"CustomerId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Customers.ValueObjects.Address"
,
"Address"
,
b1
=>
{
b1
.
Property
<
int
>(
"CustomerId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"City"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"City"
);
b1
.
Property
<
string
>(
"StreetName"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"StreetName"
);
b1
.
Property
<
int
>(
"StreetNumber"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"StreetNumber"
);
b1
.
Property
<
int
>(
"ZipCode"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"ZipCode"
);
b1
.
HasKey
(
"CustomerId"
);
b1
.
ToTable
(
"Customers"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"CustomerId"
);
});
b
.
Navigation
(
"Address"
);
b
.
Navigation
(
"ContactInfo"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Employee"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.User"
,
"User"
)
.
WithOne
(
"Employee"
)
.
HasForeignKey
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"UserId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
OwnsOne
(
"PSManagement.Domain.Employees.Entities.Availability"
,
"Availability"
,
b1
=>
{
b1
.
Property
<
int
>(
"EmployeeId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
int
>(
"CurrentWorkingHours"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"CurrentWorkingHours"
);
b1
.
Property
<
bool
>(
"IsAvailable"
)
.
HasColumnType
(
"bit"
)
.
HasColumnName
(
"IsAvailable"
);
b1
.
HasKey
(
"EmployeeId"
);
b1
.
ToTable
(
"Employees"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"EmployeeId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Employees.Entities.PersonalInfo"
,
"PersonalInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"EmployeeId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"FirstName"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"FirstName"
);
b1
.
Property
<
string
>(
"LastName"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"LastName"
);
b1
.
HasKey
(
"EmployeeId"
);
b1
.
ToTable
(
"Employees"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"EmployeeId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Employees.Entities.WorkInfo"
,
"WorkInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"EmployeeId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"WorkJob"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"WorkJob"
);
b1
.
Property
<
string
>(
"WorkType"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"WorkType"
);
b1
.
HasKey
(
"EmployeeId"
);
b1
.
ToTable
(
"Employees"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"EmployeeId"
);
});
b
.
Navigation
(
"Availability"
);
b
.
Navigation
(
"PersonalInfo"
);
b
.
Navigation
(
"User"
);
b
.
Navigation
(
"WorkInfo"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Attachment"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Entities.Project"
,
null
)
.
WithMany
(
"Attachments"
)
.
HasForeignKey
(
"ProjectId"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.EmployeeParticipate"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"Employee"
)
.
WithMany
(
"EmployeeParticipates"
)
.
HasForeignKey
(
"EmployeeId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Projects.Entities.Project"
,
"Project"
)
.
WithMany
(
"EmployeeParticipates"
)
.
HasForeignKey
(
"ProjectId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
Navigation
(
"Employee"
);
b
.
Navigation
(
"Project"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.FinincialSpending"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Entities.Project"
,
null
)
.
WithMany
(
"FinincialSpending"
)
.
HasForeignKey
(
"ProjectId"
);
b
.
OwnsOne
(
"PSManagement.SharedKernel.ValueObjects.Money"
,
"ExternalPurchase"
,
b1
=>
{
b1
.
Property
<
int
>(
"FinincialSpendingId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
int
>(
"Ammount"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"ExternalPurchaseAmmount"
);
b1
.
Property
<
string
>(
"Currency"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasDefaultValue
(
"USD"
)
.
HasColumnName
(
"ExternalPurchaseCurrency"
);
b1
.
HasKey
(
"FinincialSpendingId"
);
b1
.
ToTable
(
"FinincialSpending"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"FinincialSpendingId"
);
});
b
.
OwnsOne
(
"PSManagement.SharedKernel.ValueObjects.Money"
,
"LocalPurchase"
,
b1
=>
{
b1
.
Property
<
int
>(
"FinincialSpendingId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
int
>(
"Ammount"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"LocalPurchaseAmmount"
);
b1
.
Property
<
string
>(
"Currency"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"nvarchar(max)"
)
.
HasDefaultValue
(
"SP"
)
.
HasColumnName
(
"LocalPurchaseCurrency"
);
b1
.
HasKey
(
"FinincialSpendingId"
);
b1
.
ToTable
(
"FinincialSpending"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"FinincialSpendingId"
);
});
b
.
Navigation
(
"ExternalPurchase"
);
b
.
Navigation
(
"LocalPurchase"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Project"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Customers.Aggregate.Customer"
,
null
)
.
WithMany
(
"Projects"
)
.
HasForeignKey
(
"CustomerId"
);
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Department"
,
"Executer"
)
.
WithMany
()
.
HasForeignKey
(
"ExecuterId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"ProjectManager"
)
.
WithMany
()
.
HasForeignKey
(
"ProjectManagerId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
);
b
.
HasOne
(
"PSManagement.Domain.ProjectsStatus.Entites.ProjectStatus"
,
"ProjectStatus"
)
.
WithMany
()
.
HasForeignKey
(
"ProjectStatusId"
);
b
.
HasOne
(
"PSManagement.Domain.Customers.Aggregate.Customer"
,
"Proposer"
)
.
WithMany
()
.
HasForeignKey
(
"ProposerId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"TeamLeader"
)
.
WithMany
()
.
HasForeignKey
(
"TeamLeaderId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
);
b
.
OwnsOne
(
"PSManagement.Domain.Projects.ValueObjects.Aggreement"
,
"ProjectAggreement"
,
b1
=>
{
b1
.
Property
<
int
>(
"ProjectId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
DateTime
>(
"AggreementDate"
)
.
HasColumnType
(
"datetime2"
)
.
HasColumnName
(
"AggreementDate"
);
b1
.
Property
<
int
>(
"AggreementNumber"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"AggreementNumber"
);
b1
.
HasKey
(
"ProjectId"
);
b1
.
ToTable
(
"Projects"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"ProjectId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Projects.ValueObjects.FinincialFund"
,
"FinincialFund"
,
b1
=>
{
b1
.
Property
<
int
>(
"ProjectId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"FinicialStatus"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"FinicialStatus"
);
b1
.
Property
<
string
>(
"Source"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"FinicialSource"
);
b1
.
HasKey
(
"ProjectId"
);
b1
.
ToTable
(
"Projects"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"ProjectId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Projects.ValueObjects.ProjectInfo"
,
"ProjectInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"ProjectId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"Code"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"Code"
);
b1
.
Property
<
string
>(
"Description"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"Description"
);
b1
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"Name"
);
b1
.
HasKey
(
"ProjectId"
);
b1
.
ToTable
(
"Projects"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"ProjectId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Projects.ValueObjects.ProposalInfo"
,
"ProposalInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"ProjectId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
DateTime
>(
"ProposingBookDate"
)
.
HasColumnType
(
"datetime2"
)
.
HasColumnName
(
"ProposingBookDate"
);
b1
.
Property
<
int
>(
"ProposingBookNumber"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"ProposingBookNumber"
);
b1
.
HasKey
(
"ProjectId"
);
b1
.
ToTable
(
"Projects"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"ProjectId"
);
});
b
.
Navigation
(
"Executer"
);
b
.
Navigation
(
"FinincialFund"
);
b
.
Navigation
(
"ProjectAggreement"
);
b
.
Navigation
(
"ProjectInfo"
);
b
.
Navigation
(
"ProjectManager"
);
b
.
Navigation
(
"ProjectStatus"
);
b
.
Navigation
(
"ProposalInfo"
);
b
.
Navigation
(
"Proposer"
);
b
.
Navigation
(
"TeamLeader"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Step"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Entities.Project"
,
"Project"
)
.
WithMany
(
"Steps"
)
.
HasForeignKey
(
"ProjectId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
Navigation
(
"Project"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.EmployeeTrack"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"Employee"
)
.
WithMany
(
"EmployeeTracks"
)
.
HasForeignKey
(
"EmloyeeId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Tracking.Track"
,
"Track"
)
.
WithMany
(
"EmployeeTracks"
)
.
HasForeignKey
(
"TrackId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
Navigation
(
"Employee"
);
b
.
Navigation
(
"Track"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.StepTrack"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Entities.Step"
,
"Step"
)
.
WithMany
(
"StepTracks"
)
.
HasForeignKey
(
"StepId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Tracking.Track"
,
"Track"
)
.
WithMany
(
"StepTracks"
)
.
HasForeignKey
(
"TrackId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
)
.
IsRequired
();
b
.
Navigation
(
"Step"
);
b
.
Navigation
(
"Track"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Track"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Entities.Project"
,
"Project"
)
.
WithMany
(
"Tracks"
)
.
HasForeignKey
(
"ProjectId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
)
.
IsRequired
();
b
.
Navigation
(
"Project"
);
});
modelBuilder
.
Entity
(
"PermissionRole"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.Permission"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"PermissionsId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.Role"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"RolesId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
});
modelBuilder
.
Entity
(
"RoleUser"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.Role"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"RolesId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.User"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"UsersId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Customers.Aggregate.Customer"
,
b
=>
{
b
.
Navigation
(
"Projects"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Employee"
,
b
=>
{
b
.
Navigation
(
"EmployeeParticipates"
);
b
.
Navigation
(
"EmployeeTracks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Identity.Entities.User"
,
b
=>
{
b
.
Navigation
(
"Employee"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Project"
,
b
=>
{
b
.
Navigation
(
"Attachments"
);
b
.
Navigation
(
"EmployeeParticipates"
);
b
.
Navigation
(
"FinincialSpending"
);
b
.
Navigation
(
"Steps"
);
b
.
Navigation
(
"Tracks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Step"
,
b
=>
{
b
.
Navigation
(
"StepTracks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Track"
,
b
=>
{
b
.
Navigation
(
"EmployeeTracks"
);
b
.
Navigation
(
"StepTracks"
);
});
#pragma warning restore 612, 618
}
}
}
PSManagement.Infrastructure.Persistence/Migrations/2024080
6125539_AddDomainUpdate2
.cs
→
PSManagement.Infrastructure.Persistence/Migrations/2024080
8173901_AddDomainsUpdate3
.cs
View file @
1d5f4c82
...
...
@@ -2,31 +2,23 @@
namespace
PSManagement.Infrastructure.Persistence.Migrations
{
public
partial
class
AddDomain
Update2
:
Migration
public
partial
class
AddDomain
sUpdate3
:
Migration
{
protected
override
void
Up
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
DropForeignKey
(
name
:
"FK_Projects_
Employees_TeamLead
erId"
,
name
:
"FK_Projects_
Customers_Propos
erId"
,
table
:
"Projects"
);
migrationBuilder
.
DropForeignKey
(
name
:
"FK_Projects_
ProjectType_ProjectType
Id"
,
name
:
"FK_Projects_
Departments_Executer
Id"
,
table
:
"Projects"
);
migrationBuilder
.
DropTable
(
name
:
"ProjectType"
);
migrationBuilder
.
DropIndex
(
name
:
"IX_Projects_ProjectTypeId"
,
table
:
"Projects"
);
migrationBuilder
.
DropColumn
(
name
:
"ProjectTypeId"
,
table
:
"Projects"
);
name
:
"Item"
);
migrationBuilder
.
AlterColumn
<
int
>(
name
:
"
TeamLead
erId"
,
name
:
"
Propos
erId"
,
table
:
"Projects"
,
type
:
"int"
,
nullable
:
false
,
...
...
@@ -35,43 +27,48 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
oldType
:
"int"
,
oldNullable
:
true
);
migrationBuilder
.
AddColumn
<
string
>(
name
:
"FinicialSource"
,
table
:
"Projects"
,
type
:
"nvarchar(max)"
,
nullable
:
true
);
migrationBuilder
.
AddColumn
<
string
>(
name
:
"FinicialStatus"
,
migrationBuilder
.
AlterColumn
<
int
>(
name
:
"ExecuterId"
,
table
:
"Projects"
,
type
:
"nvarchar(max)"
,
nullable
:
true
);
type
:
"int"
,
nullable
:
false
,
defaultValue
:
0
,
oldClrType
:
typeof
(
int
),
oldType
:
"int"
,
oldNullable
:
true
);
migrationBuilder
.
AddColumn
<
int
>(
name
:
"
ProjectManag
erId"
,
name
:
"
Custom
erId"
,
table
:
"Projects"
,
type
:
"int"
,
nullable
:
false
,
defaultValue
:
0
);
nullable
:
true
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_Projects_ProjectManagerId"
,
name
:
"IX_Projects_CustomerId"
,
table
:
"Projects"
,
column
:
"CustomerId"
);
migrationBuilder
.
AddForeignKey
(
name
:
"FK_Projects_Customers_CustomerId"
,
table
:
"Projects"
,
column
:
"ProjectManagerId"
);
column
:
"CustomerId"
,
principalTable
:
"Customers"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Restrict
);
migrationBuilder
.
AddForeignKey
(
name
:
"FK_Projects_
Employees_ProjectManag
erId"
,
name
:
"FK_Projects_
Customers_Propos
erId"
,
table
:
"Projects"
,
column
:
"Pro
jectManag
erId"
,
principalTable
:
"
Employee
s"
,
column
:
"Pro
pos
erId"
,
principalTable
:
"
Customer
s"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Cascade
);
migrationBuilder
.
AddForeignKey
(
name
:
"FK_Projects_
Employees_TeamLead
erId"
,
name
:
"FK_Projects_
Departments_Execut
erId"
,
table
:
"Projects"
,
column
:
"
TeamLead
erId"
,
principalTable
:
"
Employee
s"
,
column
:
"
Execut
erId"
,
principalTable
:
"
Department
s"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Cascade
);
}
...
...
@@ -79,76 +76,70 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
protected
override
void
Down
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
DropForeignKey
(
name
:
"FK_Projects_
Employees_ProjectManag
erId"
,
name
:
"FK_Projects_
Customers_Custom
erId"
,
table
:
"Projects"
);
migrationBuilder
.
DropForeignKey
(
name
:
"FK_Projects_Employees_TeamLeaderId"
,
table
:
"Projects"
);
migrationBuilder
.
DropIndex
(
name
:
"IX_Projects_ProjectManagerId"
,
name
:
"FK_Projects_Customers_ProposerId"
,
table
:
"Projects"
);
migrationBuilder
.
Drop
Column
(
name
:
"F
inicialSource
"
,
migrationBuilder
.
Drop
ForeignKey
(
name
:
"F
K_Projects_Departments_ExecuterId
"
,
table
:
"Projects"
);
migrationBuilder
.
Drop
Column
(
name
:
"
FinicialStatus
"
,
migrationBuilder
.
Drop
Index
(
name
:
"
IX_Projects_CustomerId
"
,
table
:
"Projects"
);
migrationBuilder
.
DropColumn
(
name
:
"
ProjectManag
erId"
,
name
:
"
Custom
erId"
,
table
:
"Projects"
);
migrationBuilder
.
AlterColumn
<
int
>(
name
:
"
TeamLead
erId"
,
name
:
"
Propos
erId"
,
table
:
"Projects"
,
type
:
"int"
,
nullable
:
true
,
oldClrType
:
typeof
(
int
),
oldType
:
"int"
);
migrationBuilder
.
A
dd
Column
<
int
>(
name
:
"
ProjectType
Id"
,
migrationBuilder
.
A
lter
Column
<
int
>(
name
:
"
Executer
Id"
,
table
:
"Projects"
,
type
:
"int"
,
nullable
:
true
);
nullable
:
true
,
oldClrType
:
typeof
(
int
),
oldType
:
"int"
);
migrationBuilder
.
CreateTable
(
name
:
"
ProjectType
"
,
name
:
"
Item
"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
.
Annotation
(
"SqlServer:Identity"
,
"1, 1"
),
Description
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
),
TypeName
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
),
WorkerCount
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
ItemDescription
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
),
ItemName
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
),
Ammount
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
true
),
Currency
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_
ProjectType
"
,
x
=>
x
.
Id
);
table
.
PrimaryKey
(
"PK_
Item
"
,
x
=>
x
.
Id
);
});
migrationBuilder
.
CreateIndex
(
name
:
"IX_Projects_ProjectTypeId"
,
table
:
"Projects"
,
column
:
"ProjectTypeId"
);
migrationBuilder
.
AddForeignKey
(
name
:
"FK_Projects_
Employees_TeamLead
erId"
,
name
:
"FK_Projects_
Customers_Propos
erId"
,
table
:
"Projects"
,
column
:
"
TeamLead
erId"
,
principalTable
:
"
Employee
s"
,
column
:
"
Propos
erId"
,
principalTable
:
"
Customer
s"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Restrict
);
migrationBuilder
.
AddForeignKey
(
name
:
"FK_Projects_
ProjectType_ProjectType
Id"
,
name
:
"FK_Projects_
Departments_Executer
Id"
,
table
:
"Projects"
,
column
:
"
ProjectType
Id"
,
principalTable
:
"
ProjectType
"
,
column
:
"
Executer
Id"
,
principalTable
:
"
Departments
"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Restrict
);
}
...
...
PSManagement.Infrastructure.Persistence/Migrations/AppDbContextModelSnapshot.cs
View file @
1d5f4c82
...
...
@@ -63,16 +63,11 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b
.
Property
<
int
>(
"HIASTId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"TrackId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"UserId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"TrackId"
);
b
.
HasIndex
(
"UserId"
)
.
IsUnique
();
...
...
@@ -130,43 +125,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b
.
ToTable
(
"Users"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Aggregate.Project"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
?>(
"ExecuterId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"ProjectManagerId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"ProjectStatusId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"ProposerId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"TeamLeaderId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ExecuterId"
);
b
.
HasIndex
(
"ProjectManagerId"
);
b
.
HasIndex
(
"ProjectStatusId"
);
b
.
HasIndex
(
"ProposerId"
);
b
.
HasIndex
(
"TeamLeaderId"
);
b
.
ToTable
(
"Projects"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Attachment"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
...
...
@@ -221,46 +179,72 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b
.
ToTable
(
"EmployeeParticipate"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.
ProjectStatus
"
,
b
=>
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.
FinincialSpending
"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Co
d
e"
)
b
.
Property
<
string
>(
"Co
stTyp
e"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"De
tails
"
)
b
.
Property
<
string
>(
"De
scription
"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"Name
"
)
.
HasColumnType
(
"
nvarchar(max)
"
);
b
.
Property
<
int
?>(
"ProjectId
"
)
.
HasColumnType
(
"
int
"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"ProjectStatus"
);
b
.
HasIndex
(
"ProjectId"
);
b
.
ToTable
(
"FinincialSpending"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.
Steps.Entities.Item
"
,
b
=>
modelBuilder
.
Entity
(
"PSManagement.Domain.
Projects.Entities.Project
"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"ItemDescription
"
)
.
HasColumnType
(
"
nvarchar(max)
"
);
b
.
Property
<
int
?>(
"CustomerId
"
)
.
HasColumnType
(
"
int
"
);
b
.
Property
<
string
>(
"ItemName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"ExecuterId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"ProjectManagerId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"ProjectStatusId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"ProposerId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"TeamLeaderId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Items"
);
b
.
HasIndex
(
"CustomerId"
);
b
.
HasIndex
(
"ExecuterId"
);
b
.
HasIndex
(
"ProjectManagerId"
);
b
.
HasIndex
(
"ProjectStatusId"
);
b
.
HasIndex
(
"ProposerId"
);
b
.
HasIndex
(
"TeamLeaderId"
);
b
.
ToTable
(
"Projects"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.
Step
s.Entities.Step"
,
b
=>
modelBuilder
.
Entity
(
"PSManagement.Domain.
Project
s.Entities.Step"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
...
...
@@ -295,69 +279,56 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b
.
ToTable
(
"Steps"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.
Tracking.EmployeeTrack
"
,
b
=>
modelBuilder
.
Entity
(
"PSManagement.Domain.
ProjectsStatus.Entites.ProjectStatus
"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"
AssignedWork
"
)
b
.
Property
<
string
>(
"
Code
"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"EmloyeeId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"PerformedWork"
)
b
.
Property
<
string
>(
"Details"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"TrackId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"WorkingHours"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"EmloyeeId"
);
b
.
HasIndex
(
"TrackId"
);
b
.
ToTable
(
"EmployeeTrack"
);
b
.
ToTable
(
"ProjectStatus"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.E
ntities.EmployeeWor
k"
,
b
=>
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.E
mployeeTrac
k"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"ContributingRatio
"
)
.
HasColumnType
(
"
int
"
);
b
.
Property
<
string
>(
"AssignedWork
"
)
.
HasColumnType
(
"
nvarchar(max)
"
);
b
.
Property
<
int
>(
"Em
p
loyeeId"
)
b
.
Property
<
int
>(
"EmloyeeId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"EmployeeWorkId
"
)
.
HasColumnType
(
"
int
"
);
b
.
Property
<
string
>(
"PerformedWork
"
)
.
HasColumnType
(
"
nvarchar(max)
"
);
b
.
Property
<
int
>(
"
HoursWorke
d"
)
b
.
Property
<
int
>(
"
TrackI
d"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"Notes"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"StepTrackId"
)
b
.
Property
<
int
>(
"WorkingHours"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"Em
p
loyeeId"
);
b
.
HasIndex
(
"EmloyeeId"
);
b
.
HasIndex
(
"
Step
TrackId"
);
b
.
HasIndex
(
"TrackId"
);
b
.
ToTable
(
"Employee
Works
"
);
b
.
ToTable
(
"Employee
Track
"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.StepTrack"
,
b
=>
...
...
@@ -502,10 +473,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Employee"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Tracking.Track"
,
null
)
.
WithMany
(
"TrackedEmployees"
)
.
HasForeignKey
(
"TrackId"
);
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.User"
,
"User"
)
.
WithOne
(
"Employee"
)
.
HasForeignKey
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"UserId"
)
...
...
@@ -558,38 +525,157 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
.
HasForeignKey
(
"EmployeeId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Employees.Entities.WorkInfo"
,
"WorkInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"EmployeeId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"WorkJob"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"WorkJob"
);
b1
.
Property
<
string
>(
"WorkType"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"WorkType"
);
b1
.
HasKey
(
"EmployeeId"
);
b1
.
ToTable
(
"Employees"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"EmployeeId"
);
});
b
.
Navigation
(
"Availability"
);
b
.
Navigation
(
"PersonalInfo"
);
b
.
Navigation
(
"User"
);
b
.
Navigation
(
"WorkInfo"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Aggregate.Project"
,
b
=>
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Attachment"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Entities.Project"
,
null
)
.
WithMany
(
"Attachments"
)
.
HasForeignKey
(
"ProjectId"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.EmployeeParticipate"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"Employee"
)
.
WithMany
(
"EmployeeParticipates"
)
.
HasForeignKey
(
"EmployeeId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Projects.Entities.Project"
,
"Project"
)
.
WithMany
(
"EmployeeParticipates"
)
.
HasForeignKey
(
"ProjectId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
Navigation
(
"Employee"
);
b
.
Navigation
(
"Project"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.FinincialSpending"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Entities.Project"
,
null
)
.
WithMany
(
"FinincialSpending"
)
.
HasForeignKey
(
"ProjectId"
);
b
.
OwnsOne
(
"PSManagement.SharedKernel.ValueObjects.Money"
,
"ExternalPurchase"
,
b1
=>
{
b1
.
Property
<
int
>(
"FinincialSpendingId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
int
>(
"Ammount"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"ExternalPurchaseAmmount"
);
b1
.
Property
<
string
>(
"Currency"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasDefaultValue
(
"USD"
)
.
HasColumnName
(
"ExternalPurchaseCurrency"
);
b1
.
HasKey
(
"FinincialSpendingId"
);
b1
.
ToTable
(
"FinincialSpending"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"FinincialSpendingId"
);
});
b
.
OwnsOne
(
"PSManagement.SharedKernel.ValueObjects.Money"
,
"LocalPurchase"
,
b1
=>
{
b1
.
Property
<
int
>(
"FinincialSpendingId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
int
>(
"Ammount"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"LocalPurchaseAmmount"
);
b1
.
Property
<
string
>(
"Currency"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"nvarchar(max)"
)
.
HasDefaultValue
(
"SP"
)
.
HasColumnName
(
"LocalPurchaseCurrency"
);
b1
.
HasKey
(
"FinincialSpendingId"
);
b1
.
ToTable
(
"FinincialSpending"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"FinincialSpendingId"
);
});
b
.
Navigation
(
"ExternalPurchase"
);
b
.
Navigation
(
"LocalPurchase"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Project"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Customers.Aggregate.Customer"
,
null
)
.
WithMany
(
"Projects"
)
.
HasForeignKey
(
"CustomerId"
);
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Department"
,
"Executer"
)
.
WithMany
()
.
HasForeignKey
(
"ExecuterId"
);
.
HasForeignKey
(
"ExecuterId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"ProjectManager"
)
.
WithMany
()
.
HasForeignKey
(
"ProjectManagerId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
);
b
.
HasOne
(
"PSManagement.Domain.Projects
.Entiti
es.ProjectStatus"
,
"ProjectStatus"
)
b
.
HasOne
(
"PSManagement.Domain.Projects
Status.Entit
es.ProjectStatus"
,
"ProjectStatus"
)
.
WithMany
()
.
HasForeignKey
(
"ProjectStatusId"
);
b
.
HasOne
(
"PSManagement.Domain.Customers.Aggregate.Customer"
,
"Proposer"
)
.
WithMany
(
"Projects"
)
.
HasForeignKey
(
"ProposerId"
);
.
WithMany
()
.
HasForeignKey
(
"ProposerId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"TeamLeader"
)
.
WithMany
()
.
HasForeignKey
(
"TeamLeaderId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
);
b
.
OwnsOne
(
"PSManagement.Domain.Projects.
Aggregate
.Aggreement"
,
"ProjectAggreement"
,
b1
=>
b
.
OwnsOne
(
"PSManagement.Domain.Projects.
ValueObjects
.Aggreement"
,
"ProjectAggreement"
,
b1
=>
{
b1
.
Property
<
int
>(
"ProjectId"
)
.
ValueGeneratedOnAdd
()
...
...
@@ -612,7 +698,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
.
HasForeignKey
(
"ProjectId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Projects.
Aggregate
.FinincialFund"
,
"FinincialFund"
,
b1
=>
b
.
OwnsOne
(
"PSManagement.Domain.Projects.
ValueObjects
.FinincialFund"
,
"FinincialFund"
,
b1
=>
{
b1
.
Property
<
int
>(
"ProjectId"
)
.
ValueGeneratedOnAdd
()
...
...
@@ -635,7 +721,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
.
HasForeignKey
(
"ProjectId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Projects.
Aggregate
.ProjectInfo"
,
"ProjectInfo"
,
b1
=>
b
.
OwnsOne
(
"PSManagement.Domain.Projects.
ValueObjects
.ProjectInfo"
,
"ProjectInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"ProjectId"
)
.
ValueGeneratedOnAdd
()
...
...
@@ -662,7 +748,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
.
HasForeignKey
(
"ProjectId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Projects.
Aggregate
.ProposalInfo"
,
"ProposalInfo"
,
b1
=>
b
.
OwnsOne
(
"PSManagement.Domain.Projects.
ValueObjects
.ProposalInfo"
,
"ProposalInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"ProjectId"
)
.
ValueGeneratedOnAdd
()
...
...
@@ -704,63 +790,9 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b
.
Navigation
(
"TeamLeader"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Attachment"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Aggregate.Project"
,
null
)
.
WithMany
(
"Attachments"
)
.
HasForeignKey
(
"ProjectId"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.EmployeeParticipate"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"Employee"
)
.
WithMany
(
"EmployeeParticipates"
)
.
HasForeignKey
(
"EmployeeId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Projects.Aggregate.Project"
,
"Project"
)
.
WithMany
(
"EmployeeParticipates"
)
.
HasForeignKey
(
"ProjectId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
Navigation
(
"Employee"
);
b
.
Navigation
(
"Project"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Steps.Entities.Item"
,
b
=>
{
b
.
OwnsOne
(
"PSManagement.SharedKernel.ValueObjects.Money"
,
"Price"
,
b1
=>
{
b1
.
Property
<
int
>(
"ItemId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
int
>(
"Ammount"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"Ammount"
);
b1
.
Property
<
string
>(
"Currency"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"Currency"
);
b1
.
HasKey
(
"ItemId"
);
b1
.
ToTable
(
"Items"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"ItemId"
);
});
b
.
Navigation
(
"Price"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Steps.Entities.Step"
,
b
=>
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Step"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.
Aggregate
.Project"
,
"Project"
)
b
.
HasOne
(
"PSManagement.Domain.Projects.
Entities
.Project"
,
"Project"
)
.
WithMany
(
"Steps"
)
.
HasForeignKey
(
"ProjectId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
...
...
@@ -788,28 +820,9 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b
.
Navigation
(
"Track"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.EmployeeWork"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"Employee"
)
.
WithMany
()
.
HasForeignKey
(
"EmployeeId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Tracking.Entities.StepTrack"
,
"StepTrack"
)
.
WithMany
()
.
HasForeignKey
(
"StepTrackId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
Navigation
(
"Employee"
);
b
.
Navigation
(
"StepTrack"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.StepTrack"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.
Step
s.Entities.Step"
,
"Step"
)
b
.
HasOne
(
"PSManagement.Domain.
Project
s.Entities.Step"
,
"Step"
)
.
WithMany
(
"StepTracks"
)
.
HasForeignKey
(
"StepId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
)
...
...
@@ -828,7 +841,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Track"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.
Aggregate
.Project"
,
"Project"
)
b
.
HasOne
(
"PSManagement.Domain.Projects.
Entities
.Project"
,
"Project"
)
.
WithMany
(
"Tracks"
)
.
HasForeignKey
(
"ProjectId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
)
...
...
@@ -884,18 +897,20 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b
.
Navigation
(
"Employee"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.
Aggregate
.Project"
,
b
=>
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.
Entities
.Project"
,
b
=>
{
b
.
Navigation
(
"Attachments"
);
b
.
Navigation
(
"EmployeeParticipates"
);
b
.
Navigation
(
"FinincialSpending"
);
b
.
Navigation
(
"Steps"
);
b
.
Navigation
(
"Tracks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.
Step
s.Entities.Step"
,
b
=>
modelBuilder
.
Entity
(
"PSManagement.Domain.
Project
s.Entities.Step"
,
b
=>
{
b
.
Navigation
(
"StepTracks"
);
});
...
...
@@ -905,8 +920,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b
.
Navigation
(
"EmployeeTracks"
);
b
.
Navigation
(
"StepTracks"
);
b
.
Navigation
(
"TrackedEmployees"
);
});
#pragma warning restore 612, 618
}
...
...
PSManagement.Infrastructure.Persistence/Repositories/ProjectRepository/ProjectsRepository.cs
0 → 100644
View file @
1d5f4c82
using
PSManagement.Domain.Projects.Repositories
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
PSManagement.Infrastructure.Persistence.Repositories.ProjectRepository
{
public
class
ProjectsRepository
:
IProjectsRepository
{
}
}
PSManagement.Infrastructure/DI/DependencyInjection.cs
View file @
1d5f4c82
...
...
@@ -2,9 +2,9 @@
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.Extensions.Configuration
;
using
Microsoft.Extensions.DependencyInjection
;
using
PSManagement.Application.Common.Services
;
using
PSManagement.Application.Contracts.Authentication
;
using
PSManagement.Application.Contracts.Authorization
;
using
PSManagement.Application.Contracts.Providers
;
using
PSManagement.Domain.Identity.Repositories
;
using
PSManagement.Infrastructure.Authentication
;
using
PSManagement.Infrastructure.Services
;
...
...
PSManagement.Infrastructure/Services/Authentication/AuthenticationService.cs
View file @
1d5f4c82
...
...
@@ -30,7 +30,7 @@ namespace PSManagement.Infrastructure.Services.Authentication
return
Result
.
Fail
<
AuthenticationResult
>(
UserErrors
.
InvalidLoginAttempt
);
}
String
token
=
_jwtTokenGenerator
.
GenerateToken
(
u
.
Id
,
u
.
UserName
,
u
.
UserName
,
u
.
Email
);
String
token
=
_jwtTokenGenerator
.
GenerateToken
(
u
);
return
new
AuthenticationResult
{
Id
=
u
.
Id
,
...
...
@@ -52,14 +52,15 @@ namespace PSManagement.Infrastructure.Services.Authentication
HashedPassword
=
password
});
// generate token
String
token
=
_jwtTokenGenerator
.
GenerateToken
(
u
ser
.
Id
,
userName
,
""
,
email
);
String
token
=
_jwtTokenGenerator
.
GenerateToken
(
u
);
return
Result
.
Ok
<
AuthenticationResult
>(
new
AuthenticationResult
{
Id
=
user
.
Id
,
Email
=
email
,
FirstName
=
""
,
LastName
=
""
,
FirstName
=
user
.
Employee
?.
PersonalInfo
.
FirstName
,
LastName
=
user
.
Employee
?.
PersonalInfo
.
LastName
,
Roles
=
user
.
Roles
,
Token
=
token
});
...
...
PSManagement.Infrastructure/Services/Authorization/RoleService.cs
0 → 100644
View file @
1d5f4c82
using
FluentResults
;
using
PSManagement.Application.Contracts.Authorization
;
using
PSManagement.Domain.Identity.Entities
;
using
PSManagement.SharedKernel.DomainException
;
using
PSManagement.SharedKernel.Repositories
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
PSManagement.Infrastructure.Services.Authorization
{
public
class
RoleService
:
IRoleService
{
private
readonly
IRepository
<
Role
>
_roleRepository
;
public
RoleService
(
IRepository
<
Role
>
roleRepository
)
{
_roleRepository
=
roleRepository
;
}
public
async
Task
<
Result
>
CreateRoleAsync
(
string
roleName
)
{
var
role_exist
=
await
_roleRepository
.
ListAsync
();
role_exist
=
role_exist
.
Where
(
e
=>
e
.
Name
==
roleName
);
if
(
role_exist
is
null
)
// check role exist status
{
var
result
=
await
_roleRepository
.
AddAsync
(
new
Role
{
Name
=
roleName
});
// check if the role has been added succesfully
if
(
result
is
not
null
)
{
return
Result
.
Ok
();
}
else
{
return
Result
.
Fail
(
new
Error
(
"Failed to add the role."
));
}
}
return
Result
.
Fail
(
new
Error
(
"Failed to add the role."
));
}
public
async
Task
<
Result
>
DeleteRoleAsync
(
int
roleId
)
{
var
roleDetails
=
await
_roleRepository
.
GetByIdAsync
(
roleId
);
if
(
roleDetails
==
null
)
{
return
Result
.
Fail
(
new
Error
(
"The Role Not Found."
));
}
if
(
roleDetails
.
Name
==
"Admin"
)
{
return
Result
.
Fail
(
new
Error
(
"You Cannot Remove the admin role."
));
}
await
_roleRepository
.
DeleteAsync
(
roleDetails
);
return
Result
.
Ok
()
;
}
public
async
Task
<
Result
<
Role
>>
GetRoleByIdAsync
(
int
id
)
{
var
roles
=
await
_roleRepository
.
GetByIdAsync
(
id
);
if
(
roles
is
null
)
{
return
Result
.
Fail
(
new
Error
(
"The Role not found."
));
}
return
Result
.
Ok
(
roles
);
}
public
async
Task
<
List
<
Role
>>
GetRolesAsync
()
{
var
result
=
await
_roleRepository
.
ListAsync
();
return
result
.
ToList
();
}
public
async
Task
<
Result
<
Role
>>
UpdateRole
(
int
id
,
string
roleName
)
{
var
role
=
await
_roleRepository
.
GetByIdAsync
(
id
);
if
(
role
is
null
)
{
return
Result
.
Fail
(
new
Error
(
"The Role not found."
));
}
role
.
Name
=
roleName
;
role
=
await
_roleRepository
.
UpdateAsync
(
role
);
return
Result
.
Ok
(
role
);
}
}
}
PSManagement.Infrastructure/Services/DateTimeProvider.cs
View file @
1d5f4c82
using
PSManagement.Application.Co
mmon.Service
s
;
using
PSManagement.Application.Co
ntracts.Provider
s
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
...
...
PSManagement.Infrastructure/Tokens/JwtTokenGenerator.cs
View file @
1d5f4c82
using
Microsoft.Extensions.Options
;
using
Microsoft.IdentityModel.Tokens
;
using
PSManagement.Application.Common.Services
;
using
PSManagement.Application.Contracts.Authorization
;
using
PSManagement.Domain.Identity.Entities
;
using
System
;
using
System.IdentityModel.Tokens.Jwt
;
using
System.Linq.Expressions
;
using
System.Linq
;
using
System.Security.Claims
;
using
System.Text
;
using
System.Collections.Generic
;
using
PSManagement.Application.Contracts.Providers
;
namespace
PSManagement.Infrastructure.Authentication
{
...
...
@@ -19,22 +24,23 @@ namespace PSManagement.Infrastructure.Authentication
_jwtSetting
=
jwtOptions
.
Value
;
}
public
string
GenerateToken
(
int
id
,
string
firstName
,
string
lastName
,
string
email
)
public
string
GenerateToken
(
User
user
)
{
var
signingCredentials
=
new
SigningCredentials
(
new
SymmetricSecurityKey
(
Encoding
.
UTF8
.
GetBytes
(
_jwtSetting
.
Secret
)),
SecurityAlgorithms
.
HmacSha256
);
var
claims
=
new
[]
{
new
Claim
(
JwtRegisteredClaimNames
.
Sub
,
id
.
ToString
()),
new
Claim
(
JwtRegisteredClaimNames
.
Jti
,
Guid
.
NewGuid
().
ToString
()),
new
Claim
(
JwtRegisteredClaimNames
.
Email
,
email
),
new
Claim
(
JwtRegisteredClaimNames
.
GivenName
,
firstName
),
new
Claim
(
JwtRegisteredClaimNames
.
FamilyName
,
lastName
)
List
<
Claim
>
claims
=
new
List
<
Claim
>{
new
Claim
(
JwtRegisteredClaimNames
.
Sub
,
user
.
Id
.
ToString
()),
new
Claim
(
JwtRegisteredClaimNames
.
Jti
,
Guid
.
NewGuid
().
ToString
()),
new
Claim
(
JwtRegisteredClaimNames
.
Email
,
user
.
Email
),
new
Claim
(
JwtRegisteredClaimNames
.
GivenName
,
user
.
Employee
?.
PersonalInfo
.
FirstName
),
new
Claim
(
JwtRegisteredClaimNames
.
FamilyName
,
user
.
Employee
?.
PersonalInfo
.
LastName
)
};
foreach
(
Role
role
in
user
.
Roles
)
{
claims
.
Add
(
new
Claim
(
ClaimTypes
.
Role
,
role
.
Name
));
}
var
securityToken
=
new
JwtSecurityToken
(
issuer
:
_jwtSetting
.
Issuer
,
audience
:
_jwtSetting
.
Audience
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment