CREATE TABLE `swap` (
	`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	`acc` INTEGER NOT NULL,
	`voucher` INTEGER NOT NULL,
	`storno` INTEGER NOT NULL,
	`timestamp` INTEGER NOT NULL
);

CREATE TABLE `voucher_type` (
	`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	`store` INTEGER NOT NULL,
	`value` INTEGER NOT NULL,
	UNIQUE (`store`, `value`)
);

CREATE TABLE `inventory` (
	`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	`acc` INTEGER NOT NULL,
	`cash` INTEGER NOT NULL,
	`timestamp` INTEGER NOT NULL,
	UNIQUE (`acc`, `timestamp`)
);

CREATE TABLE `voucher_inventory` (
	`inventory` INTEGER NOT NULL,
	`voucher` INTEGER NOT NULL,
	`count` INTEGER NOT NULL,
	PRIMARY KEY (`inventory`, `voucher`)
);
