From de085d07814c5dc58b9a5c8abe1a543872919273 Mon Sep 17 00:00:00 2001 From: mdb Date: Fri, 2 Mar 2001 01:22:46 +0000 Subject: [PATCH] Created some SQL that creates the necessary user management tables in MySQL syntax. git-svn-id: https://samskivert.googlecode.com/svn/trunk@69 6335cc39-0255-0410-8fd6-9bcaacd3b74c --- .../src/sql/create_user_tables.mysql | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 projects/samskivert/src/sql/create_user_tables.mysql diff --git a/projects/samskivert/src/sql/create_user_tables.mysql b/projects/samskivert/src/sql/create_user_tables.mysql new file mode 100644 index 00000000..ac2bf06a --- /dev/null +++ b/projects/samskivert/src/sql/create_user_tables.mysql @@ -0,0 +1,37 @@ +/** + * $Id: create_user_tables.mysql,v 1.1 2001/03/02 01:22:46 mdb Exp $ + * + * Creates the necessary database tables in MySQL for the user repository. + */ + +/** + * The users table contains a row for every user. + */ +DROP TABLE IF EXISTS users; +CREATE TABLE users ( + userid INTEGER(10) PRIMARY KEY AUTO_INCREMENT, + username VARCHAR(24) NOT NULL, + password VARCHAR(13) NOT NULL, + email VARCHAR(128) NOT NULL, + realname VARCHAR(128) NOT NULL, + created DATE NOT NULL, + + UNIQUE INDEX username_index (username) +); + +/** + * The sessions table contains a row for every authenticated + * user. Sessions map a session identifier to a user record and expire + * after an application determined amount of time. A request that supplies + * a valid session identifier is treated as being authenticated as the + * user to which that session is mapped, so long timeouts are discouraged. + */ +DROP TABLE IF EXISTS sessions; +CREATE TABLE sessions ( + sessionid INTEGER(10) PRIMARY KEY AUTO_INCREMENT, + authcode VARCHAR(32) NOT NULL, + userid INTEGER(10) NOT NULL, + expires DATE NOT NULL, + + UNIQUE INDEX authcode_index (authcode) +);