CREATE TABLE transaction (
	account varchar not null,
	accounting_date date not null,
	interest_date date not null,
	use_date date not null,
	reference varchar primary key not null,
	trans_type varchar not null,
	text varchar not null,
	amount_out numeric(9,2),
	amount_in numeric(9,2),

	CHECK ((amount_in IS NULL) <> (amount_out IS NULL))
);
