Database schema
Below is the database schema needed by DX Auth library, or you can find this schema in 'schema.sql' file after you extract downloaded zip file.
This will install:- CI Session table named 'ci_sessions'. You can remove the 'ci_sessions' install script if you already have this table in your database.
- DX Auth library table.
- User with admin role, username: admin, password: hello.
- User with user role, username: user, password: hello.
- Default roles in role_table (User and admin).
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; -- -------------------------------------------------------- -- -- Table structure for table `ci_sessions` -- CREATE TABLE IF NOT EXISTS `ci_sessions` ( `session_id` varchar(40) collate utf8_bin NOT NULL default '0', `ip_address` varchar(16) collate utf8_bin NOT NULL default '0', `user_agent` varchar(150) collate utf8_bin NOT NULL, `last_activity` int(10) unsigned NOT NULL default '0', `user_data` text collate utf8_bin NOT NULL, PRIMARY KEY (`session_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -- -------------------------------------------------------- -- -- Table structure for table `login_attempts` -- CREATE TABLE IF NOT EXISTS `login_attempts` ( `id` int(11) NOT NULL auto_increment, `ip_address` varchar(40) collate utf8_bin NOT NULL, `time` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `roles` -- CREATE TABLE IF NOT EXISTS `roles` ( `id` int(11) NOT NULL auto_increment, `parent_id` int(11) NOT NULL default '0', `name` varchar(30) collate utf8_bin NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=3 ; -- -- Dumping data for table `roles` -- INSERT INTO `roles` (`id`, `parent_id`, `name`) VALUES (1, 0, 'User'), (2, 0, 'Admin'); -- -------------------------------------------------------- -- -- Table structure for table `permissions` -- CREATE TABLE IF NOT EXISTS `permissions` ( `id` int(11) NOT NULL auto_increment, `role_id` int(11) NOT NULL, `data` text collate utf8_bin, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `users` -- CREATE TABLE IF NOT EXISTS `users` ( `id` int(11) NOT NULL auto_increment, `role_id` int(11) NOT NULL default '1', `username` varchar(25) collate utf8_bin NOT NULL, `password` varchar(34) collate utf8_bin NOT NULL, `email` varchar(100) collate utf8_bin NOT NULL, `banned` tinyint(1) NOT NULL default '0', `ban_reason` varchar(255) collate utf8_bin default NULL, `newpass` varchar(34) collate utf8_bin default NULL, `newpass_key` varchar(32) collate utf8_bin default NULL, `newpass_time` datetime default NULL, `last_ip` varchar(40) collate utf8_bin NOT NULL, `last_login` datetime NOT NULL default '0000-00-00 00:00:00', `created` datetime NOT NULL default '0000-00-00 00:00:00', `modified` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=3 ; -- -- Dumping data for table `users` -- INSERT INTO `users` (`id`, `role_id`, `username`, `password`, `email`, `banned`, `ban_reason`, `newpass`, `newpass_key`, `newpass_time`, `last_ip`, `last_login`, `created`, `modified`) VALUES (1, 2, 'admin', '$1$i75.Do4.$ROPRZjZzDx/JjqeVtaJLW.', 'admin@localhost.com', 0, NULL, NULL, NULL, NULL, '127.0.0.1', '2008-11-30 04:56:38', '2008-11-30 04:56:32', '2008-11-30 04:56:38'), (2, 1, 'user', '$1$bO..IR4.$CxjJBjKJ5QW2/BaYKDS7f.', 'user@localhost.com', 0, NULL, NULL, NULL, NULL, '127.0.0.1', '2008-12-01 14:04:14', '2008-12-01 14:01:53', '2008-12-01 14:04:14'); -- -------------------------------------------------------- -- -- Table structure for table `user_autologin` -- CREATE TABLE IF NOT EXISTS `user_autologin` ( `key_id` char(32) collate utf8_bin NOT NULL, `user_id` mediumint(8) NOT NULL default '0', `user_agent` varchar(150) collate utf8_bin NOT NULL, `last_ip` varchar(40) collate utf8_bin NOT NULL, `last_login` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, PRIMARY KEY (`key_id`,`user_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -- -------------------------------------------------------- -- -- Table structure for table `user_profile` -- CREATE TABLE IF NOT EXISTS `user_profile` ( `id` int(11) NOT NULL auto_increment, `user_id` int(11) NOT NULL, `country` varchar(20) collate utf8_bin default NULL, `website` varchar(255) collate utf8_bin default NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=2 ; -- -- Dumping data for table `user_profile` -- INSERT INTO `user_profile` (`id`, `user_id`, `country`, `website`) VALUES (1, 1, NULL, NULL); -- -------------------------------------------------------- -- -- Table structure for table `user_temp` -- CREATE TABLE IF NOT EXISTS `user_temp` ( `id` int(11) NOT NULL auto_increment, `username` varchar(255) collate utf8_bin NOT NULL, `password` varchar(34) collate utf8_bin NOT NULL, `email` varchar(100) collate utf8_bin NOT NULL, `activation_key` varchar(50) collate utf8_bin NOT NULL, `last_ip` varchar(40) collate utf8_bin NOT NULL, `created` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=1 ;