-- MySQL Script generated by MySQL Workbench
-- 12/15/15 10:33:44
-- Model: New Model    Version: 1.0
-- MySQL Workbench Forward Engineering

SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';

-- -----------------------------------------------------
-- Schema mydb
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema olrenting
-- -----------------------------------------------------

-- -----------------------------------------------------
-- Schema olrenting
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `olrenting` DEFAULT CHARACTER SET latin1 ;
USE `olrenting` ;

-- -----------------------------------------------------
-- Table `olrenting`.`admin`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `olrenting`.`admin` (
  `id` INT(11) NOT NULL AUTO_INCREMENT,
  `user` VARCHAR(32) NULL DEFAULT NULL,
  `password` VARCHAR(32) NULL DEFAULT NULL,
  PRIMARY KEY (`id`))
ENGINE = InnoDB
AUTO_INCREMENT = 2
DEFAULT CHARACTER SET = utf8;


-- -----------------------------------------------------
-- Table `olrenting`.`city`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `olrenting`.`city` (
  `id` INT(11) NOT NULL AUTO_INCREMENT,
  `city` VARCHAR(30) NOT NULL,
  `parentid` INT(11) NOT NULL DEFAULT '0',
  `layer` TINYINT(4) NOT NULL DEFAULT '1',
  `sort` TINYINT(4) NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`))
ENGINE = InnoDB
AUTO_INCREMENT = 10
DEFAULT CHARACTER SET = utf8;


-- -----------------------------------------------------
-- Table `olrenting`.`communicate`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `olrenting`.`communicate` (
  `id` INT(11) NOT NULL AUTO_INCREMENT,
  `userid` INT(11) NOT NULL,
  `time` VARCHAR(20) NOT NULL DEFAULT '0',
  `content` TEXT NULL DEFAULT NULL,
  PRIMARY KEY (`id`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8;


-- -----------------------------------------------------
-- Table `olrenting`.`crafts`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `olrenting`.`crafts` (
  `id` INT(11) NOT NULL,
  `name` VARCHAR(45) NULL DEFAULT NULL,
  `type` VARCHAR(45) NULL DEFAULT NULL,
  `price` INT(11) NULL DEFAULT NULL,
  `color` VARCHAR(45) NULL DEFAULT NULL,
  `seller` VARCHAR(45) NULL DEFAULT NULL,
  `selleradd` VARCHAR(45) NULL DEFAULT NULL,
  `phone` VARCHAR(45) NULL DEFAULT NULL,
  `title` VARCHAR(45) NULL DEFAULT NULL,
  `store` VARCHAR(45) NULL DEFAULT NULL,
  `description` VARCHAR(45) NULL DEFAULT NULL,
  `img` VARCHAR(100) NULL DEFAULT NULL,
  PRIMARY KEY (`id`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8;


-- -----------------------------------------------------
-- Table `olrenting`.`groupchou`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `olrenting`.`groupchou` (
  `id` INT(11) NOT NULL AUTO_INCREMENT,
  `name` VARCHAR(45) NULL DEFAULT NULL,
  `hasChou` INT(11) NULL DEFAULT NULL,
  `participate_num` INT(11) NULL DEFAULT NULL,
  `title` VARCHAR(45) NULL DEFAULT NULL,
  `description` VARCHAR(100) NULL DEFAULT NULL,
  `time1` VARCHAR(45) NULL DEFAULT NULL,
  `time2` VARCHAR(45) NULL DEFAULT NULL,
  `img` VARCHAR(45) NULL DEFAULT NULL,
  PRIMARY KEY (`id`))
ENGINE = InnoDB
AUTO_INCREMENT = 6
DEFAULT CHARACTER SET = utf8;


-- -----------------------------------------------------
-- Table `olrenting`.`item`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `olrenting`.`item` (
  `id` INT(11) NOT NULL AUTO_INCREMENT,
  `title` VARCHAR(100) NOT NULL,
  `pic` VARCHAR(100) NOT NULL,
  `class` INT(11) NOT NULL DEFAULT '0',
  `intro` TEXT NULL DEFAULT NULL,
  `money` INT(11) NOT NULL,
  `time` INT(11) NOT NULL DEFAULT '0',
  `deposit` INT(11) NOT NULL,
  `seller` INT(11) NOT NULL,
  `state` TINYINT(4) NOT NULL DEFAULT '2',
  `new` TINYINT(4) NOT NULL DEFAULT '11',
  `content` TEXT NULL DEFAULT NULL,
  `city` INT(11) NOT NULL,
  `address` VARCHAR(100) NULL DEFAULT NULL,
  PRIMARY KEY (`id`))
ENGINE = InnoDB
AUTO_INCREMENT = 3
DEFAULT CHARACTER SET = utf8;


-- -----------------------------------------------------
-- Table `olrenting`.`member`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `olrenting`.`member` (
  `id` INT(11) NOT NULL AUTO_INCREMENT,
  `username` VARCHAR(100) NOT NULL,
  `password` VARCHAR(100) NOT NULL,
  `Email` VARCHAR(50) NOT NULL DEFAULT '0',
  `type` TINYINT(4) NOT NULL DEFAULT '0',
  `money` INT(11) NOT NULL DEFAULT '0',
  `bgood` INT(11) NOT NULL DEFAULT '0',
  `baverage` INT(11) NOT NULL DEFAULT '0',
  `bbad` INT(11) NOT NULL DEFAULT '0',
  `sgood` INT(11) NOT NULL DEFAULT '0',
  `saverage` INT(11) NOT NULL DEFAULT '0',
  `sbad` INT(11) NOT NULL DEFAULT '0',
  `name` VARCHAR(20) NULL DEFAULT NULL,
  `phone` VARCHAR(20) NULL DEFAULT NULL,
  `qq` VARCHAR(15) NULL DEFAULT NULL,
  `level` INT(11) NULL DEFAULT '0',
  `img` VARCHAR(45) NULL DEFAULT 'style/images/noavatar_middle.gif',
  PRIMARY KEY (`id`),
  UNIQUE INDEX `username` (`username` ASC))
ENGINE = InnoDB
AUTO_INCREMENT = 8
DEFAULT CHARACTER SET = utf8;


-- -----------------------------------------------------
-- Table `olrenting`.`member_has_chou`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `olrenting`.`member_has_chou` (
  `id` INT(11) NOT NULL AUTO_INCREMENT,
  `membername` VARCHAR(45) NULL DEFAULT NULL,
  `groupid` INT(11) NULL DEFAULT NULL,
  `money` INT(11) NULL DEFAULT NULL,
  PRIMARY KEY (`id`))
ENGINE = InnoDB
AUTO_INCREMENT = 139
DEFAULT CHARACTER SET = latin1;


-- -----------------------------------------------------
-- Table `olrenting`.`order`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `olrenting`.`order` (
  `id` INT(11) NOT NULL AUTO_INCREMENT,
  `productName` VARCHAR(20) NOT NULL,
  `price` INT(11) NOT NULL,
  `number` INT(11) NOT NULL,
  `state` TINYINT(4) NOT NULL DEFAULT '0',
  `buyername` VARCHAR(20) NULL DEFAULT NULL,
  `buyerphone` VARCHAR(20) NULL DEFAULT NULL,
  `buyeraddress` VARCHAR(30) NULL DEFAULT NULL,
  `sellername` VARCHAR(20) NULL DEFAULT NULL,
  `sellerphone` VARCHAR(20) NULL DEFAULT NULL,
  `selleraddress` VARCHAR(30) NULL DEFAULT NULL,
  `comments` TEXT NULL DEFAULT NULL,
  `time1` VARCHAR(20) NOT NULL DEFAULT '0',
  `time2` VARCHAR(20) NOT NULL DEFAULT '0',
  `time3` VARCHAR(20) NOT NULL DEFAULT '0',
  `time4` VARCHAR(20) NOT NULL DEFAULT '0',
  `bcomment` TEXT NULL DEFAULT NULL,
  `somment` TEXT NULL DEFAULT NULL,
  PRIMARY KEY (`id`))
ENGINE = InnoDB
AUTO_INCREMENT = 54
DEFAULT CHARACTER SET = utf8;


-- -----------------------------------------------------
-- Table `olrenting`.`sort`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `olrenting`.`sort` (
  `id` INT(11) NOT NULL AUTO_INCREMENT,
  `name` VARCHAR(20) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`))
ENGINE = InnoDB
AUTO_INCREMENT = 9
DEFAULT CHARACTER SET = utf8;


-- -----------------------------------------------------
-- Table `olrenting`.`store`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `olrenting`.`store` (
  `id` INT(11) NOT NULL AUTO_INCREMENT,
  `itemid` INT(11) NOT NULL,
  `userid` INT(11) NOT NULL,
  PRIMARY KEY (`id`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8;


SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
