CREATE TABLE public.actions_ref (
    id bigserial NOT NULL,
    "appCode" text,
    "actionCode" text,
    "actionName" text,
    "validFrom" date,
    "validTill" date,
    "createdAt" date,
    "updatedAt" date,
    "createBy" text,
    "modifiedBy" text,
    "deletedAt" date,
    version numeric
);


CREATE TABLE public.apps_ref (
    id bigserial NOT NULL,
    "appCode" text,
    "appName" text,
    "validFrom" date,
    "validTill" date,
    "createdAt" date,
    "updatedAt" date,
    "createBy" text,
    "modifiedBy" text,
    "deletedAt" date,
    version numeric
);

CREATE TABLE public.companies (
    id bigserial NOT NULL,
    "companyCode" text,
    "companyName" text,
    address text,
    gst text,
    status text,
    "validFrom" date,
    "validTill" date,
    "createdAt" date,
    "updatedAt" date,
    "createBy" text,
    "modifiedBy" text,
    "deletedAt" date,
    version numeric
);

CREATE TABLE public.company_details (
    id bigserial NOT NULL,
    "companyId" numeric,
    "companyCode" text,
    "addlDataType" text,
    "addlDataName" text,
    "validFrom" date,
    "validTill" date,
    "createdAt" date,
    "updatedAt" date,
    "createBy" text,
    "modifiedBy" text,
    "deletedAt" date,
    version numeric
);


CREATE TABLE public.crud_config_info (
    id bigserial NOT NULL,
    "endPtNm" text,
    "opsTypeName" text,
    "sqlQueryText" text,
    "validFrom" date,
    "validTill" date,
    "createdAt" date,
    "updatedAt" date,
    "createBy" text,
    "modifiedBy" text,
    "deletedAt" date,
    version numeric
);


CREATE TABLE public.item_category_ref (
    id bigserial NOT NULL,
    "categoryName" text,
    "categoryCode" text,
	"categoryDescription" text,
	"parentCode" text,
    "validFrom" date,
    "validTill" date,
    "createdAt" date,
    "updatedAt" date,
    "createBy" text,
    "modifiedBy" text,
    "deletedAt" date,
    version numeric
);

CREATE TABLE public.items_ref (
    id bigserial NOT NULL,
    "itemCode" text,
    "itemName" text,
	"itemCategoryCode" text,
    "itemDesc" text,
	"parentCode" text, 
     "validFrom" date,
    "validTill" date,
    "createdAt" date,
    "updatedAt" date,
    "createBy" text,
    "modifiedBy" text,
    "deletedAt" date,
    version numeric
);

CREATE TABLE public.policies_ref (
    id bigserial NOT NULL,
    "appCode" text,
    "roleCode" text,
    "resourceCode" text,
    "actionCode" text,
    "canAllow" boolean,
    priority boolean,
    "validFrom" date,
    "validTill" date,
    "createdAt" date,
    "updatedAt" date,
    "createBy" text,
    "modifiedBy" text,
    "deletedAt" date,
    version numeric
);

CREATE TABLE public.resources_ref (
    id bigserial NOT NULL,
    "appCode" text,
    "resourceCode" text,
    "resourceName" text,
    "validFrom" date,
    "validTill" date,
    "createdAt" date,
    "updatedAt" date,
    "createBy" text,
    "modifiedBy" text,
    "deletedAt" date,
    version numeric
);

CREATE TABLE public.roles_ref (
    id bigserial NOT NULL,
    "appCode" text,
    "roleCode" text,
    "roleName" text,
    "validFrom" date,
    "validTill" date,
    "createdAt" date,
    "updatedAt" date,
    "createBy" text,
    "modifiedBy" text,
    "deletedAt" date,
    version numeric
);


CREATE TABLE public.user_additional_details (
    id bigserial NOT NULL,
    "userId" numeric,
    "addlDataType" text,
    "addlDataName" text,
    "validFrom" date,
    "validTill" date,
    "createdAt" date,
    "updatedAt" date,
    "createBy" text,
    "modifiedBy" text,
    "deletedAt" date,
    version numeric
);

CREATE TABLE public.users (
    id bigserial NOT NULL,
    email text,
    password text,
    name text,
    "userTypeCode" text,
    "primaryRole" text,
    "companyCode" text,
    status text,
    "validFrom" date,
    "validTill" date,
    "createdAt" date,
    "updatedAt" date,
    "createBy" text,
    "modifiedBy" text,
    "deletedAt" date,
    version numeric
);

CREATE TABLE public.master_config_category_ref (
    id bigserial NOT NULL,
    "categoryName" text,
    "categoryCode" text,
	"categoryDescription" text,
	"categoryType" text,
	"parentCode" text,
    "validFrom" date,
    "validTill" date,
    "createdAt" date,
    "updatedAt" date,
    "createBy" text,
    "modifiedBy" text,
    "deletedAt" date,
    version numeric
);

CREATE TABLE public.master_config_ref (
    id bigserial NOT NULL,
    "configCode" text,
    "configName" text,
	"configCategoryCode" text,
    "configDesc" text,
	"parentCode" text, 
	"configType" text,
    "validFrom" date,
    "validTill" date,
    "createdAt" date,
    "updatedAt" date,
    "createBy" text,
    "modifiedBy" text,
    "deletedAt" date,
    version numeric
);

CREATE TABLE public.master_config_mapping (
    id bigserial NOT NULL,
    "configCode" text,
    "companyCode" text,
	"status" text,
    "dispSerialNumber" text,
	"defaultValue" text, 
    "validFrom" date,
    "validTill" date,
    "createdAt" date,
    "updatedAt" date,
    "createBy" text,
    "modifiedBy" text,
    "deletedAt" date,
    version numeric
);


CREATE TABLE public.config_transcations (
    id bigserial NOT NULL,
    "configCode" text,
    "companyCode" text,
	"itemCategoryCode" text,
	"itemCode" text,
	"status" text,
    "value" text,
	"fileUrl" text,
	"weight" numeric,
    "validFrom" date,
    "validTill" date,
    "createdAt" date,
    "updatedAt" date,
    "createBy" text,
    "modifiedBy" text,
    "deletedAt" date,
    version numeric
);

CREATE TABLE public.config_logs (
	id bigserial NOT NULL,
	"tableName" text,
	"prevValue" text,
	"currValue" text,
	"validFrom" date,
    "validTill" date,
    "createdAt" date,
    "updatedAt" date,
    "createBy" text,
    "modifiedBy" text,
    "deletedAt" date,
    version numeric
)