+=+=+=+=+=+=+=+=+
category_object
+=+=+=+=+=+=+=+=+
id              ; the object id.
parent			; parent object.
active          ; show this on the page? (0/1)
created         ; timestamp
changed         ; timestamp
owner           ; id to user who owns this object
group           ; id to owner group
revised_by      ; id to user who last changed this object.
sort            ; sort field for fine tuned sorts.
u_perms         ; user permissions (r/w/l)
g_perms         ; group permissions (r/w/l)
o_perms         ; others permissions (r/w/l)
refs_to_us		; id of references to us separated by :
template		; path to object template.
sort_by			; sort by.
type            ; 0 = link, 1 = category, 2 = reference to object (CO_TYPE_LINK, CO_TYPE_CAT, CO_TYPE_REF).
;
name            ; object name.
description     ; object description.
keywords        ; object keywords
data			; object data (link, reference etc)

CREATE SEQUENCE cat_object_id_seq start 1;
CREATE TABLE catalog (
	id			BIGINT NOT NULL,
	parent		BIGINT NOT NULL DEFAULT 1,
	active		BOOLEAN NOT NULL DEFAULT false,
	created		TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
	changed		TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
	owner		BIGINT NOT NULL DEFAULT 1,
	groupo		BIGINT NOT NULL DEFAULT 1,
	revised_by	BIGINT NOT NULL DEFAULT 1,
	sort		BIGINT NOT NULL DEFAULT 0,
	u_perms		VARCHAR(4) NOT NULL DEFAULT '100',
	g_perms		VARCHAR(4) NOT NULL DEFAULT '100',
	o_perms		VARCHAR(4) NOT NULL DEFAULT '000',
	refs_to_us	BIGINT NOT NULL DEFAULT 0,
	template	TEXT,
	sort_by		TEXT,
	type		BIGINT NOT NULL DEFAULT 0,
	name		VARCHAR(255) NOT NULL DEFAULT '',
	description	TEXT NOT NULL DEFAULT '',
	keywords	TEXT NOT NULL DEFAULT '',
	data		TEXT NOT NULL DEFAULT '',
	PRIMARY KEY(id)
);	
	
	
	



+=+=+=+=+=+=+=+=+
rate
+=+=+=+=+=+=+=+=+
id              ; the object id.
rate            ; total rate of object.
num_rates       ; total number of ratings.


+=+=+=+=+=+=+=+=+
users
+=+=+=+=+=+=+=+=+
id              ; user id
group           ; group id

+=+=+=+=+=+=+=+=+
click
+=+=+=+=+=+=+=+=+
id				; object id
accesses		; counter
acc_today		; counter
acc_yesterday	; counter
timestamp		; last access

UPDATE click SET acc_yesterday=(SELECT acc_today FROM click where id=%d);
UPDATE click SET acc_today = 0;

pictures
+=+=+=+=+=+
id
reference
filename
description

link_health
+=+=+=+=++=
id				; id to link object.
last_checked	; timestamp.
errorcount		; how many runs this link failed.
last_http_stat	; last http status code.
