diff options
author | M <m@lfurio.us> | 2015-11-19 19:57:11 -0500 |
---|---|---|
committer | M <m@lfurio.us> | 2015-11-19 19:57:11 -0500 |
commit | 6c660e97ebc4b3f9395c3d8489accb8fce103572 (patch) | |
tree | f6d55108257dc6e3c0f40e417234d54a1bf79285 | |
parent | 8b0f72d095fc5cb894c6ed19612d98fb03224d9f (diff) | |
download | scrott-6c660e97ebc4b3f9395c3d8489accb8fce103572.tar.gz scrott-6c660e97ebc4b3f9395c3d8489accb8fce103572.zip |
* Reworked core datamodel -- now using a common main table for holding ALL objects (and their common attributes). Additional, supplemental tables may be employed to maintain data attributes which are specific to a given object type
-rw-r--r-- | schema.sql | 54 |
1 files changed, 30 insertions, 24 deletions
@@ -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` ( |