From 900bb5e845c3ad44defbd427cae3d44a4a43321f Mon Sep 17 00:00:00 2001 From: ivarlovlie Date: Sat, 25 Feb 2023 13:15:44 +0100 Subject: feat: Initial commit --- .../Migrations/20221030090557_MoreMinorChanges.cs | 78 ++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 code/api/src/Migrations/20221030090557_MoreMinorChanges.cs (limited to 'code/api/src/Migrations/20221030090557_MoreMinorChanges.cs') diff --git a/code/api/src/Migrations/20221030090557_MoreMinorChanges.cs b/code/api/src/Migrations/20221030090557_MoreMinorChanges.cs new file mode 100644 index 0000000..5ebd664 --- /dev/null +++ b/code/api/src/Migrations/20221030090557_MoreMinorChanges.cs @@ -0,0 +1,78 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace IOL.GreatOffice.Api.Migrations +{ + public partial class MoreMinorChanges : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "fk_customers_projects_project_id", + table: "customers"); + + migrationBuilder.DropIndex( + name: "ix_customers_project_id", + table: "customers"); + + migrationBuilder.DropColumn( + name: "project_id", + table: "customers"); + + migrationBuilder.CreateTable( + name: "customer_project", + columns: table => new + { + customers_id = table.Column(type: "uuid", nullable: false), + projects_id = table.Column(type: "uuid", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("pk_customer_project", x => new { x.customers_id, x.projects_id }); + table.ForeignKey( + name: "fk_customer_project_customers_customers_id", + column: x => x.customers_id, + principalTable: "customers", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_customer_project_projects_projects_id", + column: x => x.projects_id, + principalTable: "projects", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "ix_customer_project_projects_id", + table: "customer_project", + column: "projects_id"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "customer_project"); + + migrationBuilder.AddColumn( + name: "project_id", + table: "customers", + type: "uuid", + nullable: true); + + migrationBuilder.CreateIndex( + name: "ix_customers_project_id", + table: "customers", + column: "project_id"); + + migrationBuilder.AddForeignKey( + name: "fk_customers_projects_project_id", + table: "customers", + column: "project_id", + principalTable: "projects", + principalColumn: "id"); + } + } +} -- cgit v1.3