Highlight und neue ID

This commit is contained in:
Moritz Utcke
2025-03-25 14:01:13 -03:00
parent 84a3a2dd39
commit 5d66eb10ca
89 changed files with 1650 additions and 601 deletions

View File

@@ -0,0 +1,573 @@
/*
Warnings:
- The primary key for the `Anteilshaber` table will be changed. If it partially fails, the table could be left without primary key constraint.
- You are about to drop the column `uid` on the `Anteilshaber` table. All the data in the column will be lost.
- You are about to alter the column `id` on the `Anteilshaber` table. The data in that column could be lost. The data in that column will be cast from `Integer` to `VarChar(8)`.
- The primary key for the `ApiRequests` table will be changed. If it partially fails, the table could be left without primary key constraint.
- You are about to alter the column `id` on the `ApiRequests` table. The data in that column could be lost. The data in that column will be cast from `Integer` to `VarChar(8)`.
- The primary key for the `Aufnahme` table will be changed. If it partially fails, the table could be left without primary key constraint.
- You are about to drop the column `uid` on the `Aufnahme` table. All the data in the column will be lost.
- You are about to alter the column `id` on the `Aufnahme` table. The data in that column could be lost. The data in that column will be cast from `Integer` to `VarChar(8)`.
- The primary key for the `BedarfsausweisGewerbe` table will be changed. If it partially fails, the table could be left without primary key constraint.
- You are about to drop the column `uid` on the `BedarfsausweisGewerbe` table. All the data in the column will be lost.
- You are about to alter the column `id` on the `BedarfsausweisGewerbe` table. The data in that column could be lost. The data in that column will be cast from `Integer` to `VarChar(8)`.
- The primary key for the `BedarfsausweisWohnen` table will be changed. If it partially fails, the table could be left without primary key constraint.
- You are about to drop the column `uid` on the `BedarfsausweisWohnen` table. All the data in the column will be lost.
- You are about to alter the column `id` on the `BedarfsausweisWohnen` table. The data in that column could be lost. The data in that column will be cast from `Integer` to `VarChar(8)`.
- The primary key for the `Bild` table will be changed. If it partially fails, the table could be left without primary key constraint.
- You are about to alter the column `id` on the `Bild` table. The data in that column could be lost. The data in that column will be cast from `Integer` to `VarChar(8)`.
- The primary key for the `Event` table will be changed. If it partially fails, the table could be left without primary key constraint.
- You are about to drop the column `uid` on the `Event` table. All the data in the column will be lost.
- You are about to alter the column `id` on the `Event` table. The data in that column could be lost. The data in that column will be cast from `Integer` to `VarChar(8)`.
- The primary key for the `GEGEinpreisung` table will be changed. If it partially fails, the table could be left without primary key constraint.
- You are about to drop the column `uid` on the `GEGEinpreisung` table. All the data in the column will be lost.
- You are about to alter the column `id` on the `GEGEinpreisung` table. The data in that column could be lost. The data in that column will be cast from `Integer` to `VarChar(8)`.
- The primary key for the `GEGNachweisGewerbe` table will be changed. If it partially fails, the table could be left without primary key constraint.
- You are about to drop the column `uid` on the `GEGNachweisGewerbe` table. All the data in the column will be lost.
- You are about to alter the column `id` on the `GEGNachweisGewerbe` table. The data in that column could be lost. The data in that column will be cast from `Integer` to `VarChar(8)`.
- The primary key for the `GEGNachweisWohnen` table will be changed. If it partially fails, the table could be left without primary key constraint.
- You are about to drop the column `uid` on the `GEGNachweisWohnen` table. All the data in the column will be lost.
- You are about to alter the column `id` on the `GEGNachweisWohnen` table. The data in that column could be lost. The data in that column will be cast from `Integer` to `VarChar(8)`.
- The primary key for the `Objekt` table will be changed. If it partially fails, the table could be left without primary key constraint.
- You are about to drop the column `uid` on the `Objekt` table. All the data in the column will be lost.
- You are about to alter the column `id` on the `Objekt` table. The data in that column could be lost. The data in that column will be cast from `Integer` to `VarChar(8)`.
- The primary key for the `Rechnung` table will be changed. If it partially fails, the table could be left without primary key constraint.
- You are about to drop the column `uid` on the `Rechnung` table. All the data in the column will be lost.
- You are about to alter the column `id` on the `Rechnung` table. The data in that column could be lost. The data in that column will be cast from `Integer` to `VarChar(8)`.
- The primary key for the `Tickets` table will be changed. If it partially fails, the table could be left without primary key constraint.
- You are about to drop the column `uid` on the `Tickets` table. All the data in the column will be lost.
- You are about to alter the column `id` on the `Tickets` table. The data in that column could be lost. The data in that column will be cast from `Integer` to `VarChar(8)`.
- The primary key for the `Unterlage` table will be changed. If it partially fails, the table could be left without primary key constraint.
- You are about to drop the column `uid` on the `Unterlage` table. All the data in the column will be lost.
- You are about to alter the column `id` on the `Unterlage` table. The data in that column could be lost. The data in that column will be cast from `Integer` to `VarChar(8)`.
- The primary key for the `VerbrauchsausweisGewerbe` table will be changed. If it partially fails, the table could be left without primary key constraint.
- You are about to drop the column `uid` on the `VerbrauchsausweisGewerbe` table. All the data in the column will be lost.
- You are about to alter the column `id` on the `VerbrauchsausweisGewerbe` table. The data in that column could be lost. The data in that column will be cast from `Integer` to `VarChar(8)`.
- The primary key for the `VerbrauchsausweisWohnen` table will be changed. If it partially fails, the table could be left without primary key constraint.
- You are about to drop the column `uid` on the `VerbrauchsausweisWohnen` table. All the data in the column will be lost.
- You are about to alter the column `id` on the `VerbrauchsausweisWohnen` table. The data in that column could be lost. The data in that column will be cast from `Integer` to `VarChar(8)`.
- The primary key for the `benutzer` table will be changed. If it partially fails, the table could be left without primary key constraint.
- You are about to drop the column `uid` on the `benutzer` table. All the data in the column will be lost.
- You are about to alter the column `id` on the `benutzer` table. The data in that column could be lost. The data in that column will be cast from `Integer` to `VarChar(8)`.
- A unique constraint covering the columns `[id]` on the table `Anteilshaber` will be added. If there are existing duplicate values, this will fail.
- A unique constraint covering the columns `[id]` on the table `ApiRequests` will be added. If there are existing duplicate values, this will fail.
- A unique constraint covering the columns `[id]` on the table `Aufnahme` will be added. If there are existing duplicate values, this will fail.
- A unique constraint covering the columns `[id]` on the table `BedarfsausweisGewerbe` will be added. If there are existing duplicate values, this will fail.
- A unique constraint covering the columns `[id]` on the table `BedarfsausweisWohnen` will be added. If there are existing duplicate values, this will fail.
- A unique constraint covering the columns `[id]` on the table `Bild` will be added. If there are existing duplicate values, this will fail.
- A unique constraint covering the columns `[id]` on the table `Event` will be added. If there are existing duplicate values, this will fail.
- A unique constraint covering the columns `[id]` on the table `GEGEinpreisung` will be added. If there are existing duplicate values, this will fail.
- A unique constraint covering the columns `[id]` on the table `GEGNachweisGewerbe` will be added. If there are existing duplicate values, this will fail.
- A unique constraint covering the columns `[id]` on the table `GEGNachweisWohnen` will be added. If there are existing duplicate values, this will fail.
- A unique constraint covering the columns `[id]` on the table `Objekt` will be added. If there are existing duplicate values, this will fail.
- A unique constraint covering the columns `[id]` on the table `Rechnung` will be added. If there are existing duplicate values, this will fail.
- A unique constraint covering the columns `[id]` on the table `Tickets` will be added. If there are existing duplicate values, this will fail.
- A unique constraint covering the columns `[id]` on the table `Unterlage` will be added. If there are existing duplicate values, this will fail.
- A unique constraint covering the columns `[id]` on the table `VerbrauchsausweisGewerbe` will be added. If there are existing duplicate values, this will fail.
- A unique constraint covering the columns `[id]` on the table `VerbrauchsausweisWohnen` will be added. If there are existing duplicate values, this will fail.
- A unique constraint covering the columns `[id]` on the table `benutzer` will be added. If there are existing duplicate values, this will fail.
*/
-- DropForeignKey
ALTER TABLE "Anteilshaber" DROP CONSTRAINT "Anteilshaber_benutzer_id_fkey";
-- DropForeignKey
ALTER TABLE "Anteilshaber" DROP CONSTRAINT "Anteilshaber_objekt_id_fkey";
-- DropForeignKey
ALTER TABLE "ApiRequests" DROP CONSTRAINT "ApiRequests_user_id_fkey";
-- DropForeignKey
ALTER TABLE "Aufnahme" DROP CONSTRAINT "Aufnahme_benutzer_id_fkey";
-- DropForeignKey
ALTER TABLE "Aufnahme" DROP CONSTRAINT "Aufnahme_objekt_id_fkey";
-- DropForeignKey
ALTER TABLE "BedarfsausweisGewerbe" DROP CONSTRAINT "BedarfsausweisGewerbe_aufnahme_id_fkey";
-- DropForeignKey
ALTER TABLE "BedarfsausweisGewerbe" DROP CONSTRAINT "BedarfsausweisGewerbe_benutzer_id_fkey";
-- DropForeignKey
ALTER TABLE "BedarfsausweisGewerbe" DROP CONSTRAINT "BedarfsausweisGewerbe_geg_einpreisung_id_fkey";
-- DropForeignKey
ALTER TABLE "BedarfsausweisGewerbe" DROP CONSTRAINT "BedarfsausweisGewerbe_rechnung_id_fkey";
-- DropForeignKey
ALTER TABLE "BedarfsausweisWohnen" DROP CONSTRAINT "BedarfsausweisWohnen_aufnahme_id_fkey";
-- DropForeignKey
ALTER TABLE "BedarfsausweisWohnen" DROP CONSTRAINT "BedarfsausweisWohnen_benutzer_id_fkey";
-- DropForeignKey
ALTER TABLE "BedarfsausweisWohnen" DROP CONSTRAINT "BedarfsausweisWohnen_rechnung_id_fkey";
-- DropForeignKey
ALTER TABLE "Bild" DROP CONSTRAINT "Bild_aufnahme_id_fkey";
-- DropForeignKey
ALTER TABLE "Event" DROP CONSTRAINT "Event_aufnahme_id_fkey";
-- DropForeignKey
ALTER TABLE "Event" DROP CONSTRAINT "Event_benutzer_id_fkey";
-- DropForeignKey
ALTER TABLE "GEGEinpreisung" DROP CONSTRAINT "GEGEinpreisung_benutzer_id_fkey";
-- DropForeignKey
ALTER TABLE "GEGNachweisGewerbe" DROP CONSTRAINT "GEGNachweisGewerbe_aufnahme_id_fkey";
-- DropForeignKey
ALTER TABLE "GEGNachweisGewerbe" DROP CONSTRAINT "GEGNachweisGewerbe_benutzer_id_fkey";
-- DropForeignKey
ALTER TABLE "GEGNachweisGewerbe" DROP CONSTRAINT "GEGNachweisGewerbe_geg_einpreisung_id_fkey";
-- DropForeignKey
ALTER TABLE "GEGNachweisGewerbe" DROP CONSTRAINT "GEGNachweisGewerbe_rechnung_id_fkey";
-- DropForeignKey
ALTER TABLE "GEGNachweisWohnen" DROP CONSTRAINT "GEGNachweisWohnen_aufnahme_id_fkey";
-- DropForeignKey
ALTER TABLE "GEGNachweisWohnen" DROP CONSTRAINT "GEGNachweisWohnen_benutzer_id_fkey";
-- DropForeignKey
ALTER TABLE "GEGNachweisWohnen" DROP CONSTRAINT "GEGNachweisWohnen_geg_einpreisung_id_fkey";
-- DropForeignKey
ALTER TABLE "GEGNachweisWohnen" DROP CONSTRAINT "GEGNachweisWohnen_rechnung_id_fkey";
-- DropForeignKey
ALTER TABLE "Objekt" DROP CONSTRAINT "Objekt_benutzer_id_fkey";
-- DropForeignKey
ALTER TABLE "Rechnung" DROP CONSTRAINT "Rechnung_benutzer_id_fkey";
-- DropForeignKey
ALTER TABLE "RefreshTokens" DROP CONSTRAINT "RefreshTokens_benutzer_id_fkey";
-- DropForeignKey
ALTER TABLE "Tickets" DROP CONSTRAINT "Tickets_bearbeiter_id_fkey";
-- DropForeignKey
ALTER TABLE "Tickets" DROP CONSTRAINT "Tickets_benutzer_id_fkey";
-- DropForeignKey
ALTER TABLE "Unterlage" DROP CONSTRAINT "Unterlage_aufnahme_id_fkey";
-- DropForeignKey
ALTER TABLE "VerbrauchsausweisGewerbe" DROP CONSTRAINT "VerbrauchsausweisGewerbe_aufnahme_id_fkey";
-- DropForeignKey
ALTER TABLE "VerbrauchsausweisGewerbe" DROP CONSTRAINT "VerbrauchsausweisGewerbe_benutzer_id_fkey";
-- DropForeignKey
ALTER TABLE "VerbrauchsausweisGewerbe" DROP CONSTRAINT "VerbrauchsausweisGewerbe_rechnung_id_fkey";
-- DropForeignKey
ALTER TABLE "VerbrauchsausweisWohnen" DROP CONSTRAINT "VerbrauchsausweisWohnen_aufnahme_id_fkey";
-- DropForeignKey
ALTER TABLE "VerbrauchsausweisWohnen" DROP CONSTRAINT "VerbrauchsausweisWohnen_benutzer_id_fkey";
-- DropForeignKey
ALTER TABLE "VerbrauchsausweisWohnen" DROP CONSTRAINT "VerbrauchsausweisWohnen_rechnung_id_fkey";
-- DropForeignKey
ALTER TABLE "documenttemplates" DROP CONSTRAINT "benutzer_fk";
-- DropForeignKey
ALTER TABLE "tokens" DROP CONSTRAINT "fk_benutzer_tokens_user_id";
-- DropIndex
DROP INDEX "Anteilshaber_uid_key";
-- DropIndex
DROP INDEX "Aufnahme_uid_key";
-- DropIndex
DROP INDEX "BedarfsausweisGewerbe_uid_key";
-- DropIndex
DROP INDEX "BedarfsausweisWohnen_uid_key";
-- DropIndex
DROP INDEX "Event_uid_key";
-- DropIndex
DROP INDEX "GEGEinpreisung_uid_key";
-- DropIndex
DROP INDEX "GEGNachweisGewerbe_uid_key";
-- DropIndex
DROP INDEX "GEGNachweisWohnen_uid_key";
-- DropIndex
DROP INDEX "Objekt_uid_key";
-- DropIndex
DROP INDEX "Rechnung_uid_key";
-- DropIndex
DROP INDEX "Tickets_uid_key";
-- DropIndex
DROP INDEX "Unterlage_uid_key";
-- DropIndex
DROP INDEX "VerbrauchsausweisGewerbe_uid_key";
-- DropIndex
DROP INDEX "VerbrauchsausweisWohnen_uid_key";
-- DropIndex
DROP INDEX "benutzer_uid_key";
-- AlterTable
ALTER TABLE "Anteilshaber" DROP CONSTRAINT "Anteilshaber_pkey",
DROP COLUMN "uid",
ALTER COLUMN "id" DROP DEFAULT,
ALTER COLUMN "id" SET DATA TYPE VARCHAR(8),
ALTER COLUMN "benutzer_id" SET DATA TYPE TEXT,
ALTER COLUMN "objekt_id" SET DATA TYPE TEXT,
ADD CONSTRAINT "Anteilshaber_pkey" PRIMARY KEY ("id");
DROP SEQUENCE "Anteilshaber_id_seq";
-- AlterTable
ALTER TABLE "ApiRequests" DROP CONSTRAINT "ApiRequests_pkey",
ALTER COLUMN "id" DROP DEFAULT,
ALTER COLUMN "id" SET DATA TYPE VARCHAR(8),
ALTER COLUMN "user_id" SET DATA TYPE TEXT,
ADD CONSTRAINT "ApiRequests_pkey" PRIMARY KEY ("id");
DROP SEQUENCE "ApiRequests_id_seq";
-- AlterTable
ALTER TABLE "Aufnahme" DROP CONSTRAINT "Aufnahme_pkey",
DROP COLUMN "uid",
ALTER COLUMN "id" DROP DEFAULT,
ALTER COLUMN "id" SET DATA TYPE VARCHAR(8),
ALTER COLUMN "benutzer_id" SET DATA TYPE TEXT,
ALTER COLUMN "objekt_id" SET DATA TYPE TEXT,
ADD CONSTRAINT "Aufnahme_pkey" PRIMARY KEY ("id");
DROP SEQUENCE "Aufnahme_id_seq";
-- AlterTable
ALTER TABLE "BedarfsausweisGewerbe" DROP CONSTRAINT "BedarfsausweisGewerbe_pkey",
DROP COLUMN "uid",
ALTER COLUMN "id" DROP DEFAULT,
ALTER COLUMN "id" SET DATA TYPE VARCHAR(8),
ALTER COLUMN "benutzer_id" SET DATA TYPE TEXT,
ALTER COLUMN "aufnahme_id" SET DATA TYPE TEXT,
ALTER COLUMN "rechnung_id" SET DATA TYPE TEXT,
ALTER COLUMN "geg_einpreisung_id" SET DATA TYPE TEXT,
ADD CONSTRAINT "BedarfsausweisGewerbe_pkey" PRIMARY KEY ("id");
DROP SEQUENCE "BedarfsausweisGewerbe_id_seq";
-- AlterTable
ALTER TABLE "BedarfsausweisWohnen" DROP CONSTRAINT "BedarfsausweisWohnen_pkey",
DROP COLUMN "uid",
ALTER COLUMN "id" DROP DEFAULT,
ALTER COLUMN "id" SET DATA TYPE VARCHAR(8),
ALTER COLUMN "benutzer_id" SET DATA TYPE TEXT,
ALTER COLUMN "rechnung_id" SET DATA TYPE TEXT,
ALTER COLUMN "aufnahme_id" SET DATA TYPE TEXT,
ADD CONSTRAINT "BedarfsausweisWohnen_pkey" PRIMARY KEY ("id");
DROP SEQUENCE "BedarfsausweisWohnen_id_seq";
-- AlterTable
ALTER TABLE "Bild" DROP CONSTRAINT "Bild_pkey",
ALTER COLUMN "id" DROP DEFAULT,
ALTER COLUMN "id" SET DATA TYPE VARCHAR(8),
ALTER COLUMN "uid" SET DEFAULT 'img-' || gen_random_uuid(),
ALTER COLUMN "aufnahme_id" SET DATA TYPE TEXT,
ADD CONSTRAINT "Bild_pkey" PRIMARY KEY ("id");
DROP SEQUENCE "Bild_id_seq";
-- AlterTable
ALTER TABLE "Event" DROP CONSTRAINT "Event_pkey",
DROP COLUMN "uid",
ALTER COLUMN "id" DROP DEFAULT,
ALTER COLUMN "id" SET DATA TYPE VARCHAR(8),
ALTER COLUMN "aufnahme_id" SET DATA TYPE TEXT,
ALTER COLUMN "benutzer_id" SET DATA TYPE TEXT,
ADD CONSTRAINT "Event_pkey" PRIMARY KEY ("id");
DROP SEQUENCE "Event_id_seq";
-- AlterTable
ALTER TABLE "GEGEinpreisung" DROP CONSTRAINT "GEGEinpreisung_pkey",
DROP COLUMN "uid",
ALTER COLUMN "id" DROP DEFAULT,
ALTER COLUMN "id" SET DATA TYPE VARCHAR(8),
ALTER COLUMN "benutzer_id" SET DATA TYPE TEXT,
ADD CONSTRAINT "GEGEinpreisung_pkey" PRIMARY KEY ("id");
DROP SEQUENCE "GEGEinpreisung_id_seq";
-- AlterTable
ALTER TABLE "GEGNachweisGewerbe" DROP CONSTRAINT "GEGNachweisGewerbe_pkey",
DROP COLUMN "uid",
ALTER COLUMN "id" DROP DEFAULT,
ALTER COLUMN "id" SET DATA TYPE VARCHAR(8),
ALTER COLUMN "benutzer_id" SET DATA TYPE TEXT,
ALTER COLUMN "aufnahme_id" SET DATA TYPE TEXT,
ALTER COLUMN "rechnung_id" SET DATA TYPE TEXT,
ALTER COLUMN "geg_einpreisung_id" SET DATA TYPE TEXT,
ADD CONSTRAINT "GEGNachweisGewerbe_pkey" PRIMARY KEY ("id");
DROP SEQUENCE "GEGNachweisGewerbe_id_seq";
-- AlterTable
ALTER TABLE "GEGNachweisWohnen" DROP CONSTRAINT "GEGNachweisWohnen_pkey",
DROP COLUMN "uid",
ALTER COLUMN "id" DROP DEFAULT,
ALTER COLUMN "id" SET DATA TYPE VARCHAR(8),
ALTER COLUMN "benutzer_id" SET DATA TYPE TEXT,
ALTER COLUMN "aufnahme_id" SET DATA TYPE TEXT,
ALTER COLUMN "rechnung_id" SET DATA TYPE TEXT,
ALTER COLUMN "geg_einpreisung_id" SET DATA TYPE TEXT,
ADD CONSTRAINT "GEGNachweisWohnen_pkey" PRIMARY KEY ("id");
DROP SEQUENCE "GEGNachweisWohnen_id_seq";
-- AlterTable
ALTER TABLE "Objekt" DROP CONSTRAINT "Objekt_pkey",
DROP COLUMN "uid",
ALTER COLUMN "id" DROP DEFAULT,
ALTER COLUMN "id" SET DATA TYPE VARCHAR(8),
ALTER COLUMN "benutzer_id" SET DATA TYPE TEXT,
ADD CONSTRAINT "Objekt_pkey" PRIMARY KEY ("id");
DROP SEQUENCE "Objekt_id_seq";
-- AlterTable
ALTER TABLE "Rechnung" DROP CONSTRAINT "Rechnung_pkey",
DROP COLUMN "uid",
ALTER COLUMN "id" DROP DEFAULT,
ALTER COLUMN "id" SET DATA TYPE VARCHAR(8),
ALTER COLUMN "benutzer_id" SET DATA TYPE TEXT,
ADD CONSTRAINT "Rechnung_pkey" PRIMARY KEY ("id");
DROP SEQUENCE "Rechnung_id_seq";
-- AlterTable
ALTER TABLE "RefreshTokens" ALTER COLUMN "benutzer_id" SET DATA TYPE TEXT;
-- AlterTable
ALTER TABLE "Tickets" DROP CONSTRAINT "Tickets_pkey",
DROP COLUMN "uid",
ALTER COLUMN "id" DROP DEFAULT,
ALTER COLUMN "id" SET DATA TYPE VARCHAR(8),
ALTER COLUMN "benutzer_id" SET DATA TYPE TEXT,
ALTER COLUMN "bearbeiter_id" SET DATA TYPE TEXT,
ADD CONSTRAINT "Tickets_pkey" PRIMARY KEY ("id");
DROP SEQUENCE "Tickets_id_seq";
-- AlterTable
ALTER TABLE "Unterlage" DROP CONSTRAINT "Unterlage_pkey",
DROP COLUMN "uid",
ALTER COLUMN "id" DROP DEFAULT,
ALTER COLUMN "id" SET DATA TYPE VARCHAR(8),
ALTER COLUMN "aufnahme_id" SET DATA TYPE TEXT,
ADD CONSTRAINT "Unterlage_pkey" PRIMARY KEY ("id");
DROP SEQUENCE "Unterlage_id_seq";
-- AlterTable
ALTER TABLE "VerbrauchsausweisGewerbe" DROP CONSTRAINT "VerbrauchsausweisGewerbe_pkey",
DROP COLUMN "uid",
ALTER COLUMN "id" DROP DEFAULT,
ALTER COLUMN "id" SET DATA TYPE VARCHAR(8),
ALTER COLUMN "benutzer_id" SET DATA TYPE TEXT,
ALTER COLUMN "rechnung_id" SET DATA TYPE TEXT,
ALTER COLUMN "aufnahme_id" SET DATA TYPE TEXT,
ADD CONSTRAINT "VerbrauchsausweisGewerbe_pkey" PRIMARY KEY ("id");
DROP SEQUENCE "VerbrauchsausweisGewerbe_id_seq";
-- AlterTable
ALTER TABLE "VerbrauchsausweisWohnen" DROP CONSTRAINT "VerbrauchsausweisWohnen_pkey",
DROP COLUMN "uid",
ALTER COLUMN "id" DROP DEFAULT,
ALTER COLUMN "id" SET DATA TYPE VARCHAR(8),
ALTER COLUMN "benutzer_id" SET DATA TYPE TEXT,
ALTER COLUMN "rechnung_id" SET DATA TYPE TEXT,
ALTER COLUMN "aufnahme_id" SET DATA TYPE TEXT,
ADD CONSTRAINT "VerbrauchsausweisWohnen_pkey" PRIMARY KEY ("id");
DROP SEQUENCE "VerbrauchsausweisWohnen_id_seq";
-- AlterTable
ALTER TABLE "benutzer" DROP CONSTRAINT "benutzer_pkey",
DROP COLUMN "uid",
ALTER COLUMN "id" DROP DEFAULT,
ALTER COLUMN "id" SET DATA TYPE VARCHAR(8),
ADD CONSTRAINT "benutzer_pkey" PRIMARY KEY ("id");
DROP SEQUENCE "benutzer_id_seq";
-- AlterTable
ALTER TABLE "documenttemplates" ALTER COLUMN "user_id" SET DATA TYPE TEXT;
-- AlterTable
ALTER TABLE "tokens" ALTER COLUMN "user_id" SET DATA TYPE TEXT;
-- CreateIndex
CREATE UNIQUE INDEX "Anteilshaber_id_key" ON "Anteilshaber"("id");
-- CreateIndex
CREATE UNIQUE INDEX "ApiRequests_id_key" ON "ApiRequests"("id");
-- CreateIndex
CREATE UNIQUE INDEX "Aufnahme_id_key" ON "Aufnahme"("id");
-- CreateIndex
CREATE UNIQUE INDEX "BedarfsausweisGewerbe_id_key" ON "BedarfsausweisGewerbe"("id");
-- CreateIndex
CREATE UNIQUE INDEX "BedarfsausweisWohnen_id_key" ON "BedarfsausweisWohnen"("id");
-- CreateIndex
CREATE UNIQUE INDEX "Bild_id_key" ON "Bild"("id");
-- CreateIndex
CREATE UNIQUE INDEX "Event_id_key" ON "Event"("id");
-- CreateIndex
CREATE UNIQUE INDEX "GEGEinpreisung_id_key" ON "GEGEinpreisung"("id");
-- CreateIndex
CREATE UNIQUE INDEX "GEGNachweisGewerbe_id_key" ON "GEGNachweisGewerbe"("id");
-- CreateIndex
CREATE UNIQUE INDEX "GEGNachweisWohnen_id_key" ON "GEGNachweisWohnen"("id");
-- CreateIndex
CREATE UNIQUE INDEX "Objekt_id_key" ON "Objekt"("id");
-- CreateIndex
CREATE UNIQUE INDEX "Rechnung_id_key" ON "Rechnung"("id");
-- CreateIndex
CREATE UNIQUE INDEX "Tickets_id_key" ON "Tickets"("id");
-- CreateIndex
CREATE UNIQUE INDEX "Unterlage_id_key" ON "Unterlage"("id");
-- CreateIndex
CREATE UNIQUE INDEX "VerbrauchsausweisGewerbe_id_key" ON "VerbrauchsausweisGewerbe"("id");
-- CreateIndex
CREATE UNIQUE INDEX "VerbrauchsausweisWohnen_id_key" ON "VerbrauchsausweisWohnen"("id");
-- CreateIndex
CREATE UNIQUE INDEX "benutzer_id_key" ON "benutzer"("id");
-- AddForeignKey
ALTER TABLE "Anteilshaber" ADD CONSTRAINT "Anteilshaber_benutzer_id_fkey" FOREIGN KEY ("benutzer_id") REFERENCES "benutzer"("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
-- AddForeignKey
ALTER TABLE "Anteilshaber" ADD CONSTRAINT "Anteilshaber_objekt_id_fkey" FOREIGN KEY ("objekt_id") REFERENCES "Objekt"("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
-- AddForeignKey
ALTER TABLE "ApiRequests" ADD CONSTRAINT "ApiRequests_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "benutzer"("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
-- AddForeignKey
ALTER TABLE "Aufnahme" ADD CONSTRAINT "Aufnahme_benutzer_id_fkey" FOREIGN KEY ("benutzer_id") REFERENCES "benutzer"("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
-- AddForeignKey
ALTER TABLE "Aufnahme" ADD CONSTRAINT "Aufnahme_objekt_id_fkey" FOREIGN KEY ("objekt_id") REFERENCES "Objekt"("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
-- AddForeignKey
ALTER TABLE "BedarfsausweisGewerbe" ADD CONSTRAINT "BedarfsausweisGewerbe_benutzer_id_fkey" FOREIGN KEY ("benutzer_id") REFERENCES "benutzer"("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
-- AddForeignKey
ALTER TABLE "BedarfsausweisGewerbe" ADD CONSTRAINT "BedarfsausweisGewerbe_aufnahme_id_fkey" FOREIGN KEY ("aufnahme_id") REFERENCES "Aufnahme"("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
-- AddForeignKey
ALTER TABLE "BedarfsausweisGewerbe" ADD CONSTRAINT "BedarfsausweisGewerbe_rechnung_id_fkey" FOREIGN KEY ("rechnung_id") REFERENCES "Rechnung"("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
-- AddForeignKey
ALTER TABLE "BedarfsausweisGewerbe" ADD CONSTRAINT "BedarfsausweisGewerbe_geg_einpreisung_id_fkey" FOREIGN KEY ("geg_einpreisung_id") REFERENCES "GEGEinpreisung"("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
-- AddForeignKey
ALTER TABLE "BedarfsausweisWohnen" ADD CONSTRAINT "BedarfsausweisWohnen_benutzer_id_fkey" FOREIGN KEY ("benutzer_id") REFERENCES "benutzer"("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
-- AddForeignKey
ALTER TABLE "BedarfsausweisWohnen" ADD CONSTRAINT "BedarfsausweisWohnen_rechnung_id_fkey" FOREIGN KEY ("rechnung_id") REFERENCES "Rechnung"("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
-- AddForeignKey
ALTER TABLE "BedarfsausweisWohnen" ADD CONSTRAINT "BedarfsausweisWohnen_aufnahme_id_fkey" FOREIGN KEY ("aufnahme_id") REFERENCES "Aufnahme"("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
-- AddForeignKey
ALTER TABLE "Bild" ADD CONSTRAINT "Bild_aufnahme_id_fkey" FOREIGN KEY ("aufnahme_id") REFERENCES "Aufnahme"("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
-- AddForeignKey
ALTER TABLE "Event" ADD CONSTRAINT "Event_aufnahme_id_fkey" FOREIGN KEY ("aufnahme_id") REFERENCES "Aufnahme"("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
-- AddForeignKey
ALTER TABLE "Event" ADD CONSTRAINT "Event_benutzer_id_fkey" FOREIGN KEY ("benutzer_id") REFERENCES "benutzer"("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
-- AddForeignKey
ALTER TABLE "GEGEinpreisung" ADD CONSTRAINT "GEGEinpreisung_benutzer_id_fkey" FOREIGN KEY ("benutzer_id") REFERENCES "benutzer"("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
-- AddForeignKey
ALTER TABLE "GEGNachweisGewerbe" ADD CONSTRAINT "GEGNachweisGewerbe_benutzer_id_fkey" FOREIGN KEY ("benutzer_id") REFERENCES "benutzer"("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
-- AddForeignKey
ALTER TABLE "GEGNachweisGewerbe" ADD CONSTRAINT "GEGNachweisGewerbe_aufnahme_id_fkey" FOREIGN KEY ("aufnahme_id") REFERENCES "Aufnahme"("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
-- AddForeignKey
ALTER TABLE "GEGNachweisGewerbe" ADD CONSTRAINT "GEGNachweisGewerbe_rechnung_id_fkey" FOREIGN KEY ("rechnung_id") REFERENCES "Rechnung"("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
-- AddForeignKey
ALTER TABLE "GEGNachweisGewerbe" ADD CONSTRAINT "GEGNachweisGewerbe_geg_einpreisung_id_fkey" FOREIGN KEY ("geg_einpreisung_id") REFERENCES "GEGEinpreisung"("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
-- AddForeignKey
ALTER TABLE "GEGNachweisWohnen" ADD CONSTRAINT "GEGNachweisWohnen_benutzer_id_fkey" FOREIGN KEY ("benutzer_id") REFERENCES "benutzer"("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
-- AddForeignKey
ALTER TABLE "GEGNachweisWohnen" ADD CONSTRAINT "GEGNachweisWohnen_aufnahme_id_fkey" FOREIGN KEY ("aufnahme_id") REFERENCES "Aufnahme"("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
-- AddForeignKey
ALTER TABLE "GEGNachweisWohnen" ADD CONSTRAINT "GEGNachweisWohnen_rechnung_id_fkey" FOREIGN KEY ("rechnung_id") REFERENCES "Rechnung"("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
-- AddForeignKey
ALTER TABLE "GEGNachweisWohnen" ADD CONSTRAINT "GEGNachweisWohnen_geg_einpreisung_id_fkey" FOREIGN KEY ("geg_einpreisung_id") REFERENCES "GEGEinpreisung"("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
-- AddForeignKey
ALTER TABLE "Objekt" ADD CONSTRAINT "Objekt_benutzer_id_fkey" FOREIGN KEY ("benutzer_id") REFERENCES "benutzer"("id") ON DELETE SET NULL ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Rechnung" ADD CONSTRAINT "Rechnung_benutzer_id_fkey" FOREIGN KEY ("benutzer_id") REFERENCES "benutzer"("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
-- AddForeignKey
ALTER TABLE "RefreshTokens" ADD CONSTRAINT "RefreshTokens_benutzer_id_fkey" FOREIGN KEY ("benutzer_id") REFERENCES "benutzer"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Tickets" ADD CONSTRAINT "Tickets_benutzer_id_fkey" FOREIGN KEY ("benutzer_id") REFERENCES "benutzer"("id") ON DELETE SET NULL ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Tickets" ADD CONSTRAINT "Tickets_bearbeiter_id_fkey" FOREIGN KEY ("bearbeiter_id") REFERENCES "benutzer"("id") ON DELETE SET NULL ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Unterlage" ADD CONSTRAINT "Unterlage_aufnahme_id_fkey" FOREIGN KEY ("aufnahme_id") REFERENCES "Aufnahme"("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
-- AddForeignKey
ALTER TABLE "VerbrauchsausweisGewerbe" ADD CONSTRAINT "VerbrauchsausweisGewerbe_benutzer_id_fkey" FOREIGN KEY ("benutzer_id") REFERENCES "benutzer"("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
-- AddForeignKey
ALTER TABLE "VerbrauchsausweisGewerbe" ADD CONSTRAINT "VerbrauchsausweisGewerbe_rechnung_id_fkey" FOREIGN KEY ("rechnung_id") REFERENCES "Rechnung"("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
-- AddForeignKey
ALTER TABLE "VerbrauchsausweisGewerbe" ADD CONSTRAINT "VerbrauchsausweisGewerbe_aufnahme_id_fkey" FOREIGN KEY ("aufnahme_id") REFERENCES "Aufnahme"("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
-- AddForeignKey
ALTER TABLE "VerbrauchsausweisWohnen" ADD CONSTRAINT "VerbrauchsausweisWohnen_benutzer_id_fkey" FOREIGN KEY ("benutzer_id") REFERENCES "benutzer"("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
-- AddForeignKey
ALTER TABLE "VerbrauchsausweisWohnen" ADD CONSTRAINT "VerbrauchsausweisWohnen_rechnung_id_fkey" FOREIGN KEY ("rechnung_id") REFERENCES "Rechnung"("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
-- AddForeignKey
ALTER TABLE "VerbrauchsausweisWohnen" ADD CONSTRAINT "VerbrauchsausweisWohnen_aufnahme_id_fkey" FOREIGN KEY ("aufnahme_id") REFERENCES "Aufnahme"("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
-- AddForeignKey
ALTER TABLE "documenttemplates" ADD CONSTRAINT "benutzer_fk" FOREIGN KEY ("user_id") REFERENCES "benutzer"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "tokens" ADD CONSTRAINT "fk_benutzer_tokens_user_id" FOREIGN KEY ("user_id") REFERENCES "benutzer"("id") ON DELETE NO ACTION ON UPDATE NO ACTION;

View File

@@ -1,11 +1,11 @@
model Anteilshaber {
id Int @id @default(autoincrement())
benutzer_id Int
id String @id @unique @db.VarChar(8)
rolle String? @db.VarChar
privilegien BigInt?
uid String @unique @default(dbgenerated("'ant-' || gen_random_uuid()"))
benutzer_id String
benutzer Benutzer @relation(fields: [benutzer_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
objekt_id Int
objekt_id String
objekt Objekt @relation(fields: [objekt_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
}

View File

@@ -1,6 +1,6 @@
model ApiRequests {
id Int @id @default(autoincrement())
id String @id @unique @db.VarChar(8)
date DateTime @default(now()) @db.Timestamp(6)
ip String @db.VarChar(50)
method String @db.VarChar(10)
@@ -9,6 +9,6 @@ model ApiRequests {
responseTime Float
responseSize Int
userAgent String @db.VarChar(500)
user_id Int?
user_id String?
user Benutzer? @relation(fields: [user_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
}

View File

@@ -13,10 +13,8 @@ enum Lueftungskonzept {
}
model Aufnahme {
id Int @id @default(autoincrement())
/// @zod.describe("UID der Gebäude Aufnahme")
uid String @unique @default(dbgenerated("'auf-' || gen_random_uuid()"))
benutzer_id Int?
id String @id @unique @db.VarChar(8)
benutzer_id String?
benutzer Benutzer? @relation(fields: [benutzer_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
/// @zod.describe("Art des korrespondierenden Ausweises, wie z.B. VerbrauchsausweisWohnen")
ausweisart Ausweisart?
@@ -142,7 +140,7 @@ model Aufnahme {
geg_nachweise_gewerbe GEGNachweisGewerbe[]
bedarfsausweise_gewerbe BedarfsausweisGewerbe[]
objekt_id Int
objekt_id String
objekt Objekt @relation(fields: [objekt_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
}

View File

@@ -1,6 +1,5 @@
model BedarfsausweisGewerbe {
id Int @id @default(autoincrement())
uid String @unique @default(dbgenerated("'bag-' || gen_random_uuid()"))
id String @id @unique @db.VarChar(8)
/// @zod.describe("Ausstellgrund wie z.B. Vermietung oder Verkauf")
ausstellgrund Ausstellgrund?
@@ -27,13 +26,13 @@ model BedarfsausweisGewerbe {
klimatisierung Boolean? @default(false)
/// @zod.describe("Die ID des Benutzers, welchem dieser Ausweis gehört")
benutzer_id Int?
benutzer_id String?
benutzer Benutzer? @relation(fields: [benutzer_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
aufnahme_id Int @unique
aufnahme_id String @unique
aufnahme Aufnahme @relation(fields: [aufnahme_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
rechnung_id Int? @unique
rechnung_id String? @unique
rechnung Rechnung? @relation(fields: [rechnung_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
geg_einpreisung_id Int? @unique
geg_einpreisung_id String? @unique
geg_einpreisung GEGEinpreisung? @relation(fields: [geg_einpreisung_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
}

View File

@@ -1,9 +1,8 @@
model BedarfsausweisWohnen {
id Int @id @default(autoincrement())
id String @id @unique @db.VarChar(8)
alte_ausweis_id Int?
uid String @unique @default(dbgenerated("'baw-' || gen_random_uuid()"))
benutzer_id Int?
benutzer_id String?
ausstellgrund Ausstellgrund?
registriernummer String? @db.VarChar
@@ -83,10 +82,10 @@ model BedarfsausweisWohnen {
benutzer Benutzer? @relation(fields: [benutzer_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
rechnung_id Int? @unique
rechnung_id String? @unique
rechnung Rechnung? @relation(fields: [rechnung_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
/// @zod.describe("ID der korrespondierenden Gebäudeaufnahme")
aufnahme_id Int @unique
aufnahme_id String @unique
aufnahme Aufnahme @relation(fields: [aufnahme_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
}

View File

@@ -5,8 +5,7 @@ enum BenutzerRolle {
}
model Benutzer {
id Int @id @default(autoincrement())
uid String @unique @default(dbgenerated("'usr-' || gen_random_uuid()"))
id String @id @unique @db.VarChar(8)
name String? @db.VarChar(50)
vorname String? @db.VarChar(50)
email String @unique(map: "benutzer_email_idx") @db.VarChar(255)

View File

@@ -8,11 +8,10 @@ enum BilderKategorie {
}
model Bild {
id Int @id @default(autoincrement())
id String @id @unique @db.VarChar(8)
kategorie BilderKategorie
uid String @unique @default(dbgenerated("'img-' || gen_random_uuid()"))
name String
aufnahme_id Int?
aufnahme_id String?
aufnahme Aufnahme? @relation(fields: [aufnahme_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
}

View File

@@ -3,8 +3,7 @@
// Hier werden beispielsweise Events wie "Nachricht Verschickt" gespeichert.
// Diese Events werden dann in der Admin-Oberfläche angezeigt.
model Event {
id Int @id @default(autoincrement())
uid String @unique @default(dbgenerated("'evt-' || gen_random_uuid()"))
id String @id @unique @db.VarChar(8)
date DateTime @default(now()) @db.Timestamp(6)
title String @db.VarChar(255)
@@ -12,9 +11,9 @@ model Event {
// Verlinkung des Gebäudes
aufnahme_id Int
aufnahme_id String
aufnahme Aufnahme @relation(fields: [aufnahme_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
// Verlinkung des Benutzers
benutzer_id Int?
benutzer_id String?
benutzer Benutzer? @relation(fields: [benutzer_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
}

View File

@@ -6,8 +6,7 @@ enum Einpreisungsstatus {
}
model GEGEinpreisung {
id Int @id @default(autoincrement())
uid String @unique @default(dbgenerated("'gge-' || gen_random_uuid()"))
id String @id @unique @db.VarChar(8)
empfaenger String? @db.VarChar
strasse String? @db.VarChar
@@ -31,6 +30,6 @@ model GEGEinpreisung {
bedarfsausweis_gewerbe BedarfsausweisGewerbe?
/// @zod.describe("Die ID des Benutzers, der diese Einpreisung bekommt.")
benutzer_id Int?
benutzer_id String?
benutzer Benutzer? @relation(fields: [benutzer_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
}

View File

@@ -1,6 +1,5 @@
model GEGNachweisGewerbe {
id Int @id @default(autoincrement())
uid String @unique @default(dbgenerated("'gng-' || gen_random_uuid()"))
id String @id @unique @db.VarChar(8)
/// @zod.describe("Ausstellgrund wie z.B. Vermietung oder Verkauf")
ausstellgrund Ausstellgrund?
@@ -18,13 +17,13 @@ model GEGNachweisGewerbe {
beschreibung String? @db.Text
/// @zod.describe("Die ID des Benutzers, welchem dieser Ausweis gehört")
benutzer_id Int?
benutzer_id String?
benutzer Benutzer? @relation(fields: [benutzer_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
aufnahme_id Int @unique
aufnahme_id String @unique
aufnahme Aufnahme @relation(fields: [aufnahme_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
rechnung_id Int? @unique
rechnung_id String? @unique
rechnung Rechnung? @relation(fields: [rechnung_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
geg_einpreisung_id Int? @unique
geg_einpreisung_id String? @unique
geg_einpreisung GEGEinpreisung? @relation(fields: [geg_einpreisung_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
}

View File

@@ -1,6 +1,5 @@
model GEGNachweisWohnen {
id Int @id @default(autoincrement())
uid String @unique @default(dbgenerated("'gnw-' || gen_random_uuid()"))
id String @id @unique @db.VarChar(8)
/// @zod.describe("Ausstellgrund wie z.B. Vermietung oder Verkauf")
ausstellgrund Ausstellgrund?
@@ -18,13 +17,13 @@ model GEGNachweisWohnen {
beschreibung String? @db.Text
/// @zod.describe("Die ID des Benutzers, welchem dieser Ausweis gehört")
benutzer_id Int?
benutzer_id String?
benutzer Benutzer? @relation(fields: [benutzer_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
aufnahme_id Int @unique
aufnahme_id String @unique
aufnahme Aufnahme @relation(fields: [aufnahme_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
rechnung_id Int? @unique
rechnung_id String? @unique
rechnung Rechnung? @relation(fields: [rechnung_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
geg_einpreisung_id Int? @unique
geg_einpreisung_id String? @unique
geg_einpreisung GEGEinpreisung? @relation(fields: [geg_einpreisung_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
}

View File

@@ -1,7 +1,5 @@
model Objekt {
id Int @id @default(autoincrement())
uid String @unique @default(dbgenerated("'obj-' || gen_random_uuid()"))
benutzer_id Int?
id String @id @unique @db.VarChar(8)
latitude Float?
longitude Float?
@@ -15,6 +13,7 @@ model Objekt {
erstellungsdatum DateTime? @default(now())
benutzer_id String?
benutzer Benutzer? @relation(fields: [benutzer_id], references: [id])
aufnahmen Aufnahme[]
anteilshaber Anteilshaber[]

View File

@@ -24,10 +24,8 @@ enum AusweisTyp {
}
model Rechnung {
id Int @id @default(autoincrement())
uid String @unique @default(dbgenerated("'inv-' || gen_random_uuid()"))
id String @id @unique @db.VarChar(8)
benutzer_id Int
empfaenger String? @db.VarChar
strasse String? @db.VarChar
plz String? @db.VarChar
@@ -52,6 +50,7 @@ model Rechnung {
storniert_am DateTime?
transaktions_referenz String? @unique @db.VarChar
benutzer_id String
benutzer Benutzer @relation(fields: [benutzer_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
verbrauchsausweis_wohnen VerbrauchsausweisWohnen?

View File

@@ -1,7 +1,6 @@
model RefreshTokens {
id Int @id @default(autoincrement())
benutzer_id Int
token String @unique
// Wir nehmen die IP Adresse des Clients mit auf.
// Falls sich die IP Adresse eines Refresh Token Owners ändert, können wir diesen einfach invalidieren.
@@ -9,5 +8,6 @@ model RefreshTokens {
expiry DateTime
// Relationen
benutzer_id String
user Benutzer @relation(fields: [benutzer_id], references: [id], onDelete: Cascade)
}

View File

@@ -8,9 +8,7 @@ enum TicketStatus {
}
model Tickets {
id Int @id @default(autoincrement())
uid String @unique @default(dbgenerated("'tkt-' || gen_random_uuid()"))
benutzer_id Int?
id String @id @unique @db.VarChar(8)
created_at DateTime @default(now())
updated_at DateTime? @updatedAt
deleted_at DateTime?
@@ -21,10 +19,11 @@ model Tickets {
metadata Json?
email String
bearbeiter_id Int?
bearbeiter_id String?
prioritaet Int? @default(0)
// Relationen
benutzer_id String?
benutzer Benutzer? @relation(fields: [benutzer_id], references: [id], name: "ErstellteTickets")
bearbeiter Benutzer? @relation(fields: [bearbeiter_id], references: [id], name: "BearbeiteteTickets")
}

View File

@@ -5,12 +5,11 @@ enum UnterlagenKategorie {
}
model Unterlage {
id Int @id @default(autoincrement())
uid String @unique @default(dbgenerated("'pln-' || gen_random_uuid()"))
id String @id @unique @db.VarChar(8)
name String?
kategorie String?
mime String?
aufnahme_id Int?
aufnahme_id String?
aufnahme Aufnahme? @relation(fields: [aufnahme_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
}

View File

@@ -1,9 +1,7 @@
model VerbrauchsausweisGewerbe {
id Int @id @default(autoincrement())
id String @id @unique @db.VarChar(8)
alte_ausweis_id Int?
uid String @unique @default(dbgenerated("'vag-' || gen_random_uuid()"))
benutzer_id Int?
ausstellgrund Ausstellgrund?
registriernummer String? @db.VarChar
zusaetzliche_heizquelle Boolean?
@@ -68,12 +66,13 @@ model VerbrauchsausweisGewerbe {
ausweistyp AusweisTyp @default(Standard)
benutzer_id String?
benutzer Benutzer? @relation(fields: [benutzer_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
rechnung_id Int? @unique
rechnung_id String? @unique
rechnung Rechnung? @relation(fields: [rechnung_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
/// @zod.describe("ID der korrespondierenden Gebäudeaufnahme")
aufnahme_id Int @unique
aufnahme_id String @unique
aufnahme Aufnahme @relation(fields: [aufnahme_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
}

View File

@@ -1,11 +1,8 @@
model VerbrauchsausweisWohnen {
id Int @id @default(autoincrement())
/// @zod.describe("ID des Ausweises")
id String @id @unique @db.VarChar(8)
alte_ausweis_id Int?
/// @zod.describe("UID des Ausweises")
uid String @unique @default(dbgenerated("'vaw-' || gen_random_uuid()"))
/// @zod.describe("Die ID des Benutzers, welchem dieser Ausweis gehört")
benutzer_id Int?
/// @zod.describe("Ausstellgrund wie z.B. Vermietung oder Verkauf")
ausstellgrund Ausstellgrund?
/// @zod.describe("Die Registriernummer des Ausweises")
@@ -72,12 +69,14 @@ model VerbrauchsausweisWohnen {
created_at DateTime @default(now())
updated_at DateTime @updatedAt
/// @zod.describe("Die ID des Benutzers, welchem dieser Ausweis gehört")
benutzer_id String?
benutzer Benutzer? @relation(fields: [benutzer_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
rechnung_id Int? @unique
rechnung_id String? @unique
rechnung Rechnung? @relation(fields: [rechnung_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
/// @zod.describe("ID der korrespondierenden Gebäudeaufnahme")
aufnahme_id Int @unique
aufnahme_id String @unique
aufnahme Aufnahme @relation(fields: [aufnahme_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
}

View File

@@ -4,7 +4,7 @@ model documenttemplates {
name String @db.VarChar(100)
shortdescription String @db.VarChar(100)
longdescription String @db.VarChar(5000)
user_id Int
user_id String
is_private Boolean @default(true)
documenttype Int
filename String @db.VarChar(100)

View File

@@ -2,7 +2,7 @@
model tokens {
id Int @id(map: "PK_TOKENS") @default(autoincrement())
token String @db.VarChar(36)
user_id Int
user_id String
date_created DateTime @default(now()) @db.Timestamp(6)
last_used DateTime @default(now()) @db.Timestamp(6)
times_used Int @default(0)

View File

@@ -93,6 +93,7 @@ await prisma.benutzer.create({
vorname: "Admin",
adresse: "Adminstraße 1",
plz: "12345",
id: "USADMIN1"
},
});
@@ -106,6 +107,7 @@ await prisma.benutzer.create({
vorname: "User",
adresse: "Userstraße 1",
plz: "12345",
id: "USUSER01"
},
});