
DO $$ 
    BEGIN
         IF EXISTS (SELECT "Id" FROM public."Versions" WHERE "Build">=1765) THEN
		RETURN;
          END IF;
 
        BEGIN
       CREATE TABLE public."CustomerTariff" (
	"Id" BIGSERIAL NOT NULL, 
	"TenantId" BIGINT NOT NULL,
	"TariffId" BIGINT NOT NULL, 
	"Comment" character varying(4000) NULL,
	"Quantity" INT NOT NULL, 
	"Stamp" timestamp without time zone NULL,
        "CreateOn" timestamp without time zone DEFAULT timezone('utc', now())  NOT NULL,
CONSTRAINT "PK_CustomerTariff" PRIMARY KEY ("Id")
);

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


