text: -- phpMyAdmin SQL Dump
  -- version 4.0.4.1
  -- http://www.phpmyadmin.net
  --
  -- 主机: 127.0.0.1:3307
  -- 生成日期: 2016 年 10 月 31 日 07:36
  -- 服务器版本: 5.5.32
  -- PHP 版本: 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 */;
  
  --
  -- 数据库: `yii2advanced`
  --
  CREATE DATABASE IF NOT EXISTS `yii2advanced` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
  USE `yii2advanced`;
  
  -- --------------------------------------------------------
  
  --
  -- 表的结构 `admin`
  --
  
  CREATE TABLE IF NOT EXISTS `admin` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `username` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
    `auth_key` varchar(32) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
    `password_hash` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
    `password_reset_token` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
    `email` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
    `status` smallint(6) NOT NULL DEFAULT '10',
    `created_at` int(11) NOT NULL,
    `updated_at` int(11) NOT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `username` (`username`),
    UNIQUE KEY `email` (`email`),
    UNIQUE KEY `password_reset_token` (`password_reset_token`)
  ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
  
  --
  -- 转存表中的数据 `admin`
  --
  
  INSERT INTO `admin` (`id`, `username`, `auth_key`, `password_hash`, `password_reset_token`, `email`, `status`, `created_at`, `updated_at`) VALUES
  (1, 'admin', 'LXrvt90YotlQ06dtlqjUC0W_J-HB1qia', '$2y$13$FoeFwg19.l4SSUkUmh5.mel9VZGjN2MYIjLaFkGLfcti2lMTetqlm', NULL, 'test1@test.com', 10, 1474964047, 1474964047);
  
  -- --------------------------------------------------------
  
  --
  -- 表的结构 `category`
  --
  
  CREATE TABLE IF NOT EXISTS `category` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `name` varchar(255) NOT NULL,
    `level` smallint(6) NOT NULL,
    PRIMARY KEY (`id`)
  ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=7 ;
  
  --
  -- 转存表中的数据 `category`
  --
  
  INSERT INTO `category` (`id`, `name`, `level`) VALUES
  (3, '洗车', 1),
  (4, '修车', 1),
  (5, '轮胎', 2),
  (6, '保养', 2);
  
  -- --------------------------------------------------------
  
  --
  -- 表的结构 `item`
  --
  
  CREATE TABLE IF NOT EXISTS `item` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `category_id` int(11) DEFAULT NULL,
    `title` varchar(255) CHARACTER SET utf8 NOT NULL,
    `content` text CHARACTER SET utf8,
    PRIMARY KEY (`id`)
  ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=4 ;
  
  --
  -- 转存表中的数据 `item`
  --
  
  INSERT INTO `item` (`id`, `category_id`, `title`, `content`) VALUES
  (1, 5, 'www', ''),
  (3, 5, '米其林轮胎', '米其林轮胎');
  
  -- --------------------------------------------------------
  
  --
  -- 表的结构 `migration`
  --
  
  CREATE TABLE IF NOT EXISTS `migration` (
    `version` varchar(180) NOT NULL,
    `apply_time` int(11) DEFAULT NULL,
    PRIMARY KEY (`version`)
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  --
  -- 转存表中的数据 `migration`
  --
  
  INSERT INTO `migration` (`version`, `apply_time`) VALUES
  ('m000000_000000_base', 1474962837),
  ('m130524_201442_init', 1474962840),
  ('m160926_084846_create_shop_table', 1474962840),
  ('m160926_090347_create_category_table', 1475027177),
  ('m160926_090435_create_shop_category_table', 1475027177),
  ('m160927_075459_create_item_table', 1475027177);
  
  -- --------------------------------------------------------
  
  --
  -- 表的结构 `shop`
  --
  
  CREATE TABLE IF NOT EXISTS `shop` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `title` varchar(255) NOT NULL,
    `content` text,
    PRIMARY KEY (`id`)
  ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=5 ;
  
  --
  -- 转存表中的数据 `shop`
  --
  
  INSERT INTO `shop` (`id`, `title`, `content`) VALUES
  (2, '金华金峰汽车修洗店', '金华金峰汽车修洗店'),
  (3, '金华快修汽车修洗店', '金华快修汽车修洗店'),
  (4, '东阳美丽修洗店', '东阳美丽修洗店');
  
  -- --------------------------------------------------------
  
  --
  -- 表的结构 `shop_category`
  --
  
  CREATE TABLE IF NOT EXISTS `shop_category` (
    `shop_id` int(11) NOT NULL DEFAULT '0',
    `category_id` int(11) NOT NULL DEFAULT '0',
    PRIMARY KEY (`shop_id`,`category_id`),
    KEY `FK_category_shop` (`category_id`)
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  --
  -- 转存表中的数据 `shop_category`
  --
  
  INSERT INTO `shop_category` (`shop_id`, `category_id`) VALUES
  (2, 3),
  (3, 3),
  (4, 3),
  (2, 4),
  (3, 4),
  (4, 4);
  
  -- --------------------------------------------------------
  
  --
  -- 表的结构 `user`
  --
  
  CREATE TABLE IF NOT EXISTS `user` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `username` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
    `auth_key` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
    `password_hash` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
    `password_reset_token` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
    `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
    `status` smallint(6) NOT NULL DEFAULT '10',
    `created_at` int(11) NOT NULL,
    `updated_at` int(11) NOT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `username` (`username`),
    UNIQUE KEY `email` (`email`),
    UNIQUE KEY `password_reset_token` (`password_reset_token`)
  ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ;
  
  --
  -- 转存表中的数据 `user`
  --
  
  INSERT INTO `user` (`id`, `username`, `auth_key`, `password_hash`, `password_reset_token`, `email`, `status`, `created_at`, `updated_at`) VALUES
  (1, 'test1', 'LXrvt90YotlQ06dtlqjUC0W_J-HB1qia', '$2y$13$FoeFwg19.l4SSUkUmh5.mel9VZGjN2MYIjLaFkGLfcti2lMTetqlm', NULL, 'test1@test.com', 10, 1474964047, 1474964047);
  
  --
  -- 限制导出的表
  --
  
  --
  -- 限制表 `shop_category`
  --
  ALTER TABLE `shop_category`
    ADD CONSTRAINT `FK_category_shop` FOREIGN KEY (`category_id`) REFERENCES `category` (`id`) ON DELETE CASCADE,
    ADD CONSTRAINT `FK_shop_category` FOREIGN KEY (`shop_id`) REFERENCES `shop` (`id`) ON DELETE CASCADE;
  
  /*!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 */;
  