From cd70f54266d708867a1eb35870bc755bc5b2df32 Mon Sep 17 00:00:00 2001 From: ivar Date: Wed, 3 Dec 2025 21:49:20 +0100 Subject: Refactor db --- api/WhatApi/Migrations/20251026215643_Initial.cs | 143 ----------------------- 1 file changed, 143 deletions(-) delete mode 100644 api/WhatApi/Migrations/20251026215643_Initial.cs (limited to 'api/WhatApi/Migrations/20251026215643_Initial.cs') 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 -{ - /// - public partial class Initial : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterDatabase() - .Annotation("Npgsql:PostgresExtension:postgis", ",,"); - - migrationBuilder.CreateTable( - name: "audit_trails", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - UserId = table.Column(type: "uuid", nullable: true), - EntityName = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), - PrimaryKey = table.Column(type: "character varying(100)", maxLength: 100, nullable: true), - TrailType = table.Column(type: "text", nullable: false), - DateUtc = table.Column(type: "timestamp with time zone", nullable: false), - OldValues = table.Column>(type: "jsonb", nullable: false), - NewValues = table.Column>(type: "jsonb", nullable: false), - ChangedColumns = table.Column>(type: "jsonb", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_audit_trails", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "content", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - Mime = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), - BlobId = table.Column(type: "uuid", nullable: false), - Ip = table.Column(type: "inet", nullable: false), - CreatedAtUtc = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAtUtc = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: false), - UpdatedBy = table.Column(type: "uuid", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_content", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "user", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - Name = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), - Email = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), - Password = table.Column(type: "text", nullable: false), - LastSeen = table.Column(type: "timestamp with time zone", nullable: true), - CreatedAtUtc = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAtUtc = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: false), - UpdatedBy = table.Column(type: "uuid", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_user", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "place", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - ContentId = table.Column(type: "uuid", nullable: false), - Location = table.Column(type: "geometry(point,4326)", nullable: false), - CreatedAtUtc = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAtUtc = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: false), - UpdatedBy = table.Column(type: "uuid", nullable: true), - UserId = table.Column(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"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "audit_trails"); - - migrationBuilder.DropTable( - name: "place"); - - migrationBuilder.DropTable( - name: "content"); - - migrationBuilder.DropTable( - name: "user"); - } - } -} -- cgit v1.3