
DO $$ 
    BEGIN
         IF EXISTS (SELECT "Id" FROM public."Versions" WHERE "Build">=1765) THEN
		RETURN;
          END IF;
 
        BEGIN
 
CREATE TABLE public."Tariffs" (
	"Id"  BIGSERIAL NOT NULL PRIMARY KEY,
	"Name" character varying(250) NOT NULL,
	"Price" FLOAT NOT NULL,
	"Type" INT DEFAULT 0 NOT NULL,
	"GroupId" INT DEFAULT 0 NOT NULL,
	"Period" INT DEFAULT 1 NOT NULL,
        "IsEnabled" INT DEFAULT 1 NOT NULL,
        "DiskSpace" INT DEFAULT 5120 NOT NULL,
        "DiskSpacePrice" FLOAT DEFAULT 10 NULL, 
	"Discount" FLOAT DEFAULT 0 NOT NULL,
	"Json" character varying(4000) DEFAULT '{}' NULL,
	"PeriodType" INT DEFAULT 1 NOT NULL,
	"Timestamp" timestamp without time zone DEFAULT timezone('utc', now())  NOT NULL,
        "ExternalId" character varying(250) NULL
);



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








