
DO $$ 
    BEGIN
         IF EXISTS (SELECT "Id" FROM public."Versions" WHERE "Build">=1765) THEN
		RETURN;
          END IF;
 
        BEGIN
        CREATE TABLE public."UserAddressBookLinks" (
    "Id" bigserial,
    "Name" character varying(500) NOT NULL, 
    "ContactId" bigint NOT NULL, 
    "AddressBookId" bigint NOT NULL, 
    "Timestamp" timestamp without time zone DEFAULT timezone('utc', now())  NOT NULL,
     PRIMARY KEY ("AddressBookId", "ContactId")

);

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

