-- phpMyAdmin SQL Dump
-- version 4.0.4.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Sep 17, 2013 at 08:49 PM
-- Server version: 5.5.32
-- PHP Version: 5.4.16
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!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 */;
--
-- Database: `mksc`
--
CREATE DATABASE IF NOT EXISTS `mksc` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `mksc`;
-- --------------------------------------------------------
--
-- Table structure for table `chat`
--
CREATE TABLE IF NOT EXISTS `chat` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`client_id` int(11) NOT NULL,
`user_id` int(11) DEFAULT NULL,
`status` int(11) NOT NULL DEFAULT '0',
`start_date` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`end_date` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `fk_chat_users_idx` (`user_id`),
KEY `fk_chat_clients1_idx` (`client_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ;
-- --------------------------------------------------------
--
-- Table structure for table `client`
--
CREATE TABLE IF NOT EXISTS `client` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(45) NOT NULL,
`email` varchar(45) NOT NULL,
`last_activity` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ;
-- --------------------------------------------------------
--
-- Table structure for table `message`
--
CREATE TABLE IF NOT EXISTS `message` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`chat_id` int(11) NOT NULL,
`type` int(11) NOT NULL,
`content` varchar(255) NOT NULL,
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `fk_message_chat1_idx` (`chat_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ;
-- --------------------------------------------------------
--
-- Table structure for table `php_session`
--
CREATE TABLE IF NOT EXISTS `php_session` (
`session_id` varchar(32) NOT NULL DEFAULT '',
`user_id` varchar(16) DEFAULT NULL,
`date_created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`last_updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`session_data` longtext,
PRIMARY KEY (`session_id`),
KEY `last_updated` (`last_updated`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `user`
--
CREATE TABLE IF NOT EXISTS `user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(45) NOT NULL,
`password` varchar(45) NOT NULL,
`display_name` varchar(45) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
--
-- Dumping data for table `user`
--
INSERT INTO `user` (`id`, `username`, `password`, `display_name`) VALUES
(1, 'admin', '81dc9bdb52d04dc20036dbd8313ed055', 'Admin');
-- --------------------------------------------------------
--
-- Table structure for table `users_loged`
--
CREATE TABLE IF NOT EXISTS `users_loged` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`last_activity` datetime NOT NULL,
PRIMARY KEY (`id`),
KEY `fk_users_loged_user1_idx` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `chat`
--
ALTER TABLE `chat`
ADD CONSTRAINT `fk_chat_clients1` FOREIGN KEY (`client_id`) REFERENCES `client` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_chat_users` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Constraints for table `message`
--
ALTER TABLE `message`
ADD CONSTRAINT `fk_message_chat1` FOREIGN KEY (`chat_id`) REFERENCES `chat` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `users_loged`
--
ALTER TABLE `users_loged`
ADD CONSTRAINT `fk_users_loged_user1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|