update DB Structure set to primary keys for documents_tagged move client_id last for consistancy as its a foriegn key for document_tags

This commit is contained in:
johnnyq 2022-01-05 21:38:47 -05:00
parent 62470c1c45
commit 16344aa1a6
1 changed files with 23 additions and 18 deletions

41
db.sql
View File

@ -334,6 +334,21 @@ CREATE TABLE `custom_links` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `document_tags`
--
DROP TABLE IF EXISTS `document_tags`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `document_tags` (
`tag_id` int(11) NOT NULL AUTO_INCREMENT,
`tag_name` varchar(30) NOT NULL,
`client_id` int(11) NOT NULL,
PRIMARY KEY (`tag_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `documents`
--
@ -359,24 +374,14 @@ CREATE TABLE `documents` (
--
DROP TABLE IF EXISTS `documents_tagged`;
CREATE TABLE IF NOT EXISTS `documents_tagged` (
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `documents_tagged` (
`document_id` int(11) NOT NULL,
`tag_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
COMMIT;
--
-- Table structure for table `document_tags`
--
DROP TABLE IF EXISTS `document_tags`;
CREATE TABLE IF NOT EXISTS `document_tags` (
`tag_id` int(11) NOT NULL AUTO_INCREMENT,
`client_id` int(11) NOT NULL,
`tag_name` varchar(15) NOT NULL,
PRIMARY KEY (`tag_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
COMMIT;
`tag_id` int(11) NOT NULL,
PRIMARY KEY (`document_id`,`tag_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `domains`
@ -1178,4 +1183,4 @@ CREATE TABLE `vendors` (
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2022-01-04 11:34:48
-- Dump completed on 2022-01-05 21:36:40