CREATE TABLE "artikel" (
	"name" text NOT NULL,
	"aid" int4 NOT NULL,
	"anz" int4,
	"preis" int4);
CREATE TABLE "kunden" (
	"vorname" text,
	"nachname" text,
	"nickname" text NOT NULL,
	"kid" int4 NOT NULL,
	"email" text,
	"pw" text NOT NULL,
	"created" datetime,
	"last_contact" datetime,
	"locked" bool DEFAULT bool 'f' NOT NULL,
	"guthaben" int4,
	"bemerkung" text);
CREATE TABLE "buchungen" (
	"kid" int4 NOT NULL,
	"aid" int4 NOT NULL,
	"zeit" datetime NOT NULL,
	"bemerkung" text,
	"zahlung" bool DEFAULT bool 'f',
	"betrag" int4,
	"guthaben_neu" int4);
REVOKE ALL on "buchungen" from PUBLIC;
GRANT ALL on "buchungen" to "tante";

REVOKE ALL on "kunden" from PUBLIC;
GRANT ALL on "kunden" to "tante";

REVOKE ALL on "artikel" from PUBLIC;
GRANT ALL on "artikel" to "tante";

CREATE INDEX buch_idx1 ON buchungen ( kid, zeit );
