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


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


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