-- Create "AmbulanceTransportReq" table
CREATE TABLE "public"."AmbulanceTransportReq" (
  "Id" bigserial NOT NULL,
  "CreatedAt" timestamptz NULL,
  "UpdatedAt" timestamptz NULL,
  "DeletedAt" timestamptz NULL,
  "Patient_Id" bigint NULL,
  "Diagnoses" character varying(1024) NULL,
  "RequestData" timestamptz NULL,
  "UsageDate" timestamptz NULL,
  "Address" character varying(100) NULL,
  "RtRw" character varying(10) NULL,
  "Province_Code" character varying(2) NULL,
  "Regency_Code" character varying(4) NULL,
  "District_Code" character varying(6) NULL,
  "Village_Code" character varying(10) NULL,
  "Facility_Code" character varying(10) NULL,
  "Needs_Code" character varying(10) NULL,
  "Contact_Name" character varying(100) NULL,
  "Contact_Relationship_Code" character varying(10) NULL,
  "Contact_PhoneNumber" character varying(20) NULL,
  PRIMARY KEY ("Id"),
  CONSTRAINT "fk_AmbulanceTransportReq_District" FOREIGN KEY ("District_Code") REFERENCES "public"."District" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION,
  CONSTRAINT "fk_AmbulanceTransportReq_Patient" FOREIGN KEY ("Patient_Id") REFERENCES "public"."Patient" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION,
  CONSTRAINT "fk_AmbulanceTransportReq_Province" FOREIGN KEY ("Province_Code") REFERENCES "public"."Province" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION,
  CONSTRAINT "fk_AmbulanceTransportReq_Regency" FOREIGN KEY ("Regency_Code") REFERENCES "public"."Regency" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION,
  CONSTRAINT "fk_AmbulanceTransportReq_Village" FOREIGN KEY ("Village_Code") REFERENCES "public"."Village" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION
);
-- Create "Vehicle" table
CREATE TABLE "public"."Vehicle" (
  "Id" bigserial NOT NULL,
  "CreatedAt" timestamptz NULL,
  "UpdatedAt" timestamptz NULL,
  "DeletedAt" timestamptz NULL,
  "Type_Code" text NULL,
  "PoliceNumber" text NULL,
  "FrameNumber" text NULL,
  "RegNumber" text NULL,
  "AvailableStatus" boolean NULL,
  PRIMARY KEY ("Id")
);
-- Create "VehicleHist" table
CREATE TABLE "public"."VehicleHist" (
  "Id" bigserial NOT NULL,
  "CreatedAt" timestamptz NULL,
  "UpdatedAt" timestamptz NULL,
  "DeletedAt" timestamptz NULL,
  "Vehicle_Id" bigint NULL,
  "Date" timestamptz NULL,
  "Data" text NULL,
  "Crud_Code" text NULL,
  PRIMARY KEY ("Id"),
  CONSTRAINT "fk_VehicleHist_Vehicle" FOREIGN KEY ("Vehicle_Id") REFERENCES "public"."Vehicle" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION
);
