CREATE TABLE "boxes"( 
    "id"                    bigserial PRIMARY KEY,
    "packinglist_id"        INT NOT NULL,
    "traceability_code"     VARCHAR NOT NULL,
    "product_id"            INT NOT NULL,
    "qrcode"                VARCHAR NOT NULL,
    "status"                VARCHAR NOT NULL,
    "user_id"               INT NOT NULL,
    "exportcompany_id"      INT NOT NULL,
    "created_at"            TIMESTAMPTZ NOT NULL DEFAULT(now())
);

ALTER TABLE "boxes" ADD FOREIGN KEY ("product_id") REFERENCES "crops" ("id");
ALTER TABLE "boxes" ADD FOREIGN KEY ("user_id") REFERENCES  "users" ("id");
ALTER TABLE "boxes" ADD FOREIGN KEY ("exportcompany_id") REFERENCES "exportcompanies" ("id");
ALTER TABLE "boxes" ADD FOREIGN KEY ("packinglist_id") REFERENCES    "packinglist" ("id");



