CREATE TABLE security_groups (
	group_id INT NOT NULL AUTO_INCREMENT,
	group_name VARCHAR(32) NOT NULL DEFAULT '',
	PRIMARY KEY (group_id));

CREATE TABLE security_users (
	user_login VARCHAR(32) NOT NULL UNIQUE,
	user_password VARCHAR(64) NOT NULL DEFAULT '',
	user_name VARCHAR(32) NOT NULL DEFAULT '',
	user_access_level INTEGER NOT NULL DEFAULT '0',
	user_language VARCHAR(8) DEFAULT 'en' NOT NULL,
	user_date_created DATE,
	user_last_login DATE,
	user_email VARCHAR(80),
	PRIMARY KEY (user_login));
	
CREATE TABLE security_members (
	member_group INT REFERENCES security_groups(group_id),
	member_login VARCHAR(32) REFERENCES security_users(user_login));


INSERT INTO security_users (user_login,user_password,user_name,user_access_level) VALUES ('admin', '76a2173be6393254e72ffa4d6df1030a', 'Administrator', '99');


INSERT INTO security_groups (group_name) VALUES('Friends');
INSERT INTO security_groups (group_name) VALUES('Family');
INSERT INTO security_groups (group_name) VALUES('Maintainers');
