-- MySQL Script generated by MySQL Workbench
-- 05/09/16 11:06:42
-- 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 dada
-- -----------------------------------------------------

-- -----------------------------------------------------
-- Schema dada
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `dada` DEFAULT CHARACTER SET utf8;
USE `dada` ;

-- -----------------------------------------------------
-- Table `dada`.`common_member`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `dada`.`user` ;

CREATE TABLE IF NOT EXISTS `dada`.`forum_user` (
  `uid` INT  NOT NULL AUTO_INCREMENT,
  `userName` CHAR(35) NOT NULL,
  `password` CHAR(32) NOT NULL,
  `email` CHAR(40),
  `status` BIT NOT NULL DEFAULT 0,
  `emailStatus` BIT NOT NULL DEFAULT 0,
  `regDate` CHAR(20) NOT NULL,
  `credits` INT NOT NULL DEFAULT 0,
  `points` INT NOT NULL DEFAULT 0,
  `lastLoginTime` CHAR(20) NULL,
  `lastLoginIp` CHAR(15) NULL,
  `photo` VARCHAR(255) NULL,
  PRIMARY KEY (`uid`))
ENGINE = MyISAM
DEFAULT CHARACTER SET = utf8;

-- -----------------------------------------------------
-- Table `dada`.`forum_post`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `dada`.`forum_post` ;

CREATE TABLE IF NOT EXISTS `dada`.`forum_post` (
  `pid` INT NOT NULL AUTO_INCREMENT,
  `tid` INT NOT NULL DEFAULT 0,
  `userName` CHAR(35) NULL,
  `uid` INT NULL,
  `dateLine` CHAR(20) NOT NULL,
  `message` MEDIUMTEXT NOT NULL,
  `postIp` CHAR(15) NULL,
  `invisible` BIT NOT NULL DEFAULT 0,
  `anonymous` BIT NOT NULL DEFAULT 0,
  `status` BIT NOT NULL DEFAULT 0,
  `tags` VARCHAR(255) NULL,
  `ppid` INT NULL,
  `puserName` CHAR(35)  NULL,
  `puid` INT NULL,
  `photo` VARCHAR(255) NULL,

  PRIMARY KEY (`pid`))
ENGINE = MyISAM
DEFAULT CHARACTER SET = utf8;


-- -----------------------------------------------------
-- Table `dada`.`forum_topic`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `dada`.`forum_topic` ;

CREATE TABLE IF NOT EXISTS `dada`.`forum_topic` (
  `tid` INT  NOT NULL AUTO_INCREMENT,
  `readPerm` INT  NOT NULL DEFAULT 0,
  `userName` CHAR(35) NOT NULL,
  `uid` INT  NOT NULL,
  `subject` CHAR(80) NOT NULL,
  `message` MEDIUMTEXT NOT NULL,
  `dateLine` CHAR(20)  NOT NULL,
  `lastPostDate` CHAR(20)  NOT NULL,
  `lastPoster` CHAR(35) NOT NULL,
  `views` INT NOT NULL DEFAULT 0,
  `replies` INT  NOT NULL DEFAULT 0,
  `displayOrder` INT NOT NULL DEFAULT 0,
  `highLight` BIT NOT NULL DEFAULT 0,
  `digest` BIT NOT NULL DEFAULT 0,
  `closed` INT  NOT NULL DEFAULT 0,
  `stickReply` BIT  NOT NULL DEFAULT 0,
  `status` INT  NOT NULL DEFAULT 0,
  `favTimes` INT NOT NULL DEFAULT 0,
  `shareTimes` INT NOT NULL DEFAULT 0,
  `stamp` INT NULL,
  `icon` INT NULL,
  PRIMARY KEY (`tid`))
ENGINE = MyISAM
DEFAULT CHARACTER SET = utf8;


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


--20160926 ALTER TABLE forum_user ADD points INT NOT NULL DEFAULT 0;
