using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Marco.Pms.DataAccess.Migrations { /// public partial class Added_ServiceProject_And_ServiceProjectServiceMapping_Table : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "ServiceProjects", columns: table => new { Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), Name = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), ShortName = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), ClientId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), Address = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), AssignedDate = table.Column(type: "datetime(6)", nullable: false), StatusId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), ContactName = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), ContactPhone = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), ContactEmail = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), IsActive = table.Column(type: "tinyint(1)", nullable: false), CreatedAt = table.Column(type: "datetime(6)", nullable: false), CreatedById = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), UpdatedAt = table.Column(type: "datetime(6)", nullable: true), UpdatedById = 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_ServiceProjects", x => x.Id); table.ForeignKey( name: "FK_ServiceProjects_Employees_CreatedById", column: x => x.CreatedById, principalTable: "Employees", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_ServiceProjects_Employees_UpdatedById", column: x => x.UpdatedById, principalTable: "Employees", principalColumn: "Id"); table.ForeignKey( name: "FK_ServiceProjects_Organizations_ClientId", column: x => x.ClientId, principalTable: "Organizations", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_ServiceProjects_StatusMasters_StatusId", column: x => x.StatusId, principalTable: "StatusMasters", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_ServiceProjects_Tenants_TenantId", column: x => x.TenantId, principalTable: "Tenants", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "ServiceProjectServiceMapping", 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"), ServiceId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") }, constraints: table => { table.PrimaryKey("PK_ServiceProjectServiceMapping", x => x.Id); table.ForeignKey( name: "FK_ServiceProjectServiceMapping_ServiceMasters_ServiceId", column: x => x.ServiceId, principalTable: "ServiceMasters", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_ServiceProjectServiceMapping_ServiceProjects_ProjectId", column: x => x.ProjectId, principalTable: "ServiceProjects", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_ServiceProjectServiceMapping_Tenants_TenantId", column: x => x.TenantId, principalTable: "Tenants", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateIndex( name: "IX_ServiceProjects_ClientId", table: "ServiceProjects", column: "ClientId"); migrationBuilder.CreateIndex( name: "IX_ServiceProjects_CreatedById", table: "ServiceProjects", column: "CreatedById"); migrationBuilder.CreateIndex( name: "IX_ServiceProjects_StatusId", table: "ServiceProjects", column: "StatusId"); migrationBuilder.CreateIndex( name: "IX_ServiceProjects_TenantId", table: "ServiceProjects", column: "TenantId"); migrationBuilder.CreateIndex( name: "IX_ServiceProjects_UpdatedById", table: "ServiceProjects", column: "UpdatedById"); migrationBuilder.CreateIndex( name: "IX_ServiceProjectServiceMapping_ProjectId", table: "ServiceProjectServiceMapping", column: "ProjectId"); migrationBuilder.CreateIndex( name: "IX_ServiceProjectServiceMapping_ServiceId", table: "ServiceProjectServiceMapping", column: "ServiceId"); migrationBuilder.CreateIndex( name: "IX_ServiceProjectServiceMapping_TenantId", table: "ServiceProjectServiceMapping", column: "TenantId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "ServiceProjectServiceMapping"); migrationBuilder.DropTable( name: "ServiceProjects"); } } }