
# Database : YSURVEY
# --------------------------------------------------------

#
# Table structure for table ANSWER
#

CREATE TABLE ANSWER (
  ANSWER_ID int(11) NOT NULL auto_increment,
  ANSWER_LABEL text NOT NULL,
  QUESTION_ID int(11) NOT NULL default '0',
  ANS_ORDER int(11) NOT NULL default '0',
  PRIMARY KEY  (ANSWER_ID)
) TYPE=MyISAM COMMENT='Answer options data';


#
# Table structure for table QUESTION
#

CREATE TABLE QUESTION (
  QUESTION_ID int(11) NOT NULL auto_increment,
  QUESTION_LABEL text NOT NULL,
  QUESTION_NOTE text,
  Q_TYPE_ID int(11) NOT NULL default '0',
  IS_REQUIRED tinyint(4) NOT NULL default '0',
  Q_ORDER int(11) NOT NULL default '0',
  SURVEY_ID int(11) NOT NULL default '0',
  PRIMARY KEY  (QUESTION_ID)
) TYPE=MyISAM COMMENT='Primary questions data';

#
# Table structure for table Q_TYPE
#

CREATE TABLE Q_TYPE (
  Q_TYPE_ID int(11) NOT NULL auto_increment,
  Q_TYPE varchar(255) NOT NULL default '0',
  PRIMARY KEY  (Q_TYPE_ID)
) TYPE=MyISAM COMMENT='Question types';

#
# Dumping data for table Q_TYPE
#

INSERT INTO Q_TYPE VALUES (1, 'Single-line textbox');
INSERT INTO Q_TYPE VALUES (2, 'Multi-line textbox');
INSERT INTO Q_TYPE VALUES (3, 'Pull-down menu');
INSERT INTO Q_TYPE VALUES (4, 'Radio button');
INSERT INTO Q_TYPE VALUES (5, 'Checkbox');
INSERT INTO Q_TYPE VALUES (6, 'Rating (1...5)');
# --------------------------------------------------------

#
# Table structure for table RESPONDENT
#

CREATE TABLE RESPONDENT (
  RESPONDENT_ID int(11) NOT NULL auto_increment,
  PRIMARY KEY  (RESPONDENT_ID)
) TYPE=MyISAM COMMENT='Generates id''s for respondents';

#
# Table structure for table RESPONSE
#

CREATE TABLE RESPONSE (
  RESPONSE_ID int(11) NOT NULL auto_increment,
  RESPONDENT_ID int(11) NOT NULL default '0',
  SURVEY_ID int(11) NOT NULL default '0',
  QUESTION_ID int(11) NOT NULL default '0',
  ANSWER_ID int(11) default NULL,
  ANSWER_VALUE int(11) default NULL,
  ANSWER_TEXT text,
  RESPONSE_DATE timestamp(14) NOT NULL,
  PRIMARY KEY  (RESPONSE_ID)
) TYPE=MyISAM COMMENT='Survey responses';


#
# Table structure for table SURVEY
#

CREATE TABLE SURVEY (
  SURVEY_ID int(11) NOT NULL auto_increment,
  SURVEY_NAME varchar(255) NOT NULL default '',
  SURVEY_DESC text,
  TEMPLATE_ID int(11) NOT NULL default '1',
  MULTIPLE tinyint(4) NOT NULL default '0',
  IS_ACTIVE tinyint(4) NOT NULL default '1',
  DATE_CREATED timestamp(14) NOT NULL,
  SURVEY_DONE text,
  PRIMARY KEY  (SURVEY_ID)
) TYPE=MyISAM COMMENT='Main surveys table';

# Table structure for table TEMPLATE
#

CREATE TABLE TEMPLATE (
  TEMPLATE_ID int(11) NOT NULL auto_increment,
  T_NAME varchar(255) NOT NULL default 'Default',
  T_DESC text,
  S_TITLE_FFACE varchar(25) NOT NULL default 'Times',
  S_TITLE_FSIZE tinyint(4) NOT NULL default '2',
  S_TITLE_FCOLOR varchar(10) NOT NULL default '000000',
  S_TITLE_FSTYLE varchar(25) NOT NULL default 'normal',
  S_TITLE_FWEIGHT varchar(25) NOT NULL default 'normal',
  S_TITLE_TDECOR varchar(25) NOT NULL default 'none',
  S_DESC_FFACE varchar(25) NOT NULL default 'Arial',
  S_DESC_FSIZE tinyint(4) NOT NULL default '12',
  S_DESC_FCOLOR varchar(10) NOT NULL default '000000',
  S_DESC_FSTYLE varchar(25) NOT NULL default 'normal',
  S_DESC_FWEIGHT varchar(25) NOT NULL default 'normal',
  S_DESC_TDECOR varchar(25) NOT NULL default 'none',
  Q_LBL_FFACE varchar(25) NOT NULL default 'Arial',
  Q_LBL_FSIZE tinyint(4) NOT NULL default '10',
  Q_LBL_FCOLOR varchar(10) NOT NULL default '000000',
  Q_LBL_FSTYLE varchar(25) NOT NULL default 'normal',
  Q_LBL_FWEIGHT varchar(25) NOT NULL default 'normal',
  Q_LBL_TDECOR varchar(25) NOT NULL default 'none',
  Q_NOTE_FFACE varchar(25) NOT NULL default 'Arial',
  Q_NOTE_FSIZE tinyint(4) NOT NULL default '8',
  Q_NOTE_FCOLOR varchar(10) NOT NULL default '000000',
  Q_NOTE_FSTYLE varchar(25) NOT NULL default 'normal',
  Q_NOTE_FWEIGHT varchar(25) NOT NULL default 'normal',
  Q_NOTE_TDECOR varchar(25) NOT NULL default 'none',
  A_LBL_FFACE varchar(25) NOT NULL default 'Arial',
  A_LBL_FSIZE tinyint(4) NOT NULL default '10',
  A_LBL_FCOLOR varchar(10) NOT NULL default '000000',
  A_LBL_FSTYLE varchar(25) NOT NULL default 'normal',
  A_LBL_FWEIGHT varchar(25) NOT NULL default 'normal',
  A_LBL_TDECOR varchar(25) NOT NULL default 'none',
  S_BGCOLOR varchar(10) NOT NULL default 'FFFFFF',
  PRIMARY KEY  (TEMPLATE_ID)
) TYPE=MyISAM COMMENT='Templates data';

#
# Dumping data for table TEMPLATE
#

INSERT INTO TEMPLATE VALUES (1, 'Default', 'Default Template', 'Arial', 18, '000000', 'normal', 'normal', 'none', 'Arial', 12, '000000', 'normal', 'normal', 'none', 'Arial', 10, '000000', 'normal', 'normal', 'none', 'Arial', 8, '000000', 'normal', 'normal', 'none', 'Arial', 10, '000000', 'normal', 'normal', 'none', 'FFFFFF');

#
# Table structure for table INSTALL
#

CREATE TABLE INSTALL (
  DB_NAME varchar(255) NOT NULL default '',
  INSTALL_DIR text NOT NULL default '',
  VERSION varchar(255) NOT NULL default '1.0'
) TYPE=MyISAM;

#
# Dumping data for table INSTALL
#

INSERT INTO INSTALL (DB_NAME, INSTALL_DIR, VERSION) VALUES ('$dbname', '$install_dir', '1.0')
# --------------------------------------------------------


    

