CREATE TABLE ITEMS(ITEM_ID INTEGER NOT NULL IDENTITY PRIMARY KEY,CHANNEL_ID INTEGER NOT NULL,TITLE VARCHAR(255) NOT NULL,DESCRIPTION VARCHAR(255),UNREAD BIT,LINK VARBINARY(255),CREATOR VARCHAR(255),SUBJECT VARCHAR(255),DATE TIMESTAMP,FOUND TIMESTAMP,GUID INTEGER,COMMENTS VARBINARY(255),SOURCE INTEGER,ENCLOSURE INTEGER) CREATE TABLE TEXTINPUTS(TEXTINPUT_ID INTEGER NOT NULL IDENTITY PRIMARY KEY,TITLE VARCHAR(255) NOT NULL,DESCRIPTION VARCHAR(255),NAME VARCHAR(255),LINK VARBINARY(255)) CREATE TABLE ITEM_ENCLOSURE(ITEM_ENCLOSURE_ID INTEGER NOT NULL IDENTITY PRIMARY KEY,ITEM_ID INTEGER NOT NULL,LOCATION VARBINARY(255),TYPE VARCHAR(255),LENGTH INTEGER,CONSTRAINT FK29A89F26A8EEBDC7 FOREIGN KEY(ITEM_ID) REFERENCES ITEMS(ITEM_ID)) CREATE TABLE ITEM_SOURCE(ITEM_SOURCE_ID INTEGER NOT NULL IDENTITY PRIMARY KEY,ITEM_ID INTEGER NOT NULL,NAME VARCHAR(255),LOCATION VARCHAR(255),TIMESTAMP TIMESTAMP,CONSTRAINT FK60FDAC7A8EEBDC7 FOREIGN KEY(ITEM_ID) REFERENCES ITEMS(ITEM_ID)) CREATE TABLE CHANNEL_SUBSCRIPTIONS(CHANNEL_SUBSCRIPTION_ID INTEGER NOT NULL IDENTITY PRIMARY KEY,CHANNEL_ID INTEGER NOT NULL,ACTIVE BIT,UPDATE_INTERVAL INTEGER) CREATE TABLE CAT_GROUP_CHANNEL(GROUP_ID INTEGER NOT NULL,CHANNEL_ID INTEGER NOT NULL,CONSTRAINT SYS_PK_CAT_GROUP_CHANNEL PRIMARY KEY(GROUP_ID,CHANNEL_ID)) CREATE TABLE ITEM_GUID(ITEM_GUID_ID INTEGER NOT NULL IDENTITY PRIMARY KEY,ITEM_ID INTEGER NOT NULL,LOCATION VARCHAR(255),PERMA_LINK BIT,CONSTRAINT FK2835C835A8EEBDC7 FOREIGN KEY(ITEM_ID) REFERENCES ITEMS(ITEM_ID)) CREATE TABLE CLOUDS(CLOUD_ID INTEGER NOT NULL IDENTITY PRIMARY KEY,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) CREATE TABLE CAT_CHANNEL_LINK(CHANNEL_ID INTEGER NOT NULL,CATEGORY_ID INTEGER NOT NULL) CREATE TABLE CAT_ITEM_LINK(ITEM_ID INTEGER NOT NULL,CATEGORY_ID INTEGER NOT NULL,CONSTRAINT FKAE9345DA8EEBDC7 FOREIGN KEY(ITEM_ID) REFERENCES ITEMS(ITEM_ID)) CREATE TABLE CATEGORIES(CATEGORY_ID INTEGER NOT NULL IDENTITY PRIMARY KEY,TITLE VARCHAR(255) NOT NULL,PARENT_ID INTEGER,CONSTRAINT FK6A31321C217F38D0 FOREIGN KEY(PARENT_ID) REFERENCES CATEGORIES(CATEGORY_ID)) CREATE TABLE IMAGES(IMAGE_ID INTEGER NOT NULL IDENTITY PRIMARY KEY,TITLE VARCHAR(255) NOT NULL,DESCRIPTION VARCHAR(255),LOCATION VARBINARY(255),LINK VARBINARY(255),WIDTH INTEGER,HEIGHT INTEGER) CREATE TABLE CHANNELS(CHANNEL_ID INTEGER NOT NULL IDENTITY PRIMARY KEY,TITLE VARCHAR(255) NOT NULL,DESCRIPTION VARCHAR(255),LOCSTRING VARCHAR(255),SITE VARBINARY(255),CREATOR VARCHAR(255),PUBLISHER VARCHAR(255),LANGUAGE VARCHAR(255),FORMAT VARCHAR(255),IMAGE_ID INTEGER,TEXTINPUT_ID INTEGER,COPYRIGHT VARCHAR(255),RATING VARCHAR(255),CLOUD_ID INTEGER,GENERATOR VARCHAR(255),DOCS VARCHAR(255),TTL INTEGER,LAST_UPDATED TIMESTAMP,LAST_BUILD_DATE TIMESTAMP,PUB_DATE TIMESTAMP,UPDATE_PERIOD VARCHAR(255),UPDATE_FREQUENCY INTEGER,UPDATE_BASE TIMESTAMP,CONSTRAINT FK840A13D06FE55385 FOREIGN KEY(CLOUD_ID) REFERENCES CLOUDS(CLOUD_ID),CONSTRAINT FK840A13D09256B5FD FOREIGN KEY(TEXTINPUT_ID) REFERENCES TEXTINPUTS(TEXTINPUT_ID),CONSTRAINT FK840A13D0FB69EE9F FOREIGN KEY(IMAGE_ID) REFERENCES IMAGES(IMAGE_ID)) CREATE TABLE ITEM_METADATA(ITEM_METADATA_ID INTEGER NOT NULL IDENTITY PRIMARY KEY,ITEM_ID INTEGER NOT NULL,MARKED_READ BIT,SCORE INTEGER,CONSTRAINT FK3E9AEEDBA8EEBDC7 FOREIGN KEY(ITEM_ID) REFERENCES ITEMS(ITEM_ID)) CREATE TABLE CHANNEL_GROUPS(CHANNEL_GROUP_ID INTEGER NOT NULL IDENTITY PRIMARY KEY,TITLE VARCHAR(255) NOT NULL,PARENT_ID INTEGER,CONSTRAINT FKDE9B8CB0217F38D0 FOREIGN KEY(PARENT_ID) REFERENCES CHANNEL_GROUPS(CHANNEL_GROUP_ID)) ALTER TABLE ITEMS ADD CONSTRAINT FK42BEFA0A9D495F7 FOREIGN KEY(CHANNEL_ID) REFERENCES CHANNELS(CHANNEL_ID) ALTER TABLE ITEMS ADD CONSTRAINT FK42BEFA0218E89 FOREIGN KEY(GUID) REFERENCES ITEM_GUID(ITEM_GUID_ID) ALTER TABLE ITEMS ADD CONSTRAINT FK42BEFA092235C1B FOREIGN KEY(SOURCE) REFERENCES ITEM_SOURCE(ITEM_SOURCE_ID) ALTER TABLE ITEMS ADD CONSTRAINT FK42BEFA0FB7FAD52 FOREIGN KEY(ENCLOSURE) REFERENCES ITEM_ENCLOSURE(ITEM_ENCLOSURE_ID) ALTER TABLE CHANNEL_SUBSCRIPTIONS ADD CONSTRAINT FK9CF8F47AA9D495F7 FOREIGN KEY(CHANNEL_ID) REFERENCES CHANNELS(CHANNEL_ID) ALTER TABLE CAT_GROUP_CHANNEL ADD CONSTRAINT FK94C7FE3AA9D495F7 FOREIGN KEY(CHANNEL_ID) REFERENCES CHANNELS(CHANNEL_ID) ALTER TABLE CAT_GROUP_CHANNEL ADD CONSTRAINT FK94C7FE3A4CD4DEFB FOREIGN KEY(GROUP_ID) REFERENCES CHANNEL_GROUPS(CHANNEL_GROUP_ID) ALTER TABLE CAT_CHANNEL_LINK ADD CONSTRAINT FK510BBFA9D495F7 FOREIGN KEY(CHANNEL_ID) REFERENCES CHANNELS(CHANNEL_ID) ALTER TABLE CAT_CHANNEL_LINK ADD CONSTRAINT FK510BBFDBFCB7FC FOREIGN KEY(CATEGORY_ID) REFERENCES CATEGORIES(CATEGORY_ID) ALTER TABLE CAT_ITEM_LINK ADD CONSTRAINT FKAE9345DDBFCB7FC FOREIGN KEY(CATEGORY_ID) REFERENCES CATEGORIES(CATEGORY_ID) GRANT ALL ON CLASS "org.hsqldb.Library" TO PUBLIC GRANT ALL ON CLASS "java.lang.Math" TO PUBLIC CREATE USER SA PASSWORD "" ADMIN CREATE ALIAS DAYNAME FOR "org.hsqldb.Library.dayname" CREATE ALIAS SPACE FOR "org.hsqldb.Library.space" CREATE ALIAS SUBSTRING FOR "org.hsqldb.Library.substring" CREATE ALIAS HEXTORAW FOR "org.hsqldb.Library.hexToRaw" CREATE ALIAS SQRT FOR "java.lang.Math.sqrt" CREATE ALIAS ABS FOR "org.hsqldb.Library.abs" CREATE ALIAS POWER FOR "java.lang.Math.pow" CREATE ALIAS CHAR FOR "org.hsqldb.Library.character" CREATE ALIAS CONCAT FOR "org.hsqldb.Library.concat" CREATE ALIAS PI FOR "org.hsqldb.Library.pi" CREATE ALIAS RAWTOHEX FOR "org.hsqldb.Library.rawToHex" CREATE ALIAS SECOND FOR "org.hsqldb.Library.second" CREATE ALIAS TRUNCATE FOR "org.hsqldb.Library.truncate" CREATE ALIAS MONTH FOR "org.hsqldb.Library.month" CREATE ALIAS LOWER FOR "org.hsqldb.Library.lcase" CREATE ALIAS ATAN2 FOR "java.lang.Math.atan2" CREATE ALIAS REPEAT FOR "org.hsqldb.Library.repeat" CREATE ALIAS DAYOFMONTH FOR "org.hsqldb.Library.dayofmonth" CREATE ALIAS TAN FOR "java.lang.Math.tan" CREATE ALIAS RADIANS FOR "java.lang.Math.toRadians" CREATE ALIAS FLOOR FOR "java.lang.Math.floor" CREATE ALIAS NOW FOR "org.hsqldb.Library.now" CREATE ALIAS ACOS FOR "java.lang.Math.acos" CREATE ALIAS DAYOFWEEK FOR "org.hsqldb.Library.dayofweek" CREATE ALIAS CEILING FOR "java.lang.Math.ceil" CREATE ALIAS DAYOFYEAR FOR "org.hsqldb.Library.dayofyear" CREATE ALIAS LCASE FOR "org.hsqldb.Library.lcase" CREATE ALIAS WEEK FOR "org.hsqldb.Library.week" CREATE ALIAS SOUNDEX FOR "org.hsqldb.Library.soundex" CREATE ALIAS ASIN FOR "java.lang.Math.asin" CREATE ALIAS LOCATE FOR "org.hsqldb.Library.locate" CREATE ALIAS EXP FOR "java.lang.Math.exp" CREATE ALIAS MONTHNAME FOR "org.hsqldb.Library.monthname" CREATE ALIAS YEAR FOR "org.hsqldb.Library.year" CREATE ALIAS LEFT FOR "org.hsqldb.Library.left" CREATE ALIAS ROUNDMAGIC FOR "org.hsqldb.Library.roundMagic" CREATE ALIAS BITOR FOR "org.hsqldb.Library.bitor" CREATE ALIAS LTRIM FOR "org.hsqldb.Library.ltrim" CREATE ALIAS COT FOR "org.hsqldb.Library.cot" CREATE ALIAS COS FOR "java.lang.Math.cos" CREATE ALIAS MOD FOR "org.hsqldb.Library.mod" CREATE ALIAS SIGN FOR "org.hsqldb.Library.sign" CREATE ALIAS DEGREES FOR "java.lang.Math.toDegrees" CREATE ALIAS LOG FOR "java.lang.Math.log" CREATE ALIAS SIN FOR "java.lang.Math.sin" CREATE ALIAS CURTIME FOR "org.hsqldb.Library.curtime" CREATE ALIAS DIFFERENCE FOR "org.hsqldb.Library.difference" CREATE ALIAS INSERT FOR "org.hsqldb.Library.insert" CREATE ALIAS SUBSTR FOR "org.hsqldb.Library.substring" CREATE ALIAS DATABASE FOR "org.hsqldb.Library.database" CREATE ALIAS MINUTE FOR "org.hsqldb.Library.minute" CREATE ALIAS HOUR FOR "org.hsqldb.Library.hour" CREATE ALIAS IDENTITY FOR "org.hsqldb.Library.identity" CREATE ALIAS QUARTER FOR "org.hsqldb.Library.quarter" CREATE ALIAS CURDATE FOR "org.hsqldb.Library.curdate" CREATE ALIAS BITAND FOR "org.hsqldb.Library.bitand" CREATE ALIAS USER FOR "org.hsqldb.Library.user" CREATE ALIAS UCASE FOR "org.hsqldb.Library.ucase" CREATE ALIAS RTRIM FOR "org.hsqldb.Library.rtrim" CREATE ALIAS LOG10 FOR "org.hsqldb.Library.log10" CREATE ALIAS RIGHT FOR "org.hsqldb.Library.right" CREATE ALIAS ATAN FOR "java.lang.Math.atan" CREATE ALIAS UPPER FOR "org.hsqldb.Library.ucase" CREATE ALIAS ASCII FOR "org.hsqldb.Library.ascii" CREATE ALIAS RAND FOR "java.lang.Math.random" CREATE ALIAS LENGTH FOR "org.hsqldb.Library.length" CREATE ALIAS ROUND FOR "org.hsqldb.Library.round" CREATE ALIAS REPLACE FOR "org.hsqldb.Library.replace"