-- rc_sscd's sqlite3 db script..

BEGIN TRANSACTION;
CREATE TABLE network_stat (

	  timestamp integer not null
	, user_seq  integer not null
	, svc_seq   integer not null
	, fhs       text not null collate nocase

	, insert_time                text               -- insert time to admin check..
	, send_flag                  integer default 0  -- cc_statd send flag( 0: not send, 1: sent ok, 2: ignore)
	, send_time                  text               -- cc_statd send complete time.

	, down_traffic               integer default 0
	, up_traffic                 integer default 0
	, down_content_size          integer default 0
	, up_content_size            integer default 0

	, primary key( timestamp, user_seq, svc_seq, fhs )

);
COMMIT;

BEGIN TRANSACTION;
CREATE TABLE storage_stat (

	  timestamp integer not null
	, user_seq  integer not null
	, svc_seq   integer not null

	, insert_time                text               -- insert time to admin check..
	, send_flag                  integer default 0  -- cc_statd send flag( 0: not send, 1: sent ok, 2: ignore)
	, send_time                  text               -- cc_statd send complete time.


	, quota                      integer default 0  -- storage qouta (byte)
	, used                       integer default 0  -- storage used size (byte)
	, check_resource_id          integer default 0  -- last calc reference value for new upload
	, check_get_lastmodified     integer default 0  -- last calc reference value for delete

	, primary key( timestamp, user_seq, svc_seq )

);
COMMIT;

BEGIN TRANSACTION;
CREATE TABLE stat_not_send_service (

	  user_seq      integer not null
	, svc_seq       integer not null

	, insert_time   text not null default (datetime('now', 'localtime'))  -- insert time to admin check..

	, primary key( user_seq, svc_seq )

);
COMMIT;

