Created
January 16, 2013 15:25
-
-
Save codewithcats/4547928 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE DATABASE IF NOT EXISTS `statsinfo_dev` /*!40100 DEFAULT CHARACTER SET utf8 */; | |
USE `statsinfo_dev`; | |
-- MySQL dump 10.13 Distrib 5.5.28, for debian-linux-gnu (i686) | |
-- | |
-- Host: 127.0.0.1 Database: statsinfo_dev | |
-- ------------------------------------------------------ | |
-- Server version 5.5.28-0ubuntu0.12.04.3 | |
/*!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 */; | |
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; | |
/*!40103 SET TIME_ZONE='+00:00' */; | |
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; | |
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; | |
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; | |
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; | |
-- | |
-- Table structure for table `customer_areas` | |
-- | |
DROP TABLE IF EXISTS `customer_areas`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8 */; | |
CREATE TABLE `customer_areas` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`area_code` varchar(255) DEFAULT NULL, | |
`name` varchar(255) DEFAULT NULL, | |
`created_at` datetime NOT NULL, | |
`updated_at` datetime NOT NULL, | |
PRIMARY KEY (`id`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
-- | |
-- Dumping data for table `customer_areas` | |
-- | |
LOCK TABLES `customer_areas` WRITE; | |
/*!40000 ALTER TABLE `customer_areas` DISABLE KEYS */; | |
/*!40000 ALTER TABLE `customer_areas` ENABLE KEYS */; | |
UNLOCK TABLES; | |
-- | |
-- Table structure for table `customer_groups` | |
-- | |
DROP TABLE IF EXISTS `customer_groups`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8 */; | |
CREATE TABLE `customer_groups` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`group_code` varchar(255) DEFAULT NULL, | |
`name` varchar(255) DEFAULT NULL, | |
`created_at` datetime NOT NULL, | |
`updated_at` datetime NOT NULL, | |
PRIMARY KEY (`id`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
-- | |
-- Dumping data for table `customer_groups` | |
-- | |
LOCK TABLES `customer_groups` WRITE; | |
/*!40000 ALTER TABLE `customer_groups` DISABLE KEYS */; | |
/*!40000 ALTER TABLE `customer_groups` ENABLE KEYS */; | |
UNLOCK TABLES; | |
-- | |
-- Table structure for table `customers` | |
-- | |
DROP TABLE IF EXISTS `customers`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8 */; | |
CREATE TABLE `customers` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`customer_code` varchar(255) DEFAULT NULL, | |
`name` varchar(255) DEFAULT NULL, | |
`cont` varchar(255) DEFAULT NULL, | |
`address` varchar(255) DEFAULT NULL, | |
`phone` varchar(255) DEFAULT NULL, | |
`fax` varchar(255) DEFAULT NULL, | |
`email` varchar(255) DEFAULT NULL, | |
`start_date` date DEFAULT NULL, | |
`order` int(11) DEFAULT NULL, | |
`order_avg` decimal(10,0) DEFAULT NULL, | |
`buy` decimal(10,0) DEFAULT NULL, | |
`buy_avg` decimal(10,0) DEFAULT NULL, | |
`quanbuy` decimal(10,0) DEFAULT NULL, | |
`quanbuy_avg` decimal(10,0) DEFAULT NULL, | |
`contact` int(11) DEFAULT NULL, | |
`credit_limit` varchar(255) DEFAULT NULL, | |
`late` int(11) DEFAULT NULL, | |
`group_id` int(11) DEFAULT NULL, | |
`area_id` int(11) DEFAULT NULL, | |
`created_at` datetime NOT NULL, | |
`updated_at` datetime NOT NULL, | |
PRIMARY KEY (`id`), | |
KEY `area_id` (`area_id`), | |
KEY `group_id` (`group_id`), | |
CONSTRAINT `customers_ibfk_2` FOREIGN KEY (`group_id`) REFERENCES `customer_groups` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, | |
CONSTRAINT `customers_ibfk_1` FOREIGN KEY (`area_id`) REFERENCES `customer_areas` (`id`) ON DELETE CASCADE ON UPDATE CASCADE | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
-- | |
-- Dumping data for table `customers` | |
-- | |
LOCK TABLES `customers` WRITE; | |
/*!40000 ALTER TABLE `customers` DISABLE KEYS */; | |
/*!40000 ALTER TABLE `customers` ENABLE KEYS */; | |
UNLOCK TABLES; | |
-- | |
-- Table structure for table `product_categories` | |
-- | |
DROP TABLE IF EXISTS `product_categories`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8 */; | |
CREATE TABLE `product_categories` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`category_code` varchar(255) DEFAULT NULL, | |
`name` varchar(255) DEFAULT NULL, | |
`created_at` datetime NOT NULL, | |
`updated_at` datetime NOT NULL, | |
PRIMARY KEY (`id`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
-- | |
-- Dumping data for table `product_categories` | |
-- | |
LOCK TABLES `product_categories` WRITE; | |
/*!40000 ALTER TABLE `product_categories` DISABLE KEYS */; | |
/*!40000 ALTER TABLE `product_categories` ENABLE KEYS */; | |
UNLOCK TABLES; | |
-- | |
-- Table structure for table `product_groups` | |
-- | |
DROP TABLE IF EXISTS `product_groups`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8 */; | |
CREATE TABLE `product_groups` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`group_code` varchar(255) DEFAULT NULL, | |
`name` varchar(255) DEFAULT NULL, | |
`created_at` datetime NOT NULL, | |
`updated_at` datetime NOT NULL, | |
PRIMARY KEY (`id`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
-- | |
-- Dumping data for table `product_groups` | |
-- | |
LOCK TABLES `product_groups` WRITE; | |
/*!40000 ALTER TABLE `product_groups` DISABLE KEYS */; | |
/*!40000 ALTER TABLE `product_groups` ENABLE KEYS */; | |
UNLOCK TABLES; | |
-- | |
-- Table structure for table `products` | |
-- | |
DROP TABLE IF EXISTS `products`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8 */; | |
CREATE TABLE `products` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`code` varchar(255) DEFAULT NULL, | |
`name_th` varchar(255) DEFAULT NULL, | |
`name_eng` varchar(255) DEFAULT NULL, | |
`price` decimal(10,0) DEFAULT NULL, | |
`description` varchar(255) DEFAULT NULL, | |
`product_group_id` int(11) DEFAULT NULL, | |
`product_cat_id` int(11) DEFAULT NULL, | |
`created_at` datetime NOT NULL, | |
`updated_at` datetime NOT NULL, | |
PRIMARY KEY (`id`), | |
KEY `fk_products_productgroups_idx` (`product_group_id`), | |
KEY `fk_products_productcat_idx` (`product_cat_id`), | |
CONSTRAINT `fk_products_productcat` FOREIGN KEY (`product_cat_id`) REFERENCES `product_categories` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, | |
CONSTRAINT `fk_products_productgroups` FOREIGN KEY (`product_group_id`) REFERENCES `product_groups` (`id`) ON DELETE CASCADE ON UPDATE CASCADE | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
-- | |
-- Dumping data for table `products` | |
-- | |
LOCK TABLES `products` WRITE; | |
/*!40000 ALTER TABLE `products` DISABLE KEYS */; | |
/*!40000 ALTER TABLE `products` ENABLE KEYS */; | |
UNLOCK TABLES; | |
-- | |
-- Table structure for table `sale_lines` | |
-- | |
DROP TABLE IF EXISTS `sale_lines`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8 */; | |
CREATE TABLE `sale_lines` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`sale_line_code` varchar(255) DEFAULT NULL, | |
`sale_id` int(11) DEFAULT NULL, | |
`product_name` varchar(255) DEFAULT NULL, | |
`order_amount` int(11) DEFAULT NULL, | |
`price_unit` decimal(10,0) DEFAULT NULL, | |
`discount` decimal(10,0) DEFAULT NULL, | |
`subtotal` decimal(10,0) DEFAULT NULL, | |
`product_id` int(11) DEFAULT NULL, | |
`date` date DEFAULT NULL, | |
`created_at` datetime NOT NULL, | |
`updated_at` datetime NOT NULL, | |
PRIMARY KEY (`id`), | |
KEY `sale_id` (`sale_id`), | |
KEY `product_id` (`product_id`), | |
CONSTRAINT `sale_lines_ibfk_2` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, | |
CONSTRAINT `sale_lines_ibfk_1` FOREIGN KEY (`sale_id`) REFERENCES `sales` (`id`) ON DELETE CASCADE ON UPDATE CASCADE | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
-- | |
-- Dumping data for table `sale_lines` | |
-- | |
LOCK TABLES `sale_lines` WRITE; | |
/*!40000 ALTER TABLE `sale_lines` DISABLE KEYS */; | |
/*!40000 ALTER TABLE `sale_lines` ENABLE KEYS */; | |
UNLOCK TABLES; | |
-- | |
-- Table structure for table `sales` | |
-- | |
DROP TABLE IF EXISTS `sales`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8 */; | |
CREATE TABLE `sales` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`sale_code` varchar(255) DEFAULT NULL, | |
`date` date DEFAULT NULL, | |
`amount` decimal(10,0) DEFAULT NULL, | |
`vat_rate` decimal(10,0) DEFAULT NULL, | |
`vat_amount` decimal(10,0) DEFAULT NULL, | |
`remark` varchar(255) DEFAULT NULL, | |
`customer_id` int(11) DEFAULT NULL, | |
`time_code` varchar(255) DEFAULT NULL, | |
`user_code` varchar(255) DEFAULT NULL, | |
`created_at` datetime NOT NULL, | |
`updated_at` datetime NOT NULL, | |
PRIMARY KEY (`id`), | |
KEY `customer_id` (`customer_id`), | |
CONSTRAINT `sales_ibfk_1` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
-- | |
-- Dumping data for table `sales` | |
-- | |
LOCK TABLES `sales` WRITE; | |
/*!40000 ALTER TABLE `sales` DISABLE KEYS */; | |
/*!40000 ALTER TABLE `sales` ENABLE KEYS */; | |
UNLOCK TABLES; | |
-- | |
-- Table structure for table `schema_migrations` | |
-- | |
DROP TABLE IF EXISTS `schema_migrations`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8 */; | |
CREATE TABLE `schema_migrations` ( | |
`version` varchar(255) NOT NULL, | |
UNIQUE KEY `unique_schema_migrations` (`version`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
-- | |
-- Dumping data for table `schema_migrations` | |
-- | |
LOCK TABLES `schema_migrations` WRITE; | |
/*!40000 ALTER TABLE `schema_migrations` DISABLE KEYS */; | |
INSERT INTO `schema_migrations` VALUES ('20130115093835'),('20130116065812'),('20130116074233'),('20130116075920'),('20130116082743'),('20130116120942'),('20130116123300'),('20130116130334'); | |
/*!40000 ALTER TABLE `schema_migrations` ENABLE KEYS */; | |
UNLOCK TABLES; | |
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; | |
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; | |
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; | |
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; | |
/*!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 */; | |
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; | |
-- Dump completed on 2013-01-16 20:41:39 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment