Files
simrsx-be/cmd/migration/migrations/20250902063217.sql
T

21 lines
946 B
SQL

-- Create "PersonRelative" table
CREATE TABLE "public"."PersonRelative" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Person_Id" bigint NULL,
"Relationship_Code" character varying(100) NOT NULL,
"Name" character varying(100) NULL,
"Address" character varying(100) NULL,
"Village_Code" character varying(10) NULL,
"Gender_Code" character varying(10) NULL,
"PhoneNumber" character varying(30) NULL,
"Education_Code" character varying(10) NULL,
"Occupation_Code" character varying(10) NULL,
"Occupation_Name" character varying(50) NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "fk_PersonRelative_Village" FOREIGN KEY ("Village_Code") REFERENCES "public"."Village" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT "fk_Person_Relatives" FOREIGN KEY ("Person_Id") REFERENCES "public"."Person" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION
);