diff options
| author | ivarlovlie <git@ivarlovlie.no> | 2023-02-25 13:15:44 +0100 |
|---|---|---|
| committer | ivarlovlie <git@ivarlovlie.no> | 2023-02-25 13:15:44 +0100 |
| commit | 900bb5e845c3ad44defbd427cae3d44a4a43321f (patch) | |
| tree | df3d96a93771884add571e82336c29fc3d9c7a1c /code/api/src/Migrations/20221030090557_MoreMinorChanges.cs | |
| download | greatoffice-900bb5e845c3ad44defbd427cae3d44a4a43321f.tar.xz greatoffice-900bb5e845c3ad44defbd427cae3d44a4a43321f.zip | |
feat: Initial commit
Diffstat (limited to 'code/api/src/Migrations/20221030090557_MoreMinorChanges.cs')
| -rw-r--r-- | code/api/src/Migrations/20221030090557_MoreMinorChanges.cs | 78 |
1 files changed, 78 insertions, 0 deletions
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<Guid>(type: "uuid", nullable: false), + projects_id = table.Column<Guid>(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<Guid>( + 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"); + } + } +} |
