From 14df8faf0d979db5becdb2d60489744fcd774d11 Mon Sep 17 00:00:00 2001 From: kanoi Date: Sun, 27 Jul 2014 14:32:08 +1000 Subject: [PATCH] ckdb - change of v0.4 sql --- sql/ckdb.sql | 5 ++--- sql/v0.3-v0.4.sql | 22 +++++++++++++++++----- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/sql/ckdb.sql b/sql/ckdb.sql index 50b2e654..a83f62f7 100644 --- a/sql/ckdb.sql +++ b/sql/ckdb.sql @@ -366,20 +366,19 @@ CREATE TABLE poolstats ( CREATE TABLE userstats ( - poolinstance character varying(256) NOT NULL, userid bigint NOT NULL, workername character varying(256) NOT NULL, - elapsed bigint NOT NULL, hashrate float NOT NULL, hashrate5m float NOT NULL, hashrate1hr float NOT NULL, hashrate24hr float NOT NULL, summarylevel char NOT NULL, + statsdate timestamp with time zone NOT NULL, createdate timestamp with time zone NOT NULL, createby character varying(64) DEFAULT ''::character varying NOT NULL, createcode character varying(128) DEFAULT ''::character varying NOT NULL, createinet character varying(128) DEFAULT ''::character varying NOT NULL, - PRIMARY KEY (poolinstance, userid, createdate) + PRIMARY KEY (userid, workername, summarylevel, statsdate) ); diff --git a/sql/v0.3-v0.4.sql b/sql/v0.3-v0.4.sql index 013e14fa..29813ee5 100644 --- a/sql/v0.3-v0.4.sql +++ b/sql/v0.3-v0.4.sql @@ -19,10 +19,22 @@ BEGIN END $$; -ALTER TABLE ONLY userstats - ADD COLUMN summarylevel char DEFAULT ' ' NOT NULL; - -ALTER TABLE ONLY userstats - ALTER COLUMN summarylevel DROP DEFAULT; +DROP TABLE userstats; + +CREATE TABLE userstats ( + userid bigint NOT NULL, + workername character varying(256) NOT NULL, + hashrate float NOT NULL, + hashrate5m float NOT NULL, + hashrate1hr float NOT NULL, + hashrate24hr float NOT NULL, + summarylevel char NOT NULL, + statsdate timestamp with time zone NOT NULL, + createdate timestamp with time zone NOT NULL, + createby character varying(64) DEFAULT ''::character varying NOT NULL, + createcode character varying(128) DEFAULT ''::character varying NOT NULL, + createinet character varying(128) DEFAULT ''::character varying NOT NULL, + PRIMARY KEY (userid, workername, summarylevel, statsdate) +); END transaction;