# --------------------------------------------------------
#
# SiLogbook version 0.4.0
#

# --------------------------------------------------------
#
# Table structure for table 'dmmime';
#

DROP TABLE IF EXISTS dmmime;
CREATE TABLE dmmime
(
  id SMALLINT(4) UNSIGNED NOT NULL AUTO_INCREMENT,
  mtype VARCHAR(255) NOT NULL,
  mcomm VARCHAR(255) NOT NULL,
  imgname VARCHAR(255) DEFAULT '' NOT NULL,
  PRIMARY KEY (id)
);

#
# id - MIME type ID;
# mtype - MIME type;
# mcomm - MIME type description;
#

#
# Dumping default data for table 'dmmime'
#

INSERT INTO dmmime (mtype,mcomm) VALUES ('application/pdf','PDF File');
INSERT INTO dmmime (mtype,mcomm) VALUES ('application/x-zip','ZIP File');
INSERT INTO dmmime (mtype,mcomm) VALUES ('image/gif','GIF Image');
INSERT INTO dmmime (mtype,mcomm) VALUES ('image/jpeg','JPEG Image');
INSERT INTO dmmime (mtype,mcomm) VALUES ('image/pjpeg','PJPEG Image');
INSERT INTO dmmime (mtype,mcomm) VALUES ('image/png','PNG Image');
INSERT INTO dmmime (mtype,mcomm) VALUES ('text/html','HTML Text');
INSERT INTO dmmime (mtype,mcomm) VALUES ('text/plain','Plain Text');

# --------------------------------------------------------
#
# Table structure for table 'lbnotes';
#

DROP TABLE IF EXISTS lbnotes;
CREATE TABLE lbnotes
(
  id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT,
  subject VARCHAR(255) DEFAULT '' NOT NULL,
  category SMALLINT(4) UNSIGNED DEFAULT '0' NOT NULL,
  dgroup SMALLINT(4) UNSIGNED DEFAULT '0' NOT NULL,
  downer SMALLINT(4) UNSIGNED DEFAULT '0' NOT NULL,
  created DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL,
  docname VARCHAR(255) DEFAULT '' NOT NULL,
  doctype SMALLINT(4) UNSIGNED DEFAULT '0' NOT NULL,
  formid SMALLINT(4) UNSIGNED DEFAULT '0' NOT NULL,
  note LONGTEXT DEFAULT '' NOT NULL,
  PRIMARY KEY (id)
);

#
# id - Document ID;
# category - Category ID, from "dmcat" table;
# dgroup - Group ID, from "dmgroup" table;
# downer - Owner's user ID, from "dmuser" table;
# realname - The original name of the file, * = new document awaiting for first check in;
# created - Date on which file was first checked in;
# description - Description of contents;
# status - Check in/out status, from "dmuser" table; 0 = available, User ID = user document is checked out to;
# docver - Document version;
# doctype - Document MIME type, from "dmmime" table;
# docpos - Position ID, from "dmpos" table;
# docwf - Workflow ID of next action, from "dmwflow" table; 0 = no workflow;
# wfid - Workflow ID of current action, from "dmwflow" table; 0 = no workflow;
# comment - Author's note;
#

# --------------------------------------------------------
#
# Table structure for table 'lbindex';
#

DROP TABLE IF EXISTS lbindex;
CREATE TABLE lbindex
(
  id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT,
  noteid INT(4) UNSIGNED DEFAULT '0' NOT NULL,
  subject VARCHAR(255) DEFAULT '' NOT NULL,
  category SMALLINT(4) UNSIGNED DEFAULT '0' NOT NULL,
  dgroup SMALLINT(4) UNSIGNED DEFAULT '0' NOT NULL,
  PRIMARY KEY (id)
);

#
# id - Revision ID;
# docid - Document ID, from "lbnotes" table;
# modified - Date of revision;
# duser - ID of user modifying file;
# revname - The original name of the file;
# revver - Document version;
# revtype - Document MIME type, from "dmmime" table;
# wfid - Workflow ID, from "dmwflow" table;
# note - Description of modification;
#

# --------------------------------------------------------
#
# Table structure for table 'lbforms';
#

DROP TABLE IF EXISTS lbforms;
CREATE TABLE lbforms
(
  id SMALLINT(4) UNSIGNED NOT NULL AUTO_INCREMENT,
  description VARCHAR(255) DEFAULT '' NOT NULL,
  formname VARCHAR(255) NOT NULL,
  PRIMARY KEY (id)
);

#
# docid - Document ID, from "lbnotes" table;
# wfid - Workflow ID, from "dmwflow" table;
# uid - User ID, from "dmuser" table;
# status - '0' = not checked, '1' = approved, '2' = not approved;
#

# --------------------------------------------------------
#
# Table structure for table 'lboptions';
#

DROP TABLE IF EXISTS lboptions;
CREATE TABLE lboptions
(
  id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT,
  formid INT(4) UNSIGNED DEFAULT '0' NOT NULL,
  optsid VARCHAR(255) DEFAULT '' NOT NULL,
  optext VARCHAR(255) DEFAULT '' NOT NULL,
  PRIMARY KEY (id)
);
