CREATE TYPE "public"."role" AS ENUM('admin', 'mahasiswa', 'plp', 'gudang', 'dosen');--> statement-breakpoint
CREATE TYPE "public"."user_status" AS ENUM('menunggu', 'aktif', 'nonaktif', 'ditolak');--> statement-breakpoint
CREATE TYPE "public"."kondisi_alat" AS ENUM('baik', 'rusak_ringan', 'rusak_berat');--> statement-breakpoint
CREATE TYPE "public"."kategori_peminjaman" AS ENUM('pembelajaran', 'penelitian', 'pengabdian_masyarakat', 'sewa_eksternal');--> statement-breakpoint
CREATE TYPE "public"."kategori_ruangan" AS ENUM('pembelajaran', 'penelitian', 'pengabdian_masyarakat', 'sewa_eksternal');--> statement-breakpoint
CREATE TYPE "public"."status_peminjaman" AS ENUM('menunggu', 'disetujui', 'ditolak', 'dipinjam', 'dikembalikan');--> statement-breakpoint
CREATE TYPE "public"."status_ruangan" AS ENUM('menunggu', 'disetujui', 'ditolak', 'selesai');--> statement-breakpoint
CREATE TYPE "public"."status_permintaan" AS ENUM('menunggu', 'disetujui', 'ditolak', 'disiapkan');--> statement-breakpoint
CREATE TYPE "public"."tujuan_permintaan" AS ENUM('plp', 'gudang');--> statement-breakpoint
CREATE TYPE "public"."tipe_galeri" AS ENUM('foto', 'video');--> statement-breakpoint
CREATE TABLE "jurusan" (
	"id" serial PRIMARY KEY NOT NULL,
	"nama" text NOT NULL,
	"kode" text NOT NULL,
	"created_at" timestamp DEFAULT now() NOT NULL,
	"updated_at" timestamp DEFAULT now() NOT NULL,
	CONSTRAINT "jurusan_kode_unique" UNIQUE("kode")
);
--> statement-breakpoint
CREATE TABLE "laboratorium" (
	"id" serial PRIMARY KEY NOT NULL,
	"nama" text NOT NULL,
	"kode" text NOT NULL,
	"lokasi" text NOT NULL,
	"kapasitas" integer DEFAULT 0 NOT NULL,
	"jurusan_id" integer,
	"deskripsi" text,
	"fasilitas" text,
	"created_at" timestamp DEFAULT now() NOT NULL,
	"updated_at" timestamp DEFAULT now() NOT NULL,
	CONSTRAINT "laboratorium_kode_unique" UNIQUE("kode")
);
--> statement-breakpoint
CREATE TABLE "users" (
	"id" serial PRIMARY KEY NOT NULL,
	"nama" text NOT NULL,
	"email" text NOT NULL,
	"password" text NOT NULL,
	"role" "role" DEFAULT 'mahasiswa' NOT NULL,
	"nim" text,
	"nip" text,
	"no_hp" text,
	"no_wa" text,
	"callmebot_key" text,
	"tanda_tangan" text,
	"angkatan" text,
	"jurusan_id" integer,
	"laboratorium_id" integer,
	"status" "user_status" DEFAULT 'menunggu' NOT NULL,
	"created_at" timestamp DEFAULT now() NOT NULL,
	"updated_at" timestamp DEFAULT now() NOT NULL,
	CONSTRAINT "users_email_unique" UNIQUE("email")
);
--> statement-breakpoint
CREATE TABLE "alat" (
	"id" serial PRIMARY KEY NOT NULL,
	"nama" text NOT NULL,
	"kode" text NOT NULL,
	"deskripsi" text,
	"kondisi" "kondisi_alat" DEFAULT 'baik' NOT NULL,
	"stok" integer DEFAULT 0 NOT NULL,
	"stok_tersedia" integer DEFAULT 0 NOT NULL,
	"satuan" text DEFAULT 'unit' NOT NULL,
	"laboratorium_id" integer NOT NULL,
	"penanggungjawab_id" integer,
	"created_at" timestamp DEFAULT now() NOT NULL,
	"updated_at" timestamp DEFAULT now() NOT NULL,
	CONSTRAINT "alat_kode_unique" UNIQUE("kode")
);
--> statement-breakpoint
CREATE TABLE "bahan" (
	"id" serial PRIMARY KEY NOT NULL,
	"nama" text NOT NULL,
	"kode" text NOT NULL,
	"deskripsi" text,
	"stok" integer DEFAULT 0 NOT NULL,
	"stok_gudang" integer DEFAULT 0 NOT NULL,
	"stok_minimal" integer DEFAULT 0 NOT NULL,
	"satuan" text DEFAULT 'unit' NOT NULL,
	"laboratorium_id" integer NOT NULL,
	"penanggungjawab_id" integer,
	"created_at" timestamp DEFAULT now() NOT NULL,
	"updated_at" timestamp DEFAULT now() NOT NULL,
	CONSTRAINT "bahan_kode_unique" UNIQUE("kode")
);
--> statement-breakpoint
CREATE TABLE "plp_laboratorium" (
	"id" serial PRIMARY KEY NOT NULL,
	"plp_id" integer NOT NULL,
	"laboratorium_id" integer NOT NULL,
	"created_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "plp_jurusan" (
	"id" serial PRIMARY KEY NOT NULL,
	"plp_id" integer NOT NULL,
	"jurusan_id" integer NOT NULL,
	"created_at" timestamp DEFAULT now() NOT NULL,
	CONSTRAINT "plp_jurusan_plp_id_jurusan_id_unique" UNIQUE("plp_id","jurusan_id")
);
--> statement-breakpoint
CREATE TABLE "audit_log" (
	"id" serial PRIMARY KEY NOT NULL,
	"user_id" integer,
	"aksi" text NOT NULL,
	"entitas" text NOT NULL,
	"entitas_id" integer,
	"detail" jsonb,
	"ip_address" text,
	"created_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "peminjaman_alat_item" (
	"id" serial PRIMARY KEY NOT NULL,
	"peminjaman_id" integer NOT NULL,
	"alat_id" integer NOT NULL,
	"jumlah" integer DEFAULT 1 NOT NULL
);
--> statement-breakpoint
CREATE TABLE "peminjaman_alat" (
	"id" serial PRIMARY KEY NOT NULL,
	"no_peminjaman" text NOT NULL,
	"user_id" integer NOT NULL,
	"laboratorium_id" integer NOT NULL,
	"tanggal_pinjam" date NOT NULL,
	"jam_pinjam" text,
	"tanggal_kembali" date NOT NULL,
	"jam_kembali" text,
	"tanggal_dikembalikan" date,
	"keperluan" text NOT NULL,
	"kategori" "kategori_peminjaman" DEFAULT 'pembelajaran' NOT NULL,
	"status" "status_peminjaman" DEFAULT 'menunggu' NOT NULL,
	"catatan_plp" text,
	"verifikasi_oleh" integer,
	"request_kembali" text,
	"kondisi_kembali" text,
	"created_at" timestamp DEFAULT now() NOT NULL,
	"updated_at" timestamp DEFAULT now() NOT NULL,
	CONSTRAINT "peminjaman_alat_no_peminjaman_unique" UNIQUE("no_peminjaman")
);
--> statement-breakpoint
CREATE TABLE "peminjaman_phantom_item" (
	"id" serial PRIMARY KEY NOT NULL,
	"peminjaman_id" integer NOT NULL,
	"phantom_id" integer NOT NULL,
	"jumlah" integer DEFAULT 1 NOT NULL
);
--> statement-breakpoint
CREATE TABLE "peminjaman_phantom" (
	"id" serial PRIMARY KEY NOT NULL,
	"no_peminjaman" text NOT NULL,
	"user_id" integer NOT NULL,
	"laboratorium_id" integer,
	"tanggal_pinjam" date NOT NULL,
	"jam_pinjam" text,
	"tanggal_kembali" date NOT NULL,
	"jam_kembali" text,
	"tanggal_dikembalikan" date,
	"keperluan" text NOT NULL,
	"kategori" "kategori_peminjaman" DEFAULT 'pembelajaran' NOT NULL,
	"status" "status_peminjaman" DEFAULT 'menunggu' NOT NULL,
	"catatan_plp" text,
	"verifikasi_oleh" integer,
	"request_kembali" text,
	"kondisi_kembali" text,
	"created_at" timestamp DEFAULT now() NOT NULL,
	"updated_at" timestamp DEFAULT now() NOT NULL,
	CONSTRAINT "peminjaman_phantom_no_peminjaman_unique" UNIQUE("no_peminjaman")
);
--> statement-breakpoint
CREATE TABLE "peminjaman_ruangan" (
	"id" serial PRIMARY KEY NOT NULL,
	"no_peminjaman" text NOT NULL,
	"user_id" integer NOT NULL,
	"laboratorium_id" integer NOT NULL,
	"tanggal_mulai" date NOT NULL,
	"tanggal_selesai" date NOT NULL,
	"waktu_mulai" time NOT NULL,
	"waktu_selesai" time NOT NULL,
	"keperluan" text NOT NULL,
	"kategori" "kategori_ruangan" DEFAULT 'pembelajaran' NOT NULL,
	"judul_kegiatan" text,
	"jumlah_peserta" integer DEFAULT 1 NOT NULL,
	"status" "status_ruangan" DEFAULT 'menunggu' NOT NULL,
	"catatan_plp" text,
	"verifikasi_oleh" integer,
	"created_at" timestamp DEFAULT now() NOT NULL,
	"updated_at" timestamp DEFAULT now() NOT NULL,
	CONSTRAINT "peminjaman_ruangan_no_peminjaman_unique" UNIQUE("no_peminjaman")
);
--> statement-breakpoint
CREATE TABLE "phantom" (
	"id" serial PRIMARY KEY NOT NULL,
	"nama" text NOT NULL,
	"kode" text NOT NULL,
	"deskripsi" text,
	"kondisi" text DEFAULT 'baik' NOT NULL,
	"stok" integer DEFAULT 0 NOT NULL,
	"stok_tersedia" integer DEFAULT 0 NOT NULL,
	"satuan" text DEFAULT 'unit' NOT NULL,
	"laboratorium_id" integer,
	"created_at" timestamp DEFAULT now() NOT NULL,
	"updated_at" timestamp DEFAULT now() NOT NULL,
	CONSTRAINT "phantom_kode_unique" UNIQUE("kode")
);
--> statement-breakpoint
CREATE TABLE "permintaan_bahan_item" (
	"id" serial PRIMARY KEY NOT NULL,
	"permintaan_id" integer NOT NULL,
	"bahan_id" integer NOT NULL,
	"jumlah_diminta" integer DEFAULT 1 NOT NULL,
	"jumlah_disetujui" integer
);
--> statement-breakpoint
CREATE TABLE "permintaan_bahan" (
	"id" serial PRIMARY KEY NOT NULL,
	"no_permintaan" text NOT NULL,
	"user_id" integer NOT NULL,
	"laboratorium_id" integer,
	"tujuan" "tujuan_permintaan" DEFAULT 'gudang' NOT NULL,
	"plp_id" integer,
	"tanggal_dibutuhkan" date NOT NULL,
	"keperluan" text NOT NULL,
	"status" "status_permintaan" DEFAULT 'menunggu' NOT NULL,
	"catatan" text,
	"verifikasi_oleh" integer,
	"created_at" timestamp DEFAULT now() NOT NULL,
	"updated_at" timestamp DEFAULT now() NOT NULL,
	CONSTRAINT "permintaan_bahan_no_permintaan_unique" UNIQUE("no_permintaan")
);
--> statement-breakpoint
CREATE TABLE "berita" (
	"id" serial PRIMARY KEY NOT NULL,
	"judul" text NOT NULL,
	"konten" text NOT NULL,
	"kategori" text,
	"thumbnail" text,
	"penulis_id" integer NOT NULL,
	"created_at" timestamp DEFAULT now() NOT NULL,
	"updated_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "dokumen" (
	"id" serial PRIMARY KEY NOT NULL,
	"nama" text NOT NULL,
	"deskripsi" text,
	"url" text NOT NULL,
	"tipe" text,
	"laboratorium_id" integer,
	"uploader_id" integer NOT NULL,
	"created_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "galeri" (
	"id" serial PRIMARY KEY NOT NULL,
	"judul" text NOT NULL,
	"deskripsi" text,
	"tipe" "tipe_galeri" DEFAULT 'foto' NOT NULL,
	"url" text NOT NULL,
	"uploader_id" integer NOT NULL,
	"created_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "notifikasi" (
	"id" serial PRIMARY KEY NOT NULL,
	"judul" text NOT NULL,
	"pesan" text NOT NULL,
	"target_role" text,
	"target_jurusan_id" integer,
	"created_by" integer,
	"created_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "transfer_bahan_plp" (
	"id" serial PRIMARY KEY NOT NULL,
	"bahan_id" integer NOT NULL,
	"laboratorium_id" integer NOT NULL,
	"jumlah" integer NOT NULL,
	"status" text DEFAULT 'menunggu' NOT NULL,
	"catatan_plp" text,
	"catatan_gudang" text,
	"diminta_oleh" integer,
	"disetujui_oleh" integer,
	"created_at" timestamp DEFAULT now() NOT NULL,
	"updated_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
ALTER TABLE "laboratorium" ADD CONSTRAINT "laboratorium_jurusan_id_jurusan_id_fk" FOREIGN KEY ("jurusan_id") REFERENCES "public"."jurusan"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "users" ADD CONSTRAINT "users_jurusan_id_jurusan_id_fk" FOREIGN KEY ("jurusan_id") REFERENCES "public"."jurusan"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "users" ADD CONSTRAINT "users_laboratorium_id_laboratorium_id_fk" FOREIGN KEY ("laboratorium_id") REFERENCES "public"."laboratorium"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "alat" ADD CONSTRAINT "alat_laboratorium_id_laboratorium_id_fk" FOREIGN KEY ("laboratorium_id") REFERENCES "public"."laboratorium"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "alat" ADD CONSTRAINT "alat_penanggungjawab_id_users_id_fk" FOREIGN KEY ("penanggungjawab_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "bahan" ADD CONSTRAINT "bahan_laboratorium_id_laboratorium_id_fk" FOREIGN KEY ("laboratorium_id") REFERENCES "public"."laboratorium"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "bahan" ADD CONSTRAINT "bahan_penanggungjawab_id_users_id_fk" FOREIGN KEY ("penanggungjawab_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "plp_laboratorium" ADD CONSTRAINT "plp_laboratorium_plp_id_users_id_fk" FOREIGN KEY ("plp_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "plp_laboratorium" ADD CONSTRAINT "plp_laboratorium_laboratorium_id_laboratorium_id_fk" FOREIGN KEY ("laboratorium_id") REFERENCES "public"."laboratorium"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "plp_jurusan" ADD CONSTRAINT "plp_jurusan_plp_id_users_id_fk" FOREIGN KEY ("plp_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "plp_jurusan" ADD CONSTRAINT "plp_jurusan_jurusan_id_jurusan_id_fk" FOREIGN KEY ("jurusan_id") REFERENCES "public"."jurusan"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "audit_log" ADD CONSTRAINT "audit_log_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "peminjaman_alat_item" ADD CONSTRAINT "peminjaman_alat_item_peminjaman_id_peminjaman_alat_id_fk" FOREIGN KEY ("peminjaman_id") REFERENCES "public"."peminjaman_alat"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "peminjaman_alat_item" ADD CONSTRAINT "peminjaman_alat_item_alat_id_alat_id_fk" FOREIGN KEY ("alat_id") REFERENCES "public"."alat"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "peminjaman_alat" ADD CONSTRAINT "peminjaman_alat_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "peminjaman_alat" ADD CONSTRAINT "peminjaman_alat_laboratorium_id_laboratorium_id_fk" FOREIGN KEY ("laboratorium_id") REFERENCES "public"."laboratorium"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "peminjaman_alat" ADD CONSTRAINT "peminjaman_alat_verifikasi_oleh_users_id_fk" FOREIGN KEY ("verifikasi_oleh") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "peminjaman_phantom_item" ADD CONSTRAINT "peminjaman_phantom_item_peminjaman_id_peminjaman_phantom_id_fk" FOREIGN KEY ("peminjaman_id") REFERENCES "public"."peminjaman_phantom"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "peminjaman_phantom_item" ADD CONSTRAINT "peminjaman_phantom_item_phantom_id_phantom_id_fk" FOREIGN KEY ("phantom_id") REFERENCES "public"."phantom"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "peminjaman_phantom" ADD CONSTRAINT "peminjaman_phantom_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "peminjaman_phantom" ADD CONSTRAINT "peminjaman_phantom_laboratorium_id_laboratorium_id_fk" FOREIGN KEY ("laboratorium_id") REFERENCES "public"."laboratorium"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "peminjaman_phantom" ADD CONSTRAINT "peminjaman_phantom_verifikasi_oleh_users_id_fk" FOREIGN KEY ("verifikasi_oleh") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "peminjaman_ruangan" ADD CONSTRAINT "peminjaman_ruangan_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "peminjaman_ruangan" ADD CONSTRAINT "peminjaman_ruangan_laboratorium_id_laboratorium_id_fk" FOREIGN KEY ("laboratorium_id") REFERENCES "public"."laboratorium"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "peminjaman_ruangan" ADD CONSTRAINT "peminjaman_ruangan_verifikasi_oleh_users_id_fk" FOREIGN KEY ("verifikasi_oleh") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "phantom" ADD CONSTRAINT "phantom_laboratorium_id_laboratorium_id_fk" FOREIGN KEY ("laboratorium_id") REFERENCES "public"."laboratorium"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "permintaan_bahan_item" ADD CONSTRAINT "permintaan_bahan_item_permintaan_id_permintaan_bahan_id_fk" FOREIGN KEY ("permintaan_id") REFERENCES "public"."permintaan_bahan"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "permintaan_bahan_item" ADD CONSTRAINT "permintaan_bahan_item_bahan_id_bahan_id_fk" FOREIGN KEY ("bahan_id") REFERENCES "public"."bahan"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "permintaan_bahan" ADD CONSTRAINT "permintaan_bahan_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "permintaan_bahan" ADD CONSTRAINT "permintaan_bahan_laboratorium_id_laboratorium_id_fk" FOREIGN KEY ("laboratorium_id") REFERENCES "public"."laboratorium"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "permintaan_bahan" ADD CONSTRAINT "permintaan_bahan_plp_id_users_id_fk" FOREIGN KEY ("plp_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "permintaan_bahan" ADD CONSTRAINT "permintaan_bahan_verifikasi_oleh_users_id_fk" FOREIGN KEY ("verifikasi_oleh") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "berita" ADD CONSTRAINT "berita_penulis_id_users_id_fk" FOREIGN KEY ("penulis_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "dokumen" ADD CONSTRAINT "dokumen_laboratorium_id_laboratorium_id_fk" FOREIGN KEY ("laboratorium_id") REFERENCES "public"."laboratorium"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "dokumen" ADD CONSTRAINT "dokumen_uploader_id_users_id_fk" FOREIGN KEY ("uploader_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "galeri" ADD CONSTRAINT "galeri_uploader_id_users_id_fk" FOREIGN KEY ("uploader_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "notifikasi" ADD CONSTRAINT "notifikasi_created_by_users_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "transfer_bahan_plp" ADD CONSTRAINT "transfer_bahan_plp_bahan_id_bahan_id_fk" FOREIGN KEY ("bahan_id") REFERENCES "public"."bahan"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "transfer_bahan_plp" ADD CONSTRAINT "transfer_bahan_plp_laboratorium_id_laboratorium_id_fk" FOREIGN KEY ("laboratorium_id") REFERENCES "public"."laboratorium"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "transfer_bahan_plp" ADD CONSTRAINT "transfer_bahan_plp_diminta_oleh_users_id_fk" FOREIGN KEY ("diminta_oleh") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "transfer_bahan_plp" ADD CONSTRAINT "transfer_bahan_plp_disetujui_oleh_users_id_fk" FOREIGN KEY ("disetujui_oleh") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;