summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--schema.sql54
1 files changed, 30 insertions, 24 deletions
diff --git a/schema.sql b/schema.sql
index 26f7d8e..c6a6370 100644
--- a/schema.sql
+++ b/schema.sql
@@ -34,38 +34,44 @@ USE `db_scrott`;
* Permissions can be overridden down-stream, but permissions will cascade otherwise.
*/
-DROP TABLE IF EXISTS `member`;
-CREATE TABLE `member` (
- `object` varchar(10) NOT NULL,
- `member` varchar(10) NOT NULL,
+/* Common object structure attributes */
+DROP TABLE IF EXISTS `object`;
+CREATE TABLE `object` (
+ `guid` varchar(10) NOT NULL,
+ `perms` int(10) unsigned NOT NULL DEFAULT 0,
+ `owner` varchar(10) NOT NULL,
+ `parent` varchar(10) DEFAULT NULL,
+ `name` varchar(50) NOT NULL,
+ `type` enum(
+ 'user',
+ 'group'
+ ) NOT NULL,
+ PRIMARY KEY (`guid`)
+);
- PRIMARY KEY (`object`,`member`)
+/* Scheme for associating objects with members */
+DROP TABLE IF EXISTS `obj_member`;
+CREATE TABLE `obj_member` (
+ `guid` varchar(10) NOT NULL,
+ `member` varchar(10) NOT NULL,
+ PRIMARY KEY (`guid`,`member`)
);
+/* User objects - special attributes */
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
- `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `guid` varchar(10) NOT NULL,
- `owner` varchar(10) NOT NULL,
- `perms` int(10) unsigned NOT NULL,
- `name` varchar(50) NOT NULL,
- `alias` varchar(50) DEFAULT NULL,
- `key` varchar(64) NOT NULL,
- `salt` varchar(64) NOT NULL,
-
- PRIMARY KEY (`id`)
+ `guid` varchar(10) NOT NULL,
+ `key` varchar(64) NOT NULL,
+ `salt` varchar(64) NOT NULL,
+ `alias` varchar(50) DEFAULT NULL,
+ PRIMARY KEY (`guid`)
);
-DROP TABLE IF EXISTS `group`;
-CREATE TABLE `group` (
- `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `guid` varchar(10) NOT NULL,
- `owner` varchar(10) NOT NULL,
- `perms` int(10) unsigned NOT NULL,
- `name` varchar(50) NOT NULL,
+/* object type 'group' has no unique attributes */
- PRIMARY KEY (`id`)
-);
+
+
+/* TODO -- WIP FROM HERE */
DROP TABLE IF EXISTS `pad`;
CREATE TABLE `pad` (