Files
Projet4/PyroFetes/Migrations/20260611085600_HOA.cs
T

247 lines
8.8 KiB
C#

using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace PyroFetes.Migrations
{
/// <inheritdoc />
public partial class HOA : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_ContactServiceProvider_Providers_ServiceProviderId",
table: "ContactServiceProvider");
migrationBuilder.DropForeignKey(
name: "FK_Contract_Providers_ServiceProviderId",
table: "Contract");
migrationBuilder.DropForeignKey(
name: "FK_ProviderContacts_Providers_ProviderId",
table: "ProviderContacts");
migrationBuilder.DropForeignKey(
name: "FK_Providers_ProviderTypes_ProviderTypeId",
table: "Providers");
migrationBuilder.DropIndex(
name: "IX_ExperienceLevels_StaffId",
table: "ExperienceLevels");
migrationBuilder.DropPrimaryKey(
name: "PK_Providers",
table: "Providers");
migrationBuilder.RenameTable(
name: "Providers",
newName: "ServiceProviders");
migrationBuilder.RenameIndex(
name: "IX_Providers_ProviderTypeId",
table: "ServiceProviders",
newName: "IX_ServiceProviders_ProviderTypeId");
migrationBuilder.AddColumn<int>(
name: "StaffId",
table: "HistoryOfApprovals",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AlterColumn<string>(
name: "Meeting",
table: "Communications",
type: "nvarchar(300)",
maxLength: 300,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(300)",
oldMaxLength: 300);
migrationBuilder.AlterColumn<string>(
name: "Email",
table: "Communications",
type: "nvarchar(100)",
maxLength: 100,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(100)",
oldMaxLength: 100);
migrationBuilder.AlterColumn<string>(
name: "Calling",
table: "Communications",
type: "nvarchar(100)",
maxLength: 100,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(100)",
oldMaxLength: 100);
migrationBuilder.AddPrimaryKey(
name: "PK_ServiceProviders",
table: "ServiceProviders",
column: "Id");
migrationBuilder.CreateIndex(
name: "IX_ExperienceLevels_StaffId",
table: "ExperienceLevels",
column: "StaffId",
unique: true);
migrationBuilder.AddForeignKey(
name: "FK_ContactServiceProvider_ServiceProviders_ServiceProviderId",
table: "ContactServiceProvider",
column: "ServiceProviderId",
principalTable: "ServiceProviders",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Contract_ServiceProviders_ServiceProviderId",
table: "Contract",
column: "ServiceProviderId",
principalTable: "ServiceProviders",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_ProviderContacts_ServiceProviders_ProviderId",
table: "ProviderContacts",
column: "ProviderId",
principalTable: "ServiceProviders",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_ServiceProviders_ProviderTypes_ProviderTypeId",
table: "ServiceProviders",
column: "ProviderTypeId",
principalTable: "ProviderTypes",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_ContactServiceProvider_ServiceProviders_ServiceProviderId",
table: "ContactServiceProvider");
migrationBuilder.DropForeignKey(
name: "FK_Contract_ServiceProviders_ServiceProviderId",
table: "Contract");
migrationBuilder.DropForeignKey(
name: "FK_ProviderContacts_ServiceProviders_ProviderId",
table: "ProviderContacts");
migrationBuilder.DropForeignKey(
name: "FK_ServiceProviders_ProviderTypes_ProviderTypeId",
table: "ServiceProviders");
migrationBuilder.DropIndex(
name: "IX_ExperienceLevels_StaffId",
table: "ExperienceLevels");
migrationBuilder.DropPrimaryKey(
name: "PK_ServiceProviders",
table: "ServiceProviders");
migrationBuilder.DropColumn(
name: "StaffId",
table: "HistoryOfApprovals");
migrationBuilder.RenameTable(
name: "ServiceProviders",
newName: "Providers");
migrationBuilder.RenameIndex(
name: "IX_ServiceProviders_ProviderTypeId",
table: "Providers",
newName: "IX_Providers_ProviderTypeId");
migrationBuilder.AlterColumn<string>(
name: "Meeting",
table: "Communications",
type: "nvarchar(300)",
maxLength: 300,
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "nvarchar(300)",
oldMaxLength: 300,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Email",
table: "Communications",
type: "nvarchar(100)",
maxLength: 100,
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "nvarchar(100)",
oldMaxLength: 100,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Calling",
table: "Communications",
type: "nvarchar(100)",
maxLength: 100,
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "nvarchar(100)",
oldMaxLength: 100,
oldNullable: true);
migrationBuilder.AddPrimaryKey(
name: "PK_Providers",
table: "Providers",
column: "Id");
migrationBuilder.CreateIndex(
name: "IX_ExperienceLevels_StaffId",
table: "ExperienceLevels",
column: "StaffId");
migrationBuilder.AddForeignKey(
name: "FK_ContactServiceProvider_Providers_ServiceProviderId",
table: "ContactServiceProvider",
column: "ServiceProviderId",
principalTable: "Providers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Contract_Providers_ServiceProviderId",
table: "Contract",
column: "ServiceProviderId",
principalTable: "Providers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_ProviderContacts_Providers_ProviderId",
table: "ProviderContacts",
column: "ProviderId",
principalTable: "Providers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Providers_ProviderTypes_ProviderTypeId",
table: "Providers",
column: "ProviderTypeId",
principalTable: "ProviderTypes",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}