Permalink
Browse files

Merge branch 'master' of github.com:Deconstrained/Gummii

  • Loading branch information...
2 parents d8c9bfa + 63aea6c commit 9e39ed856754e941c681fc86b455b3b3e57f4ee2 Cameron committed Jun 6, 2012
Showing with 51 additions and 19 deletions.
  1. +1 −0 .gitignore
  2. +4 −3 scripts/unix/saveSchema.sh
  3. +1 −1 webroot/protected/config/auth.php
  4. +45 −15 webroot/protected/data/schema.mysql.sql
View
@@ -1,3 +1,4 @@
nbproject
webroot/protected/config/custom.php
webroot/protected/data/auth.php
+scripts/unix/dbpass
@@ -2,9 +2,10 @@
cwd=$(pwd)
dir="../../webroot/protected/data"
+pass=$(cat dbpass)
cd $dir
-echo "MySQL root password:"
-read pass
+#echo "MySQL root password:"
+#read pass
mysqldump -u root -p$pass -d gummii > schema.mysql.sql
-cd $cwd
+cd $cwd
@@ -12,7 +12,7 @@
),
'Me' => array(
'type' => CAuthItem::TYPE_ROLE,
- 'description' => 'Upgraded user role. For special people.',
+ 'description' => 'Member (upgraded user role). For special people.',
'children' => array('Us'),
'bizRule' => '',
'data' => ''
@@ -24,15 +24,20 @@ DROP TABLE IF EXISTS `assets`;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `assets` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `container_id` int(10) unsigned NOT NULL COMMENT 'The post record serving as the container/controller.',
`type` char(2) NOT NULL,
`mimetype` varchar(255) DEFAULT NULL,
`url` varchar(255) NOT NULL,
`hash` char(64) NOT NULL COMMENT 'Hash of the file if uploaded, of the URL if external.',
`iteration` int(10) unsigned NOT NULL DEFAULT '1' COMMENT 'Distinguishes assets in the unlikely event of a hash collision.',
`origin` varchar(255) DEFAULT NULL,
+ `user_id` int(11) NOT NULL COMMENT 'ID of the first user who uploaded / added it.',
PRIMARY KEY (`id`),
UNIQUE KEY `non_duplicate` (`hash`,`iteration`),
- KEY `type` (`type`)
+ KEY `type` (`type`),
+ KEY `user_id` (`user_id`),
+ KEY `parent_id` (`container_id`),
+ CONSTRAINT `assets_ibfk_1` FOREIGN KEY (`container_id`) REFERENCES `posts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -53,8 +58,8 @@ CREATE TABLE `associations` (
KEY `date_created` (`date_created`,`date_updated`),
KEY `type` (`type`),
KEY `destination_id` (`destination_id`),
- CONSTRAINT `associations_ibfk_2` FOREIGN KEY (`destination_id`) REFERENCES `posts` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION,
- CONSTRAINT `associations_ibfk_1` FOREIGN KEY (`source_id`) REFERENCES `posts` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION
+ CONSTRAINT `associations_ibfk_2` FOREIGN KEY (`destination_id`) REFERENCES `posts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `associations_ibfk_1` FOREIGN KEY (`source_id`) REFERENCES `posts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Categorization and grouping of post objects by interrelation.';
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -66,12 +71,12 @@ DROP TABLE IF EXISTS `posts`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `posts` (
- `id` int(10) unsigned NOT NULL,
+ `id` int(10) unsigned NOT NULL DEFAULT '0',
`type` char(2) NOT NULL DEFAULT 'Po',
`parent_id` int(10) unsigned DEFAULT NULL COMMENT 'If NULL and type=Po, the post is orphaned.',
`date_created` int(10) unsigned NOT NULL,
`date_updated` int(10) unsigned NOT NULL,
- `author_id` int(10) unsigned NOT NULL,
+ `author_id` int(10) unsigned DEFAULT NULL COMMENT 'Anonymous/guest if NULL.',
`author_name` varchar(255) NOT NULL COMMENT 'Made longer to allow for markup.',
`has_responses` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT 'Direct responses to this object as a comment exist.',
`is_frozen` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT 'Post cannot be edited.',
@@ -90,9 +95,9 @@ CREATE TABLE `posts` (
KEY `date_created` (`date_created`),
KEY `parent_id` (`parent_id`),
KEY `is_hidden` (`is_hidden`),
+ CONSTRAINT `posts_ibfk_7` FOREIGN KEY (`parent_id`) REFERENCES `posts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `posts_ibfk_5` FOREIGN KEY (`asset_id`) REFERENCES `assets` (`id`) ON DELETE SET NULL ON UPDATE NO ACTION,
- CONSTRAINT `posts_ibfk_1` FOREIGN KEY (`author_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION,
- CONSTRAINT `posts_ibfk_4` FOREIGN KEY (`parent_id`) REFERENCES `posts` (`id`) ON DELETE SET NULL ON UPDATE NO ACTION
+ CONSTRAINT `posts_ibfk_6` FOREIGN KEY (`author_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='The omnibus communicative user text input model.';
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -112,12 +117,37 @@ CREATE TABLE `relations` (
PRIMARY KEY (`initiator_id`,`recipient_id`,`type`),
KEY `datestamps` (`date_updated`,`date_created`),
KEY `recipient_id` (`recipient_id`),
- CONSTRAINT `relations_ibfk_2` FOREIGN KEY (`recipient_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION,
- CONSTRAINT `relations_ibfk_1` FOREIGN KEY (`initiator_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION
+ CONSTRAINT `relations_ibfk_2` FOREIGN KEY (`recipient_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `relations_ibfk_1` FOREIGN KEY (`initiator_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
+-- Table structure for table `revisions`
+--
+
+DROP TABLE IF EXISTS `revisions`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `revisions` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `post_id` int(10) unsigned NOT NULL,
+ `date` int(10) unsigned NOT NULL,
+ `user_id` int(10) unsigned NOT NULL,
+ `ipv4` varchar(15) NOT NULL,
+ `ipv6` varchar(39) NOT NULL,
+ `diff` text NOT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `non_duplicate` (`post_id`,`date`,`user_id`),
+ KEY `date` (`date`),
+ KEY `ipaddr` (`ipv4`,`ipv6`),
+ KEY `user_id` (`user_id`),
+ CONSTRAINT `revisions_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `revisions_ibfk_2` FOREIGN KEY (`post_id`) REFERENCES `posts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='A record of submitted text. ';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
-- Table structure for table `subscriptions`
--
@@ -136,8 +166,8 @@ CREATE TABLE `subscriptions` (
KEY `object_id` (`object_id`),
KEY `user_id` (`user_id`),
KEY `object_type` (`object_type`),
- CONSTRAINT `subscriptions_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION,
- CONSTRAINT `subscriptions_ibfk_2` FOREIGN KEY (`object_id`) REFERENCES `posts` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION
+ CONSTRAINT `subscriptions_ibfk_2` FOREIGN KEY (`object_id`) REFERENCES `posts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `subscriptions_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='General-purpose junction table';
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -160,9 +190,9 @@ CREATE TABLE `tags` (
KEY `title` (`title`),
KEY `user_id` (`user_id`),
KEY `post_id` (`post_id`),
- CONSTRAINT `tags_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
- CONSTRAINT `tags_ibfk_2` FOREIGN KEY (`post_id`) REFERENCES `posts` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION,
- CONSTRAINT `tags_ibfk_3` FOREIGN KEY (`origin_id`) REFERENCES `tags` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION
+ CONSTRAINT `tags_ibfk_3` FOREIGN KEY (`post_id`) REFERENCES `posts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `tags_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `tags_ibfk_2` FOREIGN KEY (`origin_id`) REFERENCES `tags` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='Organic user-input "votes" to categorize information.';
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -199,4 +229,4 @@ CREATE TABLE `users` (
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
--- Dump completed on 2012-06-03 13:18:40
+-- Dump completed on 2012-06-03 15:33:40

0 comments on commit 9e39ed8

Please sign in to comment.