From 4f0689ca560e0b7fe8d989e2787520f009ebba02 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Mon, 10 Jun 2024 00:35:34 -0700 Subject: Add initial sqlite tables file --- data/tables.sqlite.sql | 203 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 203 insertions(+) create mode 100644 data/tables.sqlite.sql diff --git a/data/tables.sqlite.sql b/data/tables.sqlite.sql new file mode 100644 index 0000000..6a22ad1 --- /dev/null +++ b/data/tables.sqlite.sql @@ -0,0 +1,203 @@ +-- Semantic Scuttle - Tables creation SQL script +-- ! Dont forget to change table names according to $tableprefix defined in config.php ! + +-- +-- Table structure for table `sc_bookmarks` +-- + +CREATE TABLE IF NOT EXISTS `sc_bookmarks` ( + `bId` integer NOT NULL, + `uId` int(11) NOT NULL default '0', + `bIp` varchar(40) default NULL, + `bStatus` tinyint(1) NOT NULL default '0', + `bDatetime` datetime NOT NULL default '0000-00-00 00:00:00', + `bModified` datetime NOT NULL default '0000-00-00 00:00:00', + `bTitle` varchar(255) NOT NULL default '', + `bAddress` varchar(1500) NOT NULL, + `bDescription` text default NULL, + `bPrivateNote` text default NULL, + `bHash` varchar(32) NOT NULL default '', + `bVotes` int(11) NOT NULL default '0', + `bVoting` int(11) NOT NULL default '0', + `bShort` varchar(16) default NULL, + PRIMARY KEY (`bId`), + CONSTRAINT `sc_bookmarks_usd` UNIQUE (`uId`,`bStatus`,`bDatetime`), + CONSTRAINT `sc_bookmarks_hui` UNIQUE (`bHash`,`uId`,`bId`), + CONSTRAINT `sc_bookmarks_du` UNIQUE (`bDatetime`,`uId`) +); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `sc_tags` +-- + +CREATE TABLE IF NOT EXISTS `sc_tags` ( + `tId` integer NOT NULL, + `tag` varchar(100) NOT NULL default '', + `uId` int(11) NOT NULL default '0', + `tDescription` text default NULL, + PRIMARY KEY (`tId`), + CONSTRAINT `sc_tags_tag_uId` UNIQUE (`tag`, `uId`) +); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `sc_bookmarks2tags` +-- + +CREATE TABLE IF NOT EXISTS `sc_bookmarks2tags` ( + `id` integer NOT NULL, + `bId` int(11) NOT NULL default '0', + `tag` varchar(100) NOT NULL default '', + PRIMARY KEY (`id`), + UNIQUE (`tag`,`bId`), + CONSTRAINT `sc_bookmarks2tags_bId` UNIQUE (`bId`) +); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `sc_users` +-- + +CREATE TABLE IF NOT EXISTS `sc_users` ( + `uId` integer NOT NULL, + `username` varchar(25) NOT NULL default '', + `password` varchar(40) NOT NULL default '', + `uDatetime` datetime NOT NULL default '0000-00-00 00:00:00', + `uModified` datetime NOT NULL default '0000-00-00 00:00:00', + `name` varchar(50) default NULL, + `email` varchar(50) NOT NULL default '', + `homepage` varchar(255) default NULL, + `uContent` text, + `privateKey` varchar(33) default NULL, + PRIMARY KEY (`uId`), + CONSTRAINT `privateKey` UNIQUE (`privateKey`) +); + +-- -------------------------------------------------------- + +CREATE TABLE IF NOT EXISTS `sc_users_sslclientcerts` ( + `id` INTEGER NOT NULL , + `uId` INT NOT NULL , + `sslSerial` VARCHAR( 32 ) NOT NULL , + `sslClientIssuerDn` VARCHAR( 1024 ) NOT NULL , + `sslName` VARCHAR( 64 ) NOT NULL , + `sslEmail` VARCHAR( 64 ) NOT NULL , + PRIMARY KEY ( `id` ) +); + +-- +-- Table structure for table `sc_watched` +-- + +CREATE TABLE IF NOT EXISTS `sc_watched` ( + `wId` integer NOT NULL, + `uId` int(11) NOT NULL default '0', + `watched` int(11) NOT NULL default '0', + PRIMARY KEY (`wId`), + CONSTRAINT `sc_watched_uId` UNIQUE (`uId`) +); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `sc_tags2tags` +-- + +CREATE TABLE IF NOT EXISTS `sc_tags2tags` ( + `ttId` integer NOT NULL, + `tag1` varchar(100) NOT NULL default '', + `tag2` varchar(100) NOT NULL default '', + `relationType` varchar(32) NOT NULL default '', + `uId` int(11) NOT NULL default '0', + PRIMARY KEY (`ttId`), + CONSTRAINT `sc_tags2tags_tag1_tag2_uId` UNIQUE (`tag1`,`tag2`,`relationType`,`uId`) +); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `sc_tagsstats` +-- + +CREATE TABLE IF NOT EXISTS `sc_tagsstats` ( + `tstId` integer NOT NULL, + `tag1` varchar(100) NOT NULL default '', + `relationType` varchar(32) NOT NULL default '', + `uId` int(11) NOT NULL default '0', + `nb` int(11) NOT NULL default '0', + `depth` int(11) NOT NULL default '0', + `nbupdate` int(11) NOT NULL default '0', + PRIMARY KEY (`tstId`), + CONSTRAINT `sc_tagsstats_tag1_type_uId` UNIQUE (`tag1`,`relationType`,`uId`) +); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `sc_tagscache` +-- + +CREATE TABLE IF NOT EXISTS `sc_tagscache` ( + `tcId` integer NOT NULL, + `tag1` varchar(100) NOT NULL default '', + `tag2` varchar(100) NOT NULL default '', + `relationType` varchar(32) NOT NULL default '', + `uId` int(11) NOT NULL default '0', + PRIMARY KEY (`tcId`), + CONSTRAINT `sc_tagscache_tag1_tag2_type_uId` UNIQUE (`tag1`,`tag2`,`relationType`,`uId`) +); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `sc_commondescription` +-- + +CREATE TABLE IF NOT EXISTS `sc_commondescription` ( + `cdId` integer NOT NULL, + `uId` int(11) NOT NULL default '0', + `tag` varchar(100) NOT NULL default '', + `bHash` varchar(32) NOT NULL default '', + `cdTitle` varchar(255) NOT NULL default '', + `cdDescription` text default NULL, + `cdDatetime` datetime NOT NULL default '0000-00-00 00:00:00', + PRIMARY KEY (`cdId`), + CONSTRAINT `sc_commondescription_tag_datetime` UNIQUE (`tag`,`CDDATETIME`), + CONSTRAINT `sc_commondescription_bookmark_datetime` UNIQUE (`bHash`,`cdDatetime`) +); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `sc_searchhistory` +-- + +CREATE TABLE IF NOT EXISTS `sc_searchhistory` ( + `shId` integer NOT NULL, + `shTerms` varchar(255) NOT NULL default '', + `shRange` varchar(32) NOT NULL default '', + `shDatetime` datetime NOT NULL default '0000-00-00 00:00:00', + `shNbResults` int(6) NOT NULL default '0', + `uId` int(11) NOT NULL default '0', + PRIMARY KEY (`shId`) +); + + +CREATE TABLE IF NOT EXISTS `sc_votes` ( + `bId` INT NOT NULL , + `uId` INT NOT NULL , + `vote` INT( 2 ) NOT NULL , + CONSTRAINT `bid_2` UNIQUE (`bId`,`uId`), + CONSTRAINT `bid` UNIQUE (`bId`), + CONSTRAINT `uid` UNIQUE (`uId`) +); + + +CREATE TABLE IF NOT EXISTS `sc_version` ( + `schema_version` int(11) NOT NULL +); +INSERT INTO `sc_version` (`schema_version`) VALUES ('6'); -- cgit v1.2.3-54-g00ecf