drop table domains cascade constraints;
create table domains (
  domainName varchar2(32),
  factTableName varchar2(32),
  primary key (domainName)
);
insert into domains values ('Colleges','collegeFactTable');
insert into domains values ('Automobiles','autoFactTable');
--
--
drop table property cascade constraints;
create table property (
  domainName varchar2(32),
  propertyName varchar2(32),
  propertyQuestion  varchar2(256),
  displayorder number(2),
  propertyDisplayType varchar2(16), -- radio, checkbox, singleselect, 
                                    -- multiselect
  primary key (propertyName),
  foreign key (domainName) references domains
);
--
--
drop table propertyDetail cascade constraints;
create table propertyDetail (
  domainName varchar2(32),
  propertyName varchar2(32),
  allowedValue varchar2(64),
  allowedValueCode number(3),
  primary key (domainName,propertyName,allowedValue),
  foreign key (domainName) references domains,
  foreign key (propertyName) references property
);
--
--
drop table userBookmarks cascade constraints;
create table userBookmarks (
  userid    varchar2(16),
  domainName varchar2(32),
  bookmark  varchar2(1024),
  primary key (userid,bookmark),
  foreign key (domainName) references domains,
  foreign key (userid) references users
);
--
--
