summaryrefslogtreecommitdiffstats
path: root/api/WhatApi/Migrations/20251026215643_Initial.cs
diff options
context:
space:
mode:
authorivar <i@oiee.no>2025-12-03 21:49:20 +0100
committerivar <i@oiee.no>2025-12-03 21:49:20 +0100
commitcd70f54266d708867a1eb35870bc755bc5b2df32 (patch)
treef0a8ec571ef3f345ac74293b4cb11918878b3ed5 /api/WhatApi/Migrations/20251026215643_Initial.cs
parent5bd9ad8bd1740dcff179d66718532086304ca4c4 (diff)
downloadwhat-cd70f54266d708867a1eb35870bc755bc5b2df32.tar.xz
what-cd70f54266d708867a1eb35870bc755bc5b2df32.zip
Refactor db
Diffstat (limited to 'api/WhatApi/Migrations/20251026215643_Initial.cs')
-rw-r--r--api/WhatApi/Migrations/20251026215643_Initial.cs143
1 files changed, 0 insertions, 143 deletions
diff --git a/api/WhatApi/Migrations/20251026215643_Initial.cs b/api/WhatApi/Migrations/20251026215643_Initial.cs
deleted file mode 100644
index b8f0444..0000000
--- a/api/WhatApi/Migrations/20251026215643_Initial.cs
+++ /dev/null
@@ -1,143 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Net;
-using Microsoft.EntityFrameworkCore.Migrations;
-using NetTopologySuite.Geometries;
-
-#nullable disable
-
-namespace WhatApi.Migrations
-{
- /// <inheritdoc />
- public partial class Initial : Migration
- {
- /// <inheritdoc />
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.AlterDatabase()
- .Annotation("Npgsql:PostgresExtension:postgis", ",,");
-
- migrationBuilder.CreateTable(
- name: "audit_trails",
- columns: table => new
- {
- Id = table.Column<Guid>(type: "uuid", nullable: false),
- UserId = table.Column<Guid>(type: "uuid", nullable: true),
- EntityName = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
- PrimaryKey = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: true),
- TrailType = table.Column<string>(type: "text", nullable: false),
- DateUtc = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
- OldValues = table.Column<Dictionary<string, object>>(type: "jsonb", nullable: false),
- NewValues = table.Column<Dictionary<string, object>>(type: "jsonb", nullable: false),
- ChangedColumns = table.Column<List<string>>(type: "jsonb", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_audit_trails", x => x.Id);
- });
-
- migrationBuilder.CreateTable(
- name: "content",
- columns: table => new
- {
- Id = table.Column<Guid>(type: "uuid", nullable: false),
- Mime = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
- BlobId = table.Column<Guid>(type: "uuid", nullable: false),
- Ip = table.Column<IPAddress>(type: "inet", nullable: false),
- CreatedAtUtc = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
- UpdatedAtUtc = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
- CreatedBy = table.Column<Guid>(type: "uuid", nullable: false),
- UpdatedBy = table.Column<Guid>(type: "uuid", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_content", x => x.Id);
- });
-
- migrationBuilder.CreateTable(
- name: "user",
- columns: table => new
- {
- Id = table.Column<Guid>(type: "uuid", nullable: false),
- Name = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
- Email = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
- Password = table.Column<string>(type: "text", nullable: false),
- LastSeen = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
- CreatedAtUtc = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
- UpdatedAtUtc = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
- CreatedBy = table.Column<Guid>(type: "uuid", nullable: false),
- UpdatedBy = table.Column<Guid>(type: "uuid", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_user", x => x.Id);
- });
-
- migrationBuilder.CreateTable(
- name: "place",
- columns: table => new
- {
- Id = table.Column<Guid>(type: "uuid", nullable: false),
- ContentId = table.Column<Guid>(type: "uuid", nullable: false),
- Location = table.Column<Point>(type: "geometry(point,4326)", nullable: false),
- CreatedAtUtc = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
- UpdatedAtUtc = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
- CreatedBy = table.Column<Guid>(type: "uuid", nullable: false),
- UpdatedBy = table.Column<Guid>(type: "uuid", nullable: true),
- UserId = table.Column<Guid>(type: "uuid", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_place", x => x.Id);
- table.ForeignKey(
- name: "FK_place_content_ContentId",
- column: x => x.ContentId,
- principalTable: "content",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- table.ForeignKey(
- name: "FK_place_user_UserId",
- column: x => x.UserId,
- principalTable: "user",
- principalColumn: "Id");
- });
-
- migrationBuilder.CreateIndex(
- name: "IX_audit_trails_EntityName",
- table: "audit_trails",
- column: "EntityName");
-
- migrationBuilder.CreateIndex(
- name: "IX_place_ContentId",
- table: "place",
- column: "ContentId");
-
- migrationBuilder.CreateIndex(
- name: "IX_place_Location",
- table: "place",
- column: "Location")
- .Annotation("Npgsql:IndexMethod", "gist");
-
- migrationBuilder.CreateIndex(
- name: "IX_place_UserId",
- table: "place",
- column: "UserId");
- }
-
- /// <inheritdoc />
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "audit_trails");
-
- migrationBuilder.DropTable(
- name: "place");
-
- migrationBuilder.DropTable(
- name: "content");
-
- migrationBuilder.DropTable(
- name: "user");
- }
- }
-}