aboutsummaryrefslogtreecommitdiffstats
path: root/code/api/src/Migrations/20220530175322_RemoveUnusedNavs.cs
diff options
context:
space:
mode:
authorivarlovlie <git@ivarlovlie.no>2023-02-25 13:15:44 +0100
committerivarlovlie <git@ivarlovlie.no>2023-02-25 13:15:44 +0100
commit900bb5e845c3ad44defbd427cae3d44a4a43321f (patch)
treedf3d96a93771884add571e82336c29fc3d9c7a1c /code/api/src/Migrations/20220530175322_RemoveUnusedNavs.cs
downloadgreatoffice-900bb5e845c3ad44defbd427cae3d44a4a43321f.tar.xz
greatoffice-900bb5e845c3ad44defbd427cae3d44a4a43321f.zip
feat: Initial commit
Diffstat (limited to 'code/api/src/Migrations/20220530175322_RemoveUnusedNavs.cs')
-rw-r--r--code/api/src/Migrations/20220530175322_RemoveUnusedNavs.cs78
1 files changed, 78 insertions, 0 deletions
diff --git a/code/api/src/Migrations/20220530175322_RemoveUnusedNavs.cs b/code/api/src/Migrations/20220530175322_RemoveUnusedNavs.cs
new file mode 100644
index 0000000..36b3cf1
--- /dev/null
+++ b/code/api/src/Migrations/20220530175322_RemoveUnusedNavs.cs
@@ -0,0 +1,78 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace IOL.GreatOffice.Api.Migrations
+{
+ public partial class RemoveUnusedNavs : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(
+ name: "time_entry_time_label");
+
+ migrationBuilder.AddColumn<Guid>(
+ name: "time_entry_id",
+ table: "time_labels",
+ type: "uuid",
+ nullable: true);
+
+ migrationBuilder.CreateIndex(
+ name: "ix_time_labels_time_entry_id",
+ table: "time_labels",
+ column: "time_entry_id");
+
+ migrationBuilder.AddForeignKey(
+ name: "fk_time_labels_time_entries_time_entry_id",
+ table: "time_labels",
+ column: "time_entry_id",
+ principalTable: "time_entries",
+ principalColumn: "id");
+ }
+
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropForeignKey(
+ name: "fk_time_labels_time_entries_time_entry_id",
+ table: "time_labels");
+
+ migrationBuilder.DropIndex(
+ name: "ix_time_labels_time_entry_id",
+ table: "time_labels");
+
+ migrationBuilder.DropColumn(
+ name: "time_entry_id",
+ table: "time_labels");
+
+ migrationBuilder.CreateTable(
+ name: "time_entry_time_label",
+ columns: table => new
+ {
+ entries_id = table.Column<Guid>(type: "uuid", nullable: false),
+ labels_id = table.Column<Guid>(type: "uuid", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("pk_time_entry_time_label", x => new { x.entries_id, x.labels_id });
+ table.ForeignKey(
+ name: "fk_time_entry_time_label_time_entries_entries_id",
+ column: x => x.entries_id,
+ principalTable: "time_entries",
+ principalColumn: "id",
+ onDelete: ReferentialAction.Cascade);
+ table.ForeignKey(
+ name: "fk_time_entry_time_label_time_labels_labels_id",
+ column: x => x.labels_id,
+ principalTable: "time_labels",
+ principalColumn: "id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateIndex(
+ name: "ix_time_entry_time_label_labels_id",
+ table: "time_entry_time_label",
+ column: "labels_id");
+ }
+ }
+}