
DO $$ 
    BEGIN
         IF EXISTS (SELECT "Id" FROM public."Versions" WHERE "Build">=1765) THEN
		RETURN;
          END IF;
 
        BEGIN
       CREATE TABLE public."UserAddressBooks" (
    "Id" bigserial PRIMARY KEY,
    "Name" character varying(500) NOT NULL, 
    "Color" character varying(50) NULL, 
    "OwnerId" bigint NOT NULL,
    "Type" integer DEFAULT 0 NOT NULL, 
    "IsEnabled" boolean DEFAULT true NOT NULL,
    "Timestamp" timestamp without time zone DEFAULT timezone('utc', now())  NOT NULL
);


        EXCEPTION
            WHEN duplicate_table THEN RAISE NOTICE 'Create table <UserAddressBooks>.';
        END;
    END;
$$


