alter table CATEGORIES drop foreign key FK6A31321CBBCD53BF; alter table CAT_CHANNEL_LINK drop foreign key FK510BBFCB74C6C9; alter table CAT_CHANNEL_LINK drop foreign key FK510BBF9C0F4EEB; alter table CAT_GROUP_CHANNEL drop foreign key FK94C7FE3ACB74C6C9; alter table CAT_GROUP_CHANNEL drop foreign key FK94C7FE3A94332F88; alter table CAT_ITEM_LINK drop foreign key FKAE9345D7432BB4B; alter table CAT_ITEM_LINK drop foreign key FKAE9345D9C0F4EEB; alter table CHANNELS drop foreign key FK840A13D0383F84A9; alter table CHANNELS drop foreign key FK840A13D098B07789; alter table CHANNELS drop foreign key FK840A13D0CD71149; alter table CHANNEL_GROUPS drop foreign key FKDE9B8CB0F16B697D; alter table CHANNEL_SUBSCRIPTIONS drop foreign key FK9CF8F47ACB74C6C9; alter table ITEMS drop foreign key FK42BEFA0CB74C6C9; alter table ITEMS drop foreign key FK42BEFA0B5878ADA; alter table ITEMS drop foreign key FK42BEFA03D80CDC0; alter table ITEMS drop foreign key FK42BEFA083BE40B6; alter table ITEM_ENCLOSURE drop foreign key FK29A89F267432BB4B; alter table ITEM_GUID drop foreign key FK2835C8357432BB4B; alter table ITEM_METADATA drop foreign key FK3E9AEEDB7432BB4B; alter table ITEM_SOURCE drop foreign key FK60FDAC77432BB4B; drop table if exists CATEGORIES; drop table if exists CAT_CHANNEL_LINK; drop table if exists CAT_GROUP_CHANNEL; drop table if exists CAT_ITEM_LINK; drop table if exists CHANNELS; drop table if exists CHANNEL_GROUPS; drop table if exists CHANNEL_SUBSCRIPTIONS; drop table if exists CLOUDS; drop table if exists IMAGES; drop table if exists ITEMS; drop table if exists ITEM_ENCLOSURE; drop table if exists ITEM_GUID; drop table if exists ITEM_METADATA; drop table if exists ITEM_SOURCE; drop table if exists TEXTINPUTS; create table CATEGORIES (CATEGORY_ID bigint not null auto_increment, TITLE varchar(255) not null, PARENT_ID bigint, primary key (CATEGORY_ID)); create table CAT_CHANNEL_LINK (CHANNEL_ID bigint not null, CATEGORY_ID bigint not null); create table CAT_GROUP_CHANNEL (CHANNEL_ID bigint not null, GROUP_ID bigint not null, primary key (GROUP_ID, CHANNEL_ID)); create table CAT_ITEM_LINK (ITEM_ID bigint not null, CATEGORY_ID bigint not null); create table CHANNELS (CHANNEL_ID bigint not null auto_increment, TITLE varchar(255) not null, DESCRIPTION varchar(255), LOCSTRING varchar(255), SITE tinyblob, CREATOR varchar(255), PUBLISHER varchar(255), LANGUAGE varchar(255), FORMAT varchar(255), IMAGE_ID bigint, TEXTINPUT_ID bigint, COPYRIGHT varchar(255), RATING varchar(255), CLOUD_ID bigint, GENERATOR varchar(255), DOCS varchar(255), TTL integer, LAST_UPDATED datetime, LAST_BUILD_DATE datetime, PUB_DATE datetime, UPDATE_PERIOD varchar(255), UPDATE_FREQUENCY integer, UPDATE_BASE datetime, primary key (CHANNEL_ID)); create table CHANNEL_GROUPS (CHANNEL_GROUP_ID bigint not null auto_increment, TITLE varchar(255) not null, PARENT_ID bigint, primary key (CHANNEL_GROUP_ID)); create table CHANNEL_SUBSCRIPTIONS (CHANNEL_SUBSCRIPTION_ID bigint not null auto_increment, CHANNEL_ID bigint not null, ACTIVE bit, UPDATE_INTERVAL integer, primary key (CHANNEL_SUBSCRIPTION_ID)); create table CLOUDS (CLOUD_ID bigint not null auto_increment, DOMAIN varchar(255) not null, PORT integer not null, PATH varchar(255) not null, REGISTER_PROCEDURE varchar(255) not null, PROTOCOL varchar(255) not null, primary key (CLOUD_ID)); create table IMAGES (IMAGE_ID bigint not null auto_increment, TITLE varchar(255) not null, DESCRIPTION varchar(255), LOCATION varchar(255), LINK varchar(255), WIDTH integer, HEIGHT integer, primary key (IMAGE_ID)); create table ITEMS (ITEM_ID bigint not null auto_increment, CHANNEL_ID bigint not null, TITLE varchar(255) not null, DESCRIPTION text, UNREAD bit, LINK varchar(255), CREATOR varchar(255), SUBJECT varchar(255), DATE datetime, FOUND datetime, GUID bigint, COMMENTS varchar(255), SOURCE bigint, ENCLOSURE bigint, primary key (ITEM_ID)); create table ITEM_ENCLOSURE (ITEM_ENCLOSURE_ID bigint not null auto_increment, ITEM_ID bigint not null, LOCATION tinyblob, TYPE varchar(255), LENGTH integer, primary key (ITEM_ENCLOSURE_ID)); create table ITEM_GUID (ITEM_GUID_ID bigint not null auto_increment, ITEM_ID bigint not null, LOCATION varchar(255), PERMA_LINK bit, primary key (ITEM_GUID_ID)); create table ITEM_METADATA (ITEM_METADATA_ID bigint not null auto_increment, ITEM_ID bigint not null, MARKED_READ bit, SCORE integer, primary key (ITEM_METADATA_ID)); create table ITEM_SOURCE (ITEM_SOURCE_ID bigint not null auto_increment, ITEM_ID bigint not null, NAME varchar(255), LOCATION varchar(255), TIMESTAMP datetime, primary key (ITEM_SOURCE_ID)); create table TEXTINPUTS (TEXTINPUT_ID bigint not null auto_increment, TITLE varchar(255) not null, DESCRIPTION varchar(255), NAME varchar(255), LINK tinyblob, primary key (TEXTINPUT_ID)); alter table CATEGORIES add index FK6A31321CBBCD53BF (PARENT_ID), add constraint FK6A31321CBBCD53BF foreign key (PARENT_ID) references CATEGORIES (CATEGORY_ID); alter table CAT_CHANNEL_LINK add index FK510BBFCB74C6C9 (CHANNEL_ID), add constraint FK510BBFCB74C6C9 foreign key (CHANNEL_ID) references CHANNELS (CHANNEL_ID); alter table CAT_CHANNEL_LINK add index FK510BBF9C0F4EEB (CATEGORY_ID), add constraint FK510BBF9C0F4EEB foreign key (CATEGORY_ID) references CATEGORIES (CATEGORY_ID); alter table CAT_GROUP_CHANNEL add index FK94C7FE3ACB74C6C9 (CHANNEL_ID), add constraint FK94C7FE3ACB74C6C9 foreign key (CHANNEL_ID) references CHANNELS (CHANNEL_ID); alter table CAT_GROUP_CHANNEL add index FK94C7FE3A94332F88 (GROUP_ID), add constraint FK94C7FE3A94332F88 foreign key (GROUP_ID) references CHANNEL_GROUPS (CHANNEL_GROUP_ID); alter table CAT_ITEM_LINK add index FKAE9345D7432BB4B (ITEM_ID), add constraint FKAE9345D7432BB4B foreign key (ITEM_ID) references ITEMS (ITEM_ID); alter table CAT_ITEM_LINK add index FKAE9345D9C0F4EEB (CATEGORY_ID), add constraint FKAE9345D9C0F4EEB foreign key (CATEGORY_ID) references CATEGORIES (CATEGORY_ID); alter table CHANNELS add index FK840A13D0383F84A9 (TEXTINPUT_ID), add constraint FK840A13D0383F84A9 foreign key (TEXTINPUT_ID) references TEXTINPUTS (TEXTINPUT_ID); alter table CHANNELS add index FK840A13D098B07789 (IMAGE_ID), add constraint FK840A13D098B07789 foreign key (IMAGE_ID) references IMAGES (IMAGE_ID); alter table CHANNELS add index FK840A13D0CD71149 (CLOUD_ID), add constraint FK840A13D0CD71149 foreign key (CLOUD_ID) references CLOUDS (CLOUD_ID); alter table CHANNEL_GROUPS add index FKDE9B8CB0F16B697D (PARENT_ID), add constraint FKDE9B8CB0F16B697D foreign key (PARENT_ID) references CHANNEL_GROUPS (CHANNEL_GROUP_ID); alter table CHANNEL_SUBSCRIPTIONS add index FK9CF8F47ACB74C6C9 (CHANNEL_ID), add constraint FK9CF8F47ACB74C6C9 foreign key (CHANNEL_ID) references CHANNELS (CHANNEL_ID); alter table ITEMS add index FK42BEFA0CB74C6C9 (CHANNEL_ID), add constraint FK42BEFA0CB74C6C9 foreign key (CHANNEL_ID) references CHANNELS (CHANNEL_ID); alter table ITEMS add index FK42BEFA0B5878ADA (SOURCE), add constraint FK42BEFA0B5878ADA foreign key (SOURCE) references ITEM_SOURCE (ITEM_SOURCE_ID); alter table ITEMS add index FK42BEFA03D80CDC0 (ENCLOSURE), add constraint FK42BEFA03D80CDC0 foreign key (ENCLOSURE) references ITEM_ENCLOSURE (ITEM_ENCLOSURE_ID); alter table ITEMS add index FK42BEFA083BE40B6 (GUID), add constraint FK42BEFA083BE40B6 foreign key (GUID) references ITEM_GUID (ITEM_GUID_ID); alter table ITEM_ENCLOSURE add index FK29A89F267432BB4B (ITEM_ID), add constraint FK29A89F267432BB4B foreign key (ITEM_ID) references ITEMS (ITEM_ID); alter table ITEM_GUID add index FK2835C8357432BB4B (ITEM_ID), add constraint FK2835C8357432BB4B foreign key (ITEM_ID) references ITEMS (ITEM_ID); alter table ITEM_METADATA add index FK3E9AEEDB7432BB4B (ITEM_ID), add constraint FK3E9AEEDB7432BB4B foreign key (ITEM_ID) references ITEMS (ITEM_ID); alter table ITEM_SOURCE add index FK60FDAC77432BB4B (ITEM_ID), add constraint FK60FDAC77432BB4B foreign key (ITEM_ID) references ITEMS (ITEM_ID);