DROP DATABASE IF EXISTS upt;
CREATE DATABASE upt;
USE upt;

CREATE TABLE tuser (
  user_number varchar(20) NOT NULL,
  user_passwd varchar(20) NOT NULL,
  phone_number varchar(20) NOT NULL,
  areanum varchar(10) NOT NULL,
  agentnum varchar(10) NOT NULL,
  user_state int(4) NOT NULL default '0',
  ring_type int(4) NOT NULL default '0',
  PRIMARY KEY  (user_number)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

INSERT INTO tuser (user_number,user_passwd,phone_number,areanum,agentnum,user_state,ring_type) VALUES ('12345678','111111','131111111','010','CMCC',1,0);


CREATE TABLE tbindphone (
  id bigint(11) NOT NULL auto_increment,
  user_number varchar(20) NOT NULL,
  bind_phone varchar(20) NOT NULL,
  phone_state int(4) NOT NULL default '0',
  callout_flag int(4) NOT NULL default '0',
  answer_flag int(4) NOT NULL default '0',
  show_flag int(4) NOT NULL default '0',
  pri_order int(4) NOT NULL default '0',
  PRIMARY KEY  (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


CREATE TABLE tcalltimelimit (
  id bigint(11) NOT NULL auto_increment,
  user_number varchar(20) NOT NULL,
  limit_type int(4) NOT NULL default '0',
  start_time varchar(6) NOT NULL,
  end_time varchar(6) NOT NULL,
  PRIMARY KEY  (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


CREATE TABLE tcallbarring (
  id bigint(11) NOT NULL auto_increment,
  user_number varchar(20) NOT NULL,
  limit_phone varchar(20) NOT NULL,
  limit_type int(4) NOT NULL default '0',
  description varchar(255) default NULL,
  PRIMARY KEY  (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

