CREATE TABLE storage_available_spaces (
	id varchar(50) NOT NULL,
	server_name TEXT NOT NULL,
	xml_server TEXT NOT NULL,
	from_key varchar(20) NOT NULL,
	owner varchar(20),
	root_path varchar(100),
	PRIMARY KEY (id)
);


CREATE TABLE storage_targets (
	id varchar(50) NOT NULL,
	target_key varchar(150) NOT NULL,
	target_type char(1) NOT NULL,
	id_storage_available_spaces varchar(50) NOT NULL,
	space_key varchar(60) NOT NULL,
	obliged char(1) NOT NULL default 'F',
	PRIMARY KEY (id),
	FOREIGN KEY (id_storage_available_spaces) REFERENCES storage_available_spaces(id)
);


CREATE TABLE storage_users_preferences (
	id varchar(50) NOT NULL,
	user_key varchar(20) NOT NULL,
	id_storage_targets varchar(50) NOT NULL,
	PRIMARY KEY (id),
	FOREIGN KEY (id_storage_targets) REFERENCES storage_targets(id)
);