DROP TABLE IF EXISTS datacite_temp_sets;
CREATE TABLE IF NOT EXISTS datacite_temp_sets (
	_dnet_resource_identifier_ character varying(2048) DEFAULT 'temp_'||md5(clock_timestamp()::text)||'_'||md5(random()::text),
	id                         character varying(255) PRIMARY KEY,
	setname                    character varying(255),
	setname_cleaned            character varying(255),
	setspec                    character varying(255),
	oa_source_id              character varying(255) references datasources(id)
);

DROP TABLE IF EXISTS datacite_temp_datarepos;

CREATE TABLE IF NOT EXISTS datacite_temp_datarepos (
	_dnet_resource_identifier_ character varying(2048) DEFAULT 'temp_'||md5(clock_timestamp()::text)||'_'||md5(random()::text),
	id                         character varying(255) PRIMARY KEY,
	name                       character varying(512) NOT NULL,
	name_cleaned               character varying(512) NOT NULL,
	class                      character varying(255)
);

--CREATE INDEX datacite_sets__dnet_resource_identifier__idx ON datacite_sets (_dnet_resource_identifier_);
CREATE INDEX datacite_temp_datarepos__dnet_resource_identifier__idx ON datacite_temp_datarepos (_dnet_resource_identifier_);
