Commit c1f5afe1 authored by hasan khaddour's avatar hasan khaddour

fix s.

parent c6a1b9ab
......@@ -41,8 +41,7 @@ namespace PSManagement.Api.Controllers.Authentication
Result<AuthenticationResult> result = await _authenticationService.Register(
registerRequest.Email,
registerRequest.FirstName,
registerRequest.LastName,
registerRequest.Email,
registerRequest.Password);
if (result.IsSuccess)
......
......@@ -8,7 +8,7 @@ namespace PSManagement.Application.Contracts.Authentication
public interface IAuthenticationService
{
public Task<Result<AuthenticationResult>> Login(String email , String password);
public Task<Result<AuthenticationResult>> Register(String email,String firstName ,String lastName, String password);
public Task<Result<AuthenticationResult>> Register(String email,String userName , String password);
}
......
using PSManagement.Domain.Customers.DomainEvents;
using PSManagement.Domain.Customers.Entities;
using PSManagement.Domain.Customers.ValueObjects;
using PSManagement.Domain.Projects.Aggregate;
using PSManagement.SharedKernel.Aggregate;
using System;
using System.Collections.Generic;
......@@ -15,6 +16,7 @@ namespace PSManagement.Domain.Customers.Aggregate
public Address Address { get; set; }
public String Email { get; set; }
public ICollection<ContactInfo> ContactInfo { get; private set; }
public ICollection<Project> Projects { get; private set; }
public Customer()
{
......
using PSManagement.Domain.Employees.Aggregate;
using PSManagement.SharedKernel.Aggregate;
using PSManagement.SharedKernel.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PSManagement.Domain.Departments.Aggregate
namespace PSManagement.Domain.Employees.Entities
{
public class Department :IAggregateRoot
public class Department : BaseEntity
{
public String Name { get; set; }
public string Name { get; set; }
public Department(string name)
{
Name = name;
......
using PSManagement.SharedKernel.Aggregate;
using PSManagement.Domain.Identity.Entities;
using PSManagement.Domain.Projects.Aggregate;
using PSManagement.Domain.Tracking.Entities;
using PSManagement.SharedKernel.Aggregate;
using PSManagement.SharedKernel.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PSManagement.Domain.Employees.Aggregate
namespace PSManagement.Domain.Employees.Entities
{
public class Employee :IAggregateRoot
public class Employee : BaseEntity
{
public int HIASTId{ get; set; }
public int HIASTId { get; set; }
public int UserId { get; set; }
public User User { get; set; }
public PersonalInfo PersonalInfo { get; set; }
//public ICollection<Project> Projects { get; set; }
public Availability Availability { get; set; }
public ICollection<EmployeeWork> EmployeeWorks { get; set; }
public Employee()
{
......@@ -24,15 +31,5 @@ namespace PSManagement.Domain.Employees.Aggregate
HIASTId = hiastId;
}
}
public record PersonalInfo(
String FirstName ,
String LastName
);
public record Availability (
int WorkingHours ,
Boolean IsAvailable
);
}
using PSManagement.SharedKernel.Aggregate;
using PSManagement.Domain.Employees.Entities;
using PSManagement.SharedKernel.Repositories;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PSManagement.Domain.ProjectTypes.Aggregate
namespace PSManagement.Domain.Employees.Repositories
{
public class ProjectType : IAggregateRoot
public interface IEmployeesRepository : IRepository<Employee>
{
public String TypeName { get; set; }
public String Description { get; set; }
public int WorkerCount { get; set; }
}
}
namespace PSManagement.Domain.Employees.Entities
{
public record Availability(
int CurrentWorkingHours,
bool IsAvailable
);
}
namespace PSManagement.Domain.Employees.Entities
{
public record PersonalInfo(
string FirstName,
string LastName
);
}
using PSManagement.SharedKernel.Aggregate;
using PSManagement.SharedKernel.Entities;
using System;
namespace PSManagement.Domain.Identity.Aggregate
{
public class User : IAggregateRoot
{
public string Email { get; set; }
public string LastName { get; set; }
public string FirstName { get; set; }
public string HashedPassword { get; set; }
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace PSManagement.Domain.Identity.Entities
{
public class Permission
{
[Key]
public int Id { get; set; }
public String Name { get; set; }
public ICollection<Role> Roles { get; set; }
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace PSManagement.Domain.Identity.Entities
{
public class Role {
[Key]
public int Id { get; set; }
public String Name { get; set; }
public ICollection<Permission> Permissions { get; set; }
public ICollection<User> Users { get; set; }
}
}
\ No newline at end of file
using PSManagement.Domain.Employees.Entities;
using PSManagement.SharedKernel.Aggregate;
using PSManagement.SharedKernel.Entities;
using System.Collections.Generic;
namespace PSManagement.Domain.Identity.Entities
{
public class User : BaseEntity
{
public string Email { get; set; }
public string UserName { get; set; }
public Employee Employee { get; set; }
public string HashedPassword { get; set; }
public ICollection<Role> Roles { get; set; }
}
}
\ No newline at end of file
using PSManagement.Domain.Identity.Aggregate;
using PSManagement.Domain.Identity.Entities;
using PSManagement.SharedKernel.Interfaces;
using PSManagement.SharedKernel.Repositories;
using System;
......
......@@ -5,10 +5,8 @@
</PropertyGroup>
<ItemGroup>
<Folder Include="Identity\Entities\" />
<Folder Include="Identity\ValueObjects\" />
<Folder Include="Projects\DomainErrors\" />
<Folder Include="Projects\Entities\" />
</ItemGroup>
<ItemGroup>
......
using PSManagement.Domain.Projects.Aggregate;
using PSManagement.SharedKernel.Aggregate;
using PSManagement.SharedKernel.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PSManagement.Domain.ProjectTypes.Entities
{
public class ProjectType : BaseEntity
{
public string TypeName { get; set; }
public string Description { get; set; }
public int WorkerCount { get; set; }
public ICollection<Project> Projects { get; set; }
}
}
using PSManagement.Domain.ProjectTypes.Entities;
using PSManagement.SharedKernel.Repositories;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PSManagement.Domain.ProjectTypes.Repositories
{
public interface IProjectTypesRepository : IRepository<ProjectType>
{
}
}
using PSManagement.Domain.Departments.Aggregate;
using PSManagement.Domain.Employees.Aggregate;
using PSManagement.Domain.Steps.Aggregate;
using PSManagement.Domain.Customers.Aggregate;
using PSManagement.Domain.Employees.Entities;
using PSManagement.Domain.Projects.Entities;
using PSManagement.Domain.ProjectTypes.Entities;
using PSManagement.Domain.Steps.Entities;
using PSManagement.Domain.Tracking;
using PSManagement.SharedKernel.Aggregate;
using System.Collections.Generic;
using System.Linq;
......@@ -13,17 +16,21 @@ namespace PSManagement.Domain.Projects.Aggregate
{
public ProposalInfo ProposalInfo { get; set; }
public ProjectInfo ProjectInfo { get; set; }
public Aggreement ProjectAggreement { get; set; }
public ICollection<Employee> Participants { get; set; }
public ICollection<Step> Steps { get; set; }
public ProjectType ProjectType { get; set; }
public ProjectStatus ProjectStatus { get; set; }
public Aggreement ProjectAggreement { get; set; }
public Employee TeamLeader { get; set; }
public Department Executer { get; set; }
public Employee Proposer { get; set; }
public Customer Proposer { get; set; }
public ICollection<Employee> Participants { get; set; }
public ICollection<Step> Steps { get; set; }
public ICollection<Track> Tracks { get; set; }
public ICollection<Attachment> Attachments { get; set; }
public Project()
{
}
}
}
using PSManagement.SharedKernel.Entities;
namespace PSManagement.Domain.Projects.Entities
{
public class Attachment : BaseEntity
{
public string AttachmentUrl { get; set; }
public string AttachmentName { get; set; }
public string AttachmenDescription { get; set; }
}
}
using PSManagement.SharedKernel.Entities;
namespace PSManagement.Domain.Projects.Entities
{
public class ProjectStatus : BaseEntity
{
public string Name { get; set; }
public string Details { get; set; }
public string Code { get; set; }
}
}
using PSManagement.Domain.Projects.Entities;
using PSManagement.SharedKernel.Repositories;
namespace PSManagement.Domain.Projects.Repositories
{
public interface IProjectStatusRepository : IRepository<ProjectStatus>
{
}
}
......@@ -6,7 +6,9 @@ using System.Threading.Tasks;
namespace PSManagement.Domain.Projects.Repositories
{
public interface IProjectRepository
public interface IProjectsRepository
{
}
}
using PSManagement.Domain.Steps.Entities;
using PSManagement.Domain.Employees.Entities;
using PSManagement.Domain.Projects.Aggregate;
using PSManagement.Domain.Tracking;
using PSManagement.Domain.Tracking.Entities;
using PSManagement.SharedKernel.Aggregate;
using PSManagement.SharedKernel.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PSManagement.Domain.Steps.Aggregate
namespace PSManagement.Domain.Steps.Entities
{
public class Step :IAggregateRoot
public class Step : BaseEntity
{
public String StepName { get; set; }
public String Description { get; set; }
public string StepName { get; set; }
public string Description { get; set; }
public int Duration { get; set; }
public DateTime StartDate { get; set; }
public int ProjectId { get; set; }
public Project Project { get; set; }
public ICollection<Item> Purchases { get; set; }
public ICollection<Employee> Participants { get; set; }
public ICollection<StepTrack> StepTracks { get; set; }
public Step()
{
......
using PSManagement.Domain.Steps.Entities;
using PSManagement.SharedKernel.Repositories;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PSManagement.Domain.Steps.Repositories
{
public interface IStepsRepository : IRepository<Step>
{
}
}
using PSManagement.Domain.Employees.Aggregate;
using PSManagement.SharedKernel.Entities;
namespace PSManagement.Domain.Tracking.Entities
{
public class EmployeeTrack : BaseEntity
{
public Employee Employee { get; set; }
public int WorkingHour { get; set; }
public EmployeeTrack()
{
}
}
}
using PSManagement.Domain.Employees.Entities;
using PSManagement.SharedKernel.Entities;
namespace PSManagement.Domain.Tracking.Entities
{
public class EmployeeWork : BaseEntity
{
public int EmployeeWorkId { get; set; }
public int StepTrackId { get; set; }
public StepTrack StepTrack { get; set; }
public int EmployeeId { get; set; }
public Employee Employee { get; set; }
public int HoursWorked { get; set; }
public string Notes { get; set; }
public int ContributingRatio { get; set; }
}
}
using PSManagement.Domain.Steps.Aggregate;
using PSManagement.Domain.Steps.Entities;
using PSManagement.SharedKernel.Entities;
using System.Collections.Generic;
......@@ -6,8 +6,11 @@ namespace PSManagement.Domain.Tracking.Entities
{
public class StepTrack : BaseEntity
{
public int StepId { get; set; }
public Step Step { get; set; }
public IEnumerable<EmployeeTrack> EmployeeTracks { get; set; }
public int TrackId { get; set; }
public Track Track { get; set; }
public ICollection<EmployeeWork> EmployeeWorks { get; set; }
public StepTrack()
{
......
using PSManagement.Domain.Projects.Aggregate;
using PSManagement.Domain.Steps.Entities;
using PSManagement.Domain.Tracking.Entities;
using PSManagement.SharedKernel.Aggregate;
using PSManagement.SharedKernel.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
......@@ -9,12 +11,14 @@ using System.Threading.Tasks;
namespace PSManagement.Domain.Tracking
{
public class Track : IAggregateRoot
public class Track : BaseEntity
{
public DateTime TrackDate { get; set; }
public String TrackNote { get; set; }
public int ProjectId { get; set; }
public Project Project { get; set; }
public ICollection<StepTrack> StepsTracks { get; set; }
public ICollection<StepTrack> StepTracks { get; set; }
public Track()
{
......
using PSManagement.Domain.Tracking;
using PSManagement.SharedKernel.Repositories;
namespace PSManagement.Domain.Steps.Repositories
{
public interface ITracksRepository : IRepository<Track>
{
}
}
using Microsoft.EntityFrameworkCore;
using PSManagement.Domain.Customers.Aggregate;
using PSManagement.Domain.Departments.Aggregate;
using PSManagement.Domain.Employees.Aggregate;
using PSManagement.Domain.Identity.Aggregate;
using PSManagement.Domain.Employees.Entities;
using PSManagement.Domain.Identity.Entities;
using PSManagement.Domain.Projects.Aggregate;
using PSManagement.Domain.Steps.Aggregate;
using PSManagement.Domain.Steps.Entities;
using PSManagement.Domain.Tracking;
using PSManagement.Domain.Tracking.Entities;
......@@ -20,6 +18,8 @@ namespace PSManagement.Infrastructure.Persistence
}
public DbSet<User> Users { get; set; }
public DbSet<Role> Roles { get; set; }
public DbSet<Permission> Permission { get; set; }
public DbSet<Customer> Customers { get; set; }
public DbSet<Employee> Employees { get; set; }
public DbSet<Department> Departments { get; set; }
......@@ -28,7 +28,7 @@ namespace PSManagement.Infrastructure.Persistence
public DbSet<Item> Items { get; set; }
public DbSet<Track> Tracks { get; set; }
public DbSet<EmployeeTrack> EmployeeTraks { get; set; }
public DbSet<EmployeeWork> EmployeeWorks { get; set; }
public DbSet<StepTrack> StepTracks { get; set; }
......
......@@ -25,7 +25,7 @@ namespace PSManagement.Infrastructure.Persistence.EntitiesConfiguration
builder.HasMany(e => e.Projects).WithOne(e => e.Proposer);
builder.OwnsMany(c => c.ContactInfo);
}
......
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using PSManagement.Domain.Employees.Aggregate;
using PSManagement.Domain.Employees.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
......@@ -17,7 +17,7 @@ namespace PSManagement.Infrastructure.Persistence.EntitiesConfiguration
builder.OwnsOne(c => c.Availability,
p => {
p.Property(e => e.IsAvailable).HasColumnName("IsAvailable");
p.Property(e => e.WorkingHours).HasColumnName("WorkingHours");
p.Property(e => e.CurrentWorkingHours).HasColumnName("CurrentWorkingHours");
}
);
builder.OwnsOne(c => c.PersonalInfo,
......@@ -26,6 +26,12 @@ namespace PSManagement.Infrastructure.Persistence.EntitiesConfiguration
p.Property(e => e.FirstName).HasColumnName("FirstName");
}
);
builder.HasOne(e => e.User)
.WithOne(e=> e.Employee)
.HasForeignKey<Employee>(e => e.UserId); ;
}
}
......
......@@ -24,14 +24,16 @@ namespace PSManagement.Infrastructure.Persistence.EntitiesConfiguration
}
);
builder.Property(e => e.Participants);
builder.OwnsOne(c => c.ProposalInfo,
p => {
p.Property(e => e.ProposingBookDate).HasColumnName("ProposingBookDate");
p.Property(e => e.ProposingBookNumber).HasColumnName("ProposingBookNumber");
}
);
builder.HasMany(e => e.Tracks).WithOne(e => e.Project).HasForeignKey(e => e.ProjectId);
builder.HasOne(e => e.ProjectType).WithMany(r => r.Projects);
builder.Ignore(e => e.Participants);
}
}
}
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using PSManagement.Domain.Steps.Aggregate;
using PSManagement.Domain.Steps.Entities;
namespace PSManagement.Infrastructure.Persistence.EntitiesConfiguration
{
......@@ -8,8 +8,12 @@ namespace PSManagement.Infrastructure.Persistence.EntitiesConfiguration
{
public void Configure(EntityTypeBuilder<Step> builder)
{
builder.HasOne(s => s.Project)
.WithMany(p => p.Steps)
.HasForeignKey(s => s.ProjectId);
builder.HasMany(e => e.StepTracks);
}
}
}
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using PSManagement.Domain.Tracking;
using PSManagement.Domain.Tracking.Entities;
namespace PSManagement.Infrastructure.Persistence.EntitiesConfiguration
{
public class TrackEntityConfiguration :
IEntityTypeConfiguration<Track> ,
IEntityTypeConfiguration<StepTrack>,
IEntityTypeConfiguration<EmployeeWork>
{
public void Configure(EntityTypeBuilder<Track> builder)
{
builder.HasOne(t => t.Project)
.WithMany(p => p.Tracks)
.HasForeignKey(t => t.ProjectId)
.OnDelete(DeleteBehavior.Restrict);
}
public void Configure(EntityTypeBuilder<StepTrack> builder)
{
builder.HasOne(st => st.Step)
.WithMany(s => s.StepTracks)
.HasForeignKey(st => st.StepId)
.OnDelete(DeleteBehavior.Restrict); ;
builder.HasOne(st => st.Track)
.WithMany(t => t.StepTracks)
.HasForeignKey(st => st.TrackId)
.OnDelete(DeleteBehavior.Restrict); ;
}
public void Configure(EntityTypeBuilder<EmployeeWork> builder)
{
builder.HasOne(ew => ew.StepTrack)
.WithMany(st => st.EmployeeWorks)
.HasForeignKey(ew => ew.StepTrackId)
.OnDelete(DeleteBehavior.Restrict); ;
builder.HasOne(ew => ew.Employee)
.WithMany(e => e.EmployeeWorks)
.HasForeignKey(ew => ew.EmployeeId)
.OnDelete(DeleteBehavior.Restrict); ;
}
}
}
// <auto-generated />
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using PSManagement.Infrastructure.Persistence;
namespace PSManagement.Infrastructure.Persistence.Migrations
{
[DbContext(typeof(AppDbContext))]
[Migration("20240718153846_initialMigration")]
partial class initialMigration
{
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.Application.Contracts.Authentication.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Email")
.HasColumnType("nvarchar(max)");
b.Property<string>("FirstName")
.HasColumnType("nvarchar(max)");
b.Property<string>("LastName")
.HasColumnType("nvarchar(max)");
b.Property<string>("Password")
.HasColumnType("nvarchar(max)");
b.Property<string>("Token")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Users");
});
#pragma warning restore 612, 618
}
}
}
using Microsoft.EntityFrameworkCore.Migrations;
namespace PSManagement.Infrastructure.Persistence.Migrations
{
public partial class initialMigration : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Users",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Email = table.Column<string>(type: "nvarchar(max)", nullable: true),
LastName = table.Column<string>(type: "nvarchar(max)", nullable: true),
FirstName = table.Column<string>(type: "nvarchar(max)", nullable: true),
Password = table.Column<string>(type: "nvarchar(max)", nullable: true),
Token = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Users", x => x.Id);
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Users");
}
}
}
// <auto-generated />
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
namespace PSManagement.Infrastructure.Persistence.Migrations
{
[DbContext(typeof(AppDbContext))]
[Migration("20240721081511_IdetnityMigration")]
partial class IdetnityMigration
{
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.Identity.Aggregate.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Email")
.HasColumnType("nvarchar(max)");
b.Property<string>("FirstName")
.HasColumnType("nvarchar(max)");
b.Property<string>("HashedPassword")
.HasColumnType("nvarchar(max)");
b.Property<string>("LastName")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Users");
});
#pragma warning restore 612, 618
}
}
}
using Microsoft.EntityFrameworkCore.Migrations;
namespace PSManagement.Infrastructure.Persistence.Migrations
{
public partial class IdetnityMigration : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Password",
table: "Users");
migrationBuilder.RenameColumn(
name: "Token",
table: "Users",
newName: "HashedPassword");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "HashedPassword",
table: "Users",
newName: "Token");
migrationBuilder.AddColumn<string>(
name: "Password",
table: "Users",
type: "nvarchar(max)",
nullable: true);
}
}
}
// <auto-generated />
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("20240726102138_AddCustomers")]
partial class AddCustomers
{
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.HasKey("Id");
b.ToTable("Customers");
});
modelBuilder.Entity("PSManagement.Domain.Identity.Aggregate.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Email")
.HasColumnType("nvarchar(max)");
b.Property<string>("FirstName")
.HasColumnType("nvarchar(max)");
b.Property<string>("HashedPassword")
.HasColumnType("nvarchar(max)");
b.Property<string>("LastName")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Users");
});
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>("Email")
.HasColumnType("nvarchar(max)");
b1.HasKey("CustomerId", "Id");
b1.ToTable("ContactInfo");
b1.WithOwner()
.HasForeignKey("CustomerId");
b1.OwnsOne("PSManagement.Domain.Customers.ValueObjects.ContactNumber", "MobileNumber", b2 =>
{
b2.Property<int>("ContactInfoCustomerId")
.HasColumnType("int");
b2.Property<int>("ContactInfoId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b2.Property<int>("Number")
.HasColumnType("int");
b2.HasKey("ContactInfoCustomerId", "ContactInfoId");
b2.ToTable("ContactInfo");
b2.WithOwner()
.HasForeignKey("ContactInfoCustomerId", "ContactInfoId");
});
b1.OwnsOne("PSManagement.Domain.Customers.ValueObjects.ContactNumber", "PhoneNumber", b2 =>
{
b2.Property<int>("ContactInfoCustomerId")
.HasColumnType("int");
b2.Property<int>("ContactInfoId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b2.Property<int>("Number")
.HasColumnType("int");
b2.HasKey("ContactInfoCustomerId", "ContactInfoId");
b2.ToTable("ContactInfo");
b2.WithOwner()
.HasForeignKey("ContactInfoCustomerId", "ContactInfoId");
});
b1.Navigation("MobileNumber");
b1.Navigation("PhoneNumber");
});
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)");
b1.Property<string>("StreetName")
.HasColumnType("nvarchar(max)");
b1.Property<int>("StreetNumber")
.HasColumnType("int");
b1.Property<int>("ZipCode")
.HasColumnType("int");
b1.HasKey("CustomerId");
b1.ToTable("Customers");
b1.WithOwner()
.HasForeignKey("CustomerId");
});
b.Navigation("Address");
b.Navigation("ContactInfo");
});
#pragma warning restore 612, 618
}
}
}
// <auto-generated />
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("20240728124023_AddCustomer2")]
partial class AddCustomer2
{
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.HasKey("Id");
b.ToTable("Customers");
});
modelBuilder.Entity("PSManagement.Domain.Identity.Aggregate.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Email")
.HasColumnType("nvarchar(max)");
b.Property<string>("FirstName")
.HasColumnType("nvarchar(max)");
b.Property<string>("HashedPassword")
.HasColumnType("nvarchar(max)");
b.Property<string>("LastName")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Users");
});
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>("Email")
.HasColumnType("nvarchar(max)");
b1.HasKey("CustomerId", "Id");
b1.ToTable("ContactInfo");
b1.WithOwner()
.HasForeignKey("CustomerId");
b1.OwnsOne("PSManagement.Domain.Customers.ValueObjects.ContactNumber", "MobileNumber", b2 =>
{
b2.Property<int>("ContactInfoCustomerId")
.HasColumnType("int");
b2.Property<int>("ContactInfoId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b2.Property<int>("Number")
.HasColumnType("int")
.HasColumnName("MobileNumber");
b2.HasKey("ContactInfoCustomerId", "ContactInfoId");
b2.ToTable("ContactInfo");
b2.WithOwner()
.HasForeignKey("ContactInfoCustomerId", "ContactInfoId");
});
b1.OwnsOne("PSManagement.Domain.Customers.ValueObjects.ContactNumber", "PhoneNumber", b2 =>
{
b2.Property<int>("ContactInfoCustomerId")
.HasColumnType("int");
b2.Property<int>("ContactInfoId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b2.Property<int>("Number")
.HasColumnType("int")
.HasColumnName("PhoneNumber");
b2.HasKey("ContactInfoCustomerId", "ContactInfoId");
b2.ToTable("ContactInfo");
b2.WithOwner()
.HasForeignKey("ContactInfoCustomerId", "ContactInfoId");
});
b1.Navigation("MobileNumber");
b1.Navigation("PhoneNumber");
});
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");
});
#pragma warning restore 612, 618
}
}
}
using Microsoft.EntityFrameworkCore.Migrations;
namespace PSManagement.Infrastructure.Persistence.Migrations
{
public partial class AddCustomer2 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "Address_ZipCode",
table: "Customers",
newName: "ZipCode");
migrationBuilder.RenameColumn(
name: "Address_StreetNumber",
table: "Customers",
newName: "StreetNumber");
migrationBuilder.RenameColumn(
name: "Address_StreetName",
table: "Customers",
newName: "StreetName");
migrationBuilder.RenameColumn(
name: "Address_City",
table: "Customers",
newName: "City");
migrationBuilder.RenameColumn(
name: "PhoneNumber_Number",
table: "ContactInfo",
newName: "PhoneNumber");
migrationBuilder.RenameColumn(
name: "MobileNumber_Number",
table: "ContactInfo",
newName: "MobileNumber");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "ZipCode",
table: "Customers",
newName: "Address_ZipCode");
migrationBuilder.RenameColumn(
name: "StreetNumber",
table: "Customers",
newName: "Address_StreetNumber");
migrationBuilder.RenameColumn(
name: "StreetName",
table: "Customers",
newName: "Address_StreetName");
migrationBuilder.RenameColumn(
name: "City",
table: "Customers",
newName: "Address_City");
migrationBuilder.RenameColumn(
name: "PhoneNumber",
table: "ContactInfo",
newName: "PhoneNumber_Number");
migrationBuilder.RenameColumn(
name: "MobileNumber",
table: "ContactInfo",
newName: "MobileNumber_Number");
}
}
}
// <auto-generated />
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("20240728142935_AddCustomer3")]
partial class AddCustomer3
{
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.Identity.Aggregate.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Email")
.HasColumnType("nvarchar(max)");
b.Property<string>("FirstName")
.HasColumnType("nvarchar(max)");
b.Property<string>("HashedPassword")
.HasColumnType("nvarchar(max)");
b.Property<string>("LastName")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Users");
});
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>("ConatctValue")
.HasColumnType("nvarchar(max)");
b1.Property<string>("ContactType")
.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");
});
#pragma warning restore 612, 618
}
}
}
using Microsoft.EntityFrameworkCore.Migrations;
namespace PSManagement.Infrastructure.Persistence.Migrations
{
public partial class AddCustomer3 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "MobileNumber",
table: "ContactInfo");
migrationBuilder.DropColumn(
name: "PhoneNumber",
table: "ContactInfo");
migrationBuilder.RenameColumn(
name: "Email",
table: "ContactInfo",
newName: "ContactType");
migrationBuilder.AddColumn<string>(
name: "Email",
table: "Customers",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "ConatctValue",
table: "ContactInfo",
type: "nvarchar(max)",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Email",
table: "Customers");
migrationBuilder.DropColumn(
name: "ConatctValue",
table: "ContactInfo");
migrationBuilder.RenameColumn(
name: "ContactType",
table: "ContactInfo",
newName: "Email");
migrationBuilder.AddColumn<int>(
name: "MobileNumber",
table: "ContactInfo",
type: "int",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "PhoneNumber",
table: "ContactInfo",
type: "int",
nullable: true);
}
}
}
// <auto-generated />
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("20240731070622_addCustomer4")]
partial class addCustomer4
{
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.Identity.Aggregate.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Email")
.HasColumnType("nvarchar(max)");
b.Property<string>("FirstName")
.HasColumnType("nvarchar(max)");
b.Property<string>("HashedPassword")
.HasColumnType("nvarchar(max)");
b.Property<string>("LastName")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Users");
});
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");
});
#pragma warning restore 612, 618
}
}
}
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);
}
}
}
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);
}
}
}
using Microsoft.EntityFrameworkCore.Migrations;
namespace PSManagement.Infrastructure.Persistence.Migrations
{
public partial class AddDomains6 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Steps_Tracks_TrackId",
table: "Steps");
migrationBuilder.DropIndex(
name: "IX_Steps_TrackId",
table: "Steps");
migrationBuilder.DropColumn(
name: "TrackId",
table: "Steps");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "TrackId",
table: "Steps",
type: "int",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_Steps_TrackId",
table: "Steps",
column: "TrackId");
migrationBuilder.AddForeignKey(
name: "FK_Steps_Tracks_TrackId",
table: "Steps",
column: "TrackId",
principalTable: "Tracks",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
}
}
......@@ -2,22 +2,16 @@
namespace PSManagement.Infrastructure.Persistence.Migrations
{
public partial class addCustomer4 : Migration
public partial class AddDomains7 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "ConatctValue",
table: "ContactInfo",
newName: "ContactValue");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "ContactValue",
table: "ContactInfo",
newName: "ConatctValue");
}
}
}
using Microsoft.EntityFrameworkCore;
using PSManagement.Domain.Identity.Aggregate;
using PSManagement.Domain.Identity.Entities;
using PSManagement.Domain.Identity.Repositories;
using PSManagement.Infrastructure.Persistence.Repositories.Base;
using PSManagement.SharedKernel.Interfaces;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment