targo-backend/prisma/postgres/migrations/20251001193437_link_expense_attachments/migration.sql

26 lines
1.2 KiB
SQL

/*
Warnings:
- You are about to drop the column `attachement` on the `expenses` table. All the data in the column will be lost.
- You are about to drop the column `attachement` on the `expenses_archive` table. All the data in the column will be lost.
- Made the column `comment` on table `expenses` required. This step will fail if there are existing NULL values in that column.
*/
-- AlterTable
ALTER TABLE "public"."expenses" DROP COLUMN "attachement",
ADD COLUMN "attachment" INTEGER,
ADD COLUMN "mileage" DECIMAL(65,30),
ALTER COLUMN "comment" SET NOT NULL;
-- AlterTable
ALTER TABLE "public"."expenses_archive" DROP COLUMN "attachement",
ADD COLUMN "attachment" INTEGER,
ADD COLUMN "mileage" DECIMAL(65,30),
ALTER COLUMN "amount" DROP NOT NULL;
-- AddForeignKey
ALTER TABLE "public"."expenses" ADD CONSTRAINT "expenses_attachment_fkey" FOREIGN KEY ("attachment") REFERENCES "public"."attachments"("id") ON DELETE SET NULL ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "public"."expenses_archive" ADD CONSTRAINT "expenses_archive_attachment_fkey" FOREIGN KEY ("attachment") REFERENCES "public"."attachments"("id") ON DELETE SET NULL ON UPDATE CASCADE;