diff --git a/server/biz/SockType.cs b/server/biz/SockType.cs index a383e87..960a1aa 100644 --- a/server/biz/SockType.cs +++ b/server/biz/SockType.cs @@ -69,7 +69,9 @@ namespace Sockeye.Biz [CoreBizObject, ReportableBizObject] SubscriptionServer = 95, [CoreBizObject, ReportableBizObject] - Sale = 96 + Purchase = 96, + [CoreBizObject, ReportableBizObject] + Product = 97 diff --git a/server/util/AySchema.cs b/server/util/AySchema.cs index b896775..34a51ea 100644 --- a/server/util/AySchema.cs +++ b/server/util/AySchema.cs @@ -514,6 +514,11 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); await ExecQueryAsync("ALTER TABLE acustomer ADD column headofficeid BIGINT NULL REFERENCES aheadoffice"); await ExecQueryAsync("ALTER TABLE auser ADD FOREIGN KEY (headofficeid) REFERENCES aheadoffice(id)"); + //VENDOR + await ExecQueryAsync("CREATE TABLE avendor (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name TEXT NOT NULL UNIQUE, active BOOL NOT NULL, " + + "notes TEXT, wiki TEXT, customfields TEXT, tags VARCHAR(255) ARRAY, webaddress TEXT, alertnotes TEXT, accountnumber TEXT, " + + "contact TEXT, contactnotes TEXT, phone1 TEXT, phone2 TEXT, phone3 TEXT, phone4 TEXT, phone5 TEXT, emailaddress TEXT, " + + "postaddress TEXT, postcity TEXT, postregion TEXT, postcountry TEXT, postcode TEXT, address TEXT, city TEXT, region TEXT, country TEXT, latitude DECIMAL(9,6), longitude DECIMAL(9,6))"); //NOTIFICATION @@ -867,6 +872,32 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); + "wiki TEXT, customfields TEXT, tags VARCHAR(255) ARRAY, toid BIGINT NOT NULL REFERENCES auser(id) )"); + await ExecQueryAsync("CREATE TABLE atriallicenserequest (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, dbid TEXT NOT NULL, companyname TEXT NOT NULL, " + + "contactname TEXT NOT NULL, email TEXT NOT NULL, emailconfirmcode TEXT NOT NULL, emailvalidated BOOL DEFAULT false, " + + "requested TIMESTAMPTZ, processed TIMESTAMPTZ, status INTEGER NOT NULL DEFAULT 0, rejectreason TEXT, key TEXT, " + + "fetched TIMESTAMPZ, perpetual BOOL DEFAULT false NOT NULL )"); + + + await ExecQueryAsync("CREATE TABLE asubscriptionserver (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, active BOOL NOT NULL DEFAULT true, created TIMESTAMPTZ NOT NULL, " + + "datacenter TEXT NOT NULL, timezone TEXT NOT NULL, lastupdated TIMESTAMPTZ, subscriptionexpire TIMESTAMPZ NOT NULL, " + + "trialexpire TIMESTAMPZ, trialcontact TEXT, trialemail TEXT, trialcompany TEXT, operatingsystem TEXT,ourdomain TEXT, customsubdomain TEXT, " + + "wiki TEXT, customfields TEXT, tags VARCHAR(255) ARRAY, licenseid BIGINT REFERENCES alicense(id), customerid BIGINT REFERENCES acustomer(id) )"); + + + await ExecQueryAsync("CREATE TABLE aproduct (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name TEXT NOT NULL, active BOOL NOT NULL DEFAULT true, " + + "vendorid BIGINT NOT NULL REFERENCES avendor(id), TEXT NOT NULL, vendorcode TEXT NOT NULL, ourcode TEXT NOT NULL, " + + "wiki TEXT, customfields TEXT, tags VARCHAR(255) ARRAY )"); + + + await ExecQueryAsync("CREATE TABLE apurchase (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, customerid BIGINT NOT NULL REFERENCES acustomer(id) ON DELETE CASCADE, " + + "vendorid BIGINT NOT NULL REFERENCES avendor(id), productid BIGINT NOT NULL REFERENCES aproduct(id), salesordernumber TEXT, " + + "purchasedate TIMESTAMPTZ NOT NULL, expiredate TIMESTAMPZ, canceldate TIMESTAMPZ, couponcode text, purchasenotes text, " + + "renewnoticesent BOOL NOT NULL DEFAULT false, quantity NOT NULL INTEGER DEFAULT 1, " + + "vendordata TEXT, processeddate TIMESTAMPTZ, " + + "wiki TEXT, customfields TEXT, tags VARCHAR(255) ARRAY )"); + + + currentSchema = 16; await SetSchemaLevelAsync(currentSchema); @@ -874,6 +905,22 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); /* + + CREATE TABLE purchase (id INTEGER PRIMARY KEY, customer_id integer not null, site_id integer not null, name text not null, vendorName text, + email text, productCode text, salesOrderNumber text, purchaseDate integer not null, expireDate integer, cancelDate integer, couponCode text, + notes text, renewNoticeSent boolean default 0 NOT NULL CHECK (renewNoticeSent IN (0,1)), quantity integer default 1 not null, + FOREIGN KEY (customer_id) REFERENCES customer(id) ON DELETE CASCADE, FOREIGN KEY (site_id) REFERENCES site(id) ON DELETE CASCADE ) + + + + + + + + CREATE TABLE trialrequest (id INTEGER PRIMARY KEY, dbid text not null, companyname text not null, contactname text not null, notes text, + email text not null, emailconfirmcode text not null, emailvalidated boolean default 0 NOT NULL CHECK (emailvalidated IN (0,1)), dtrequested integer, + dtprocessed integer, status integer default 0 not null, rejectreason text, key text, dtfetched integer, perpetual boolean default 0 NOT NULL CHECK (perpetual IN (0,1))) + CREATE TABLE license (id INTEGER PRIMARY KEY, dtcreated integer not null, customerid integer not null, regto text not null, key text not null, code text not null, email text not null, fetchfrom text, dtfetched integer, fetched boolean default 0 NOT NULL CHECK (fetched IN (0,1)), dbid text default 'v7_no_dbid' NOT NULL, siteid integer, dtLicenseExpiration integer, dtMaintenanceExpiration integer, perpetual boolean default 0 NOT NULL CHECK (perpetual IN (0,1)))