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/20231107224945_transaction/migration.sql
2023-11-14 18:54:44 -05:00

17 lines
516 B
SQL

-- CreateEnum
CREATE TYPE "TransactionType" AS ENUM ('in', 'out');
-- CreateTable
CREATE TABLE "Transaction" (
"id" SERIAL NOT NULL,
"date" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"userId" INTEGER NOT NULL,
"type" "TransactionType" NOT NULL,
"parts" JSONB[],
CONSTRAINT "Transaction_pkey" PRIMARY KEY ("id")
);
-- AddForeignKey
ALTER TABLE "Transaction" ADD CONSTRAINT "Transaction_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;