#
# Table structure for table `altuseremail`
#

CREATE TABLE `altuseremail` (
  `id` int(11) NOT NULL auto_increment,
  `userid` int(11) NOT NULL default '0',
  `email` varchar(50) NOT NULL default '',
  `sendnotifications` tinyint(4) NOT NULL default '1',
  `sendinvoice` tinyint(4) NOT NULL default '1',
  `sendsupport` tinyint(4) NOT NULL default '0',
  PRIMARY KEY  (`id`)
) DEFAULT CHARACTER SET utf8, ENGINE=MyISAM AUTO_INCREMENT=1 ;

# --------------------------------------------------------

# --------------------------------------------------------

#
# Table structure for table `domains`
#

CREATE TABLE `domains` (
  `id` int(11) NOT NULL auto_increment,
  `DomainName` text,
  `CustomerID` int(11) default NULL,
  `UserName` text,
  `password` tinyblob NOT NULL,
  `registration_years` tinyint(4) NOT NULL default '0',
  `current` tinyint(4) NOT NULL default '1',
  `registrar_orderid` varchar(50) NOT NULL default '0',
  `status` tinyint(1) NOT NULL default '0',
  `Plan` int(11) NOT NULL default '0',
  `dateActivated` datetime default NULL,
  `controlpanel` int(11) NOT NULL default '0',
  `serverid` int(11) NOT NULL default '0',
  `server_acct_properties` TEXT default NULL,
  `domain_extra_attr` TEXT default NULL,
  `shared` tinyint(4) NOT NULL default '1',
  `promotionid` int(11) NOT NULL default '0',
  `register` TINYINT NOT NULL DEFAULT '0',
  `signup` TINYINT NOT NULL DEFAULT '0',
  `custom_price` FLOAT NOT NULL DEFAULT '0',
  `use_custom_price` TINYINT NOT NULL DEFAULT '0',
  PRIMARY KEY  (`id`),
  KEY `CustomerID` (`CustomerID`)
) DEFAULT CHARACTER SET utf8, ENGINE=MyISAM AUTO_INCREMENT=1 ;

# --------------------------------------------------------

#
# Table structure for table `user_customuserfields`
#

CREATE TABLE `user_customuserfields` (
  `userid` int(11) NOT NULL default '0',
  `customid` int(11) NOT NULL default '0',
  `value` text,
  PRIMARY KEY  (`userid`,`customid`)
) DEFAULT CHARACTER SET utf8, ENGINE=MyISAM;


#
# Table structure for table `customuserfields`
#

CREATE TABLE `customuserfields` (
  `id` int(11) NOT NULL auto_increment,
  `name` varchar(50) NOT NULL default '',
  `type` tinyint(4) NOT NULL default '0',
  `isrequired` tinyint(4) NOT NULL default '0',
  `isChangable` tinyint(4) NOT NULL default '1',
  `isAdminOnly` tinyint(4) NOT NULL default '0',
  `width` mediumint(9) NOT NULL default '20',
  `myOrder` int(11) NOT NULL default '0',
  `showcustomer` tinyint(4) NOT NULL default '1',
  `showadmin` tinyint(4) NOT NULL default '1',
  `InSignup` tinyint(1) NOT NULL default '0',
  `inSettings` smallint(6) NOT NULL default '1',
  `dropdownoptions` longtext NOT NULL,
  PRIMARY KEY  (`id`)
) DEFAULT CHARACTER SET utf8, ENGINE=MyISAM AUTO_INCREMENT=25 ;



# #########################################
# userPackage and customfield by productype
CREATE TABLE `userPackage` (
    `id` int(11) NOT NULL auto_increment,
    `userId` int(11) default NULL,
    `status` tinyint(1) NOT NULL default '0',
    `productGroupId` int(11) NOT NULL default '0',
    `productId` int(11) NOT NULL default '0',
    `useCustomPrice` TINYINT NOT NULL DEFAULT '0',
    `customPrice` FLOAT NOT NULL DEFAULT '0',
    `dateActivated` datetime default NULL,
    PRIMARY KEY (`id`),
    KEY `userId` (`userId`)
) DEFAULT CHARACTER SET utf8, ENGINE=MyISAM AUTO_INCREMENT=1;

CREATE TABLE `object_customField` (
    `objectid` int(11) NOT NULL default '0',
    `customFieldId` int(11) NOT NULL default '0',
    `value` text,
    PRIMARY KEY (`objectid`, `customFieldId`)
) DEFAULT CHARACTER SET utf8, ENGINE=MyISAM;

CREATE TABLE `customField` (
    `id` int(11) NOT NULL auto_increment,
    `groupId` tinyint(4) NOT NULL default '0',
    `subGroupId` tinyint(4) NOT NULL default '0',
    `fieldType` tinyint(4) NOT NULL default '0',
    `name` varchar(50) NOT NULL default '',
    `isRequired` tinyint(4) NOT NULL default '0',
    `isChangeable` tinyint(4) NOT NULL default '1',
    `isAdminOnly` tinyint(4) NOT NULL default '0',
    `fieldOrder` int(11) NOT NULL default '0',
    `showCustomer` tinyint(4) NOT NULL default '1',
    `showAdmin` tinyint(4) NOT NULL default '1',
    `dropDownOptions` longtext NOT NULL,
    `inSettings` smallint(6) NOT NULL default '1',
    `InSignup` tinyint(1) NOT NULL default '0',
    PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8, ENGINE=MyISAM AUTO_INCREMENT=1;
# -----------------------------------------
# #########################################

#
# Table structure for table `clients_notes`
#

CREATE TABLE `clients_notes` (
    `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
    `date` datetime NOT NULL,
    `target_id` INT NOT NULL ,
    `is_target_group` tinyint(4) NOT NULL default '0',
    `admin_id` int(11) NOT NULL,
    `note` TEXT NOT NULL ,
    `visible_client` TINYINT NOT NULL,
    `archived` TINYINT NOT NULL DEFAULT '0'
) DEFAULT CHARACTER SET utf8, ENGINE = MYISAM;

# --------------------------------------------------------

#
# Table structure for table `clients_notes_tickettypes`
#

CREATE TABLE `clients_notes_tickettypes` (
  `note_id` int(11) NOT NULL,
  `tickettype_id` int(11) NOT NULL,
  PRIMARY KEY  (`note_id`,`tickettype_id`)
) DEFAULT CHARACTER SET utf8, ENGINE=MyISAM;

# --------------------------------------------------------

#
# Table structure for table `conversation`
#

CREATE TABLE `conversation` (
  `id` int(11) NOT NULL auto_increment,
  `start_time` datetime NOT NULL,
  PRIMARY KEY  (`id`)
) DEFAULT CHARACTER SET utf8, ENGINE=MyISAM;

# --------------------------------------------------------

#
# Table structure for table `conversation_messages`
#

CREATE TABLE `conversation_messages` (
  `id` int(11) NOT NULL auto_increment,
  `conversation_id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `sent_time` datetime NOT NULL,
  `message` mediumtext NOT NULL,
  `event` int(11) default NULL,
  KEY `id` (`id`),
  KEY `conversation_id` (`conversation_id`,`user_id`)
) DEFAULT CHARACTER SET utf8, ENGINE=MyISAM;

# --------------------------------------------------------

#
# Table structure for table `conversation_participants`
#

CREATE TABLE `conversation_participants` (
  `conversation_id` int(11) NOT NULL auto_increment,
  `user_id` int(11) NOT NULL,
  `read_time` datetime NOT NULL,
  `active` tinyint(4) NOT NULL,
  `typing` tinyint(4) NOT NULL,
  `color` varchar(25) NOT NULL DEFAULT 'black',
  PRIMARY KEY  (`conversation_id`,`user_id`)
) DEFAULT CHARACTER SET utf8, ENGINE=MyISAM;