-- Create "AuthPartner" table
CREATE TABLE "public"."AuthPartner" (
  "Id" bigserial NOT NULL,
  "CreatedAt" timestamptz NULL,
  "UpdatedAt" timestamptz NULL,
  "DeletedAt" timestamptz NULL,
  "Code" character varying(50) NULL,
  "Name" character varying(100) NULL,
  "SecretKey" character varying(255) NULL,
  PRIMARY KEY ("Id"),
  CONSTRAINT "uni_AuthPartner_Code" UNIQUE ("Code"),
  CONSTRAINT "uni_AuthPartner_Name" UNIQUE ("Name")
);
-- Create "ExtUser" table
CREATE TABLE "public"."ExtUser" (
  "Id" bigserial NOT NULL,
  "CreatedAt" timestamptz NULL,
  "UpdatedAt" timestamptz NULL,
  "DeletedAt" timestamptz NULL,
  "Name" character varying(100) NULL,
  "AuthPartner_Code" character varying(30) NULL,
  "User_Name" character varying(50) NULL,
  PRIMARY KEY ("Id"),
  CONSTRAINT "fk_ExtUser_AuthPartner" FOREIGN KEY ("AuthPartner_Code") REFERENCES "public"."AuthPartner" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION,
  CONSTRAINT "fk_ExtUser_User" FOREIGN KEY ("User_Name") REFERENCES "public"."User" ("Name") ON UPDATE NO ACTION ON DELETE NO ACTION
);
