using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Marco.Pms.DataAccess.Migrations { /// public partial class Added_JobAttcahments_Table : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "IsActive", table: "JobComments", type: "tinyint(1)", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "UpdatedAt", table: "JobComments", type: "datetime(6)", nullable: true); migrationBuilder.AddColumn( name: "UpdatedById", table: "JobComments", type: "char(36)", nullable: true, collation: "ascii_general_ci"); migrationBuilder.CreateTable( name: "JobAttachments", columns: table => new { Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), DocumentId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), StatusId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), JobCommentId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") }, constraints: table => { table.PrimaryKey("PK_JobAttachments", x => x.Id); table.ForeignKey( name: "FK_JobAttachments_Documents_DocumentId", column: x => x.DocumentId, principalTable: "Documents", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_JobAttachments_JobComments_JobCommentId", column: x => x.JobCommentId, principalTable: "JobComments", principalColumn: "Id"); table.ForeignKey( name: "FK_JobAttachments_JobStatus_StatusId", column: x => x.StatusId, principalTable: "JobStatus", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_JobAttachments_Tenants_TenantId", column: x => x.TenantId, principalTable: "Tenants", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "ServiceProjectAllocations", columns: table => new { Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), ProjectId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), EmployeeId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), TeamRoleId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), IsActive = table.Column(type: "tinyint(1)", nullable: false), AssignedAt = table.Column(type: "datetime(6)", nullable: false), AssignedById = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), ReAssignedAt = table.Column(type: "datetime(6)", nullable: true), ReAssignedById = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") }, constraints: table => { table.PrimaryKey("PK_ServiceProjectAllocations", x => x.Id); table.ForeignKey( name: "FK_ServiceProjectAllocations_Employees_AssignedById", column: x => x.AssignedById, principalTable: "Employees", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_ServiceProjectAllocations_Employees_EmployeeId", column: x => x.EmployeeId, principalTable: "Employees", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_ServiceProjectAllocations_Employees_ReAssignedById", column: x => x.ReAssignedById, principalTable: "Employees", principalColumn: "Id"); table.ForeignKey( name: "FK_ServiceProjectAllocations_ServiceProjects_ProjectId", column: x => x.ProjectId, principalTable: "ServiceProjects", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_ServiceProjectAllocations_TeamRoleMasters_TeamRoleId", column: x => x.TeamRoleId, principalTable: "TeamRoleMasters", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_ServiceProjectAllocations_Tenants_TenantId", column: x => x.TenantId, principalTable: "Tenants", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateIndex( name: "IX_JobComments_UpdatedById", table: "JobComments", column: "UpdatedById"); migrationBuilder.CreateIndex( name: "IX_JobAttachments_DocumentId", table: "JobAttachments", column: "DocumentId"); migrationBuilder.CreateIndex( name: "IX_JobAttachments_JobCommentId", table: "JobAttachments", column: "JobCommentId"); migrationBuilder.CreateIndex( name: "IX_JobAttachments_StatusId", table: "JobAttachments", column: "StatusId"); migrationBuilder.CreateIndex( name: "IX_JobAttachments_TenantId", table: "JobAttachments", column: "TenantId"); migrationBuilder.CreateIndex( name: "IX_ServiceProjectAllocations_AssignedById", table: "ServiceProjectAllocations", column: "AssignedById"); migrationBuilder.CreateIndex( name: "IX_ServiceProjectAllocations_EmployeeId", table: "ServiceProjectAllocations", column: "EmployeeId"); migrationBuilder.CreateIndex( name: "IX_ServiceProjectAllocations_ProjectId", table: "ServiceProjectAllocations", column: "ProjectId"); migrationBuilder.CreateIndex( name: "IX_ServiceProjectAllocations_ReAssignedById", table: "ServiceProjectAllocations", column: "ReAssignedById"); migrationBuilder.CreateIndex( name: "IX_ServiceProjectAllocations_TeamRoleId", table: "ServiceProjectAllocations", column: "TeamRoleId"); migrationBuilder.CreateIndex( name: "IX_ServiceProjectAllocations_TenantId", table: "ServiceProjectAllocations", column: "TenantId"); migrationBuilder.AddForeignKey( name: "FK_JobComments_Employees_UpdatedById", table: "JobComments", column: "UpdatedById", principalTable: "Employees", principalColumn: "Id"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_JobComments_Employees_UpdatedById", table: "JobComments"); migrationBuilder.DropTable( name: "JobAttachments"); migrationBuilder.DropTable( name: "ServiceProjectAllocations"); migrationBuilder.DropIndex( name: "IX_JobComments_UpdatedById", table: "JobComments"); migrationBuilder.DropColumn( name: "IsActive", table: "JobComments"); migrationBuilder.DropColumn( name: "UpdatedAt", table: "JobComments"); migrationBuilder.DropColumn( name: "UpdatedById", table: "JobComments"); } } }