1
0
This repository has been archived on 2024-11-10. You can view files and clone it, but cannot push or open issues or pull requests.
Files
arduino-parts-inventory/api/db/migrations/20231107152332_transaction/migration.sql
2023-11-14 18:54:44 -05:00

19 lines
605 B
SQL

/*
Warnings:
- Added the required column `type` to the `Transaction` table without a default value. This is not possible if the table is not empty.
*/
-- CreateEnum
CREATE TYPE "TransactionType" AS ENUM ('in', 'out');
-- AlterTable
ALTER TABLE "Part" ADD COLUMN "transactionId" INTEGER;
-- AlterTable
ALTER TABLE "Transaction" ADD COLUMN "quantities" INTEGER[],
ADD COLUMN "type" "TransactionType" NOT NULL;
-- AddForeignKey
ALTER TABLE "Part" ADD CONSTRAINT "Part_transactionId_fkey" FOREIGN KEY ("transactionId") REFERENCES "Transaction"("id") ON DELETE SET NULL ON UPDATE CASCADE;