-- Create "AntibioticSrcCategory" table
CREATE TABLE "public"."AntibioticSrcCategory" (
  "Id" serial NOT NULL,
  "CreatedAt" timestamptz NULL,
  "UpdatedAt" timestamptz NULL,
  "DeletedAt" timestamptz NULL,
  "Code" character varying(20) NULL,
  "Name" character varying(50) NULL,
  PRIMARY KEY ("Id"),
  CONSTRAINT "uni_AntibioticSrcCategory_Code" UNIQUE ("Code")
);
-- Create "AntibioticSrc" table
CREATE TABLE "public"."AntibioticSrc" (
  "Id" bigserial NOT NULL,
  "CreatedAt" timestamptz NULL,
  "UpdatedAt" timestamptz NULL,
  "DeletedAt" timestamptz NULL,
  "Code" character varying(20) NULL,
  "Name" character varying(50) NULL,
  "AntibioticSrcCategory_Code" character varying(20) NULL,
  "Item_Id" bigint NULL,
  PRIMARY KEY ("Id"),
  CONSTRAINT "uni_AntibioticSrc_Code" UNIQUE ("Code"),
  CONSTRAINT "fk_AntibioticSrc_AntibioticSrcCategory" FOREIGN KEY ("AntibioticSrcCategory_Code") REFERENCES "public"."AntibioticSrcCategory" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION,
  CONSTRAINT "fk_AntibioticSrc_Item" FOREIGN KEY ("Item_Id") REFERENCES "public"."Item" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION
);
-- Create "AntibioticInUse" table
CREATE TABLE "public"."AntibioticInUse" (
  "Id" bigserial NOT NULL,
  "CreatedAt" timestamptz NULL,
  "UpdatedAt" timestamptz NULL,
  "DeletedAt" timestamptz NULL,
  "McuOrder_Id" bigint NULL,
  "AntibioticSrc_Id" bigint NULL,
  PRIMARY KEY ("Id"),
  CONSTRAINT "fk_AntibioticInUse_AntibioticSrc" FOREIGN KEY ("AntibioticSrc_Id") REFERENCES "public"."AntibioticSrc" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION,
  CONSTRAINT "fk_AntibioticInUse_McuOrder" FOREIGN KEY ("McuOrder_Id") REFERENCES "public"."McuOrder" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION
);
