/* 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;