Minimal SQL schema for Keruald and Pluton

I’m creating a new site for tools (see next post) built on the top of Keruald/Pluton.

This is the opportunity to refresh the SQL schema.

It supports 16 777 215 users account, is IPv6 and salted password compliant.

Here the new minimal SQL schema for MySQL:

CREATE TABLE `sessions` (
`session_id` varchar(32) NOT NULL DEFAULT '',
`session_ip` varchar(45) NOT NULL DEFAULT '', -- Native IPv6 are 39 chars max and with IPv4 tunnel 45 chars
`session_resource` mediumint(5) NOT NULL DEFAULT 1,
`user_id` mediumint(5) NOT NULL DEFAULT '-1',
`session_online` tinyint(4) NOT NULL DEFAULT '1',
`session_updated` TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`session_id`),
KEY `Where` (`session_resource`),
KEY `WhereWhen` (`session_resource`, `session_updated`)
) ENGINE=MEMORY COMMENT='Sessions for Keruald sites';

CREATE TABLE `users` (
`user_id` mediumint(5) NOT NULL DEFAULT '0',
`username` varchar(11) NOT NULL DEFAULT '',
`user_password_salt` varchar(32) NOT NULL DEFAULT '',
`user_password` varchar(32) NOT NULL DEFAULT '',
`user_active` tinyint(1) NOT NULL DEFAULT '0',
`user_actkey` varchar(11) DEFAULT NULL,
`user_email` varchar(63) NOT NULL DEFAULT '',
`user_regdate` int(10) NOT NULL DEFAULT '0',
PRIMARY KEY (`user_id`),
KEY user_active (`user_active`)
) COMMENT='Users for Keruald sites';

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.