CREATE TABLE `announcement` (
  `id` int(11) NOT NULL auto_increment,
  `title` varchar(125) NOT NULL default '',
  `excerpt` text NOT NULL,
  `post` longtext NOT NULL,
  `postdate` datetime NULL default '0000-00-00 00:00:00',
  `publish` tinyint(4) NOT NULL default '0',
  `authorid` int(11) NOT NULL default '0',
  `recipient` tinyint(4) NOT NULL default '0',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM;

CREATE TABLE `announcement_recipient` (
    `ann_id` INT NOT NULL ,
    `recipient_id` INT NOT NULL ,
    PRIMARY KEY ( `ann_id` , `recipient_id` )
) ENGINE=MYISAM ;


CREATE TABLE `services_log` (
  `id` int(11) NOT NULL auto_increment,
  `plugin` varchar(50) NOT NULL default '',
  `time` datetime NOT NULL default '0000-00-00 00:00:00',
  `manually_executed` smallint(6) NOT NULL default '0',
  `results` text NOT NULL,
  `errors` text NOT NULL,
  `status` text,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM;

CREATE TABLE `billingtype` (
  `id` int(11) NOT NULL auto_increment,
  `name` varchar(25) NOT NULL default '',
  `description` text NOT NULL,
  `detail` text NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=7 ;

CREATE TABLE `coupons` (
  `coupons_id` int(11) NOT NULL auto_increment,
  `coupons_name` varchar(50) NOT NULL default '',
  `coupons_description` text NOT NULL,
  `coupons_code` varchar(50) NOT NULL default '',
  `coupons_quantity` int(11) NOT NULL default '0',
  `coupons_type` tinyint(4) NOT NULL default '0',
  `coupons_applicable_to` tinyint(4) NOT NULL default '127',
  `coupons_discount` float NOT NULL default '0',
  `coupons_start` date NOT NULL default '0000-00-00',
  `coupons_expires` date NOT NULL default '0000-00-00',
  `coupons_recurring` tinyint(4) NOT NULL default '0',
  `coupons_recurringmonths` tinyint(4) NOT NULL default '0',
  `coupons_billingcycles` tinyint(4) NOT NULL default '0',
  `coupons_archive` tinyint(1) NOT NULL default '0',
  `coupons_taxable` tinyint(4) NOT NULL default '1',
  PRIMARY KEY  (`coupons_id`)
) ENGINE=MyISAM;

CREATE TABLE `coupons_usage` (
  `invoiceentryid` INT(11) NOT NULL ,
  `couponid` INT(11) NOT NULL ,
  `isrecurring` tinyint(1) NOT NULL,
  PRIMARY KEY ( `invoiceentryid` , `couponid`, `isrecurring` )
) ENGINE=MYISAM ;

CREATE TABLE `coupons_packages` (
  `id` int(11) NOT NULL auto_increment,
  `coupons_id` int(11) NOT NULL default '0',
  `promotion_id` int(11) NOT NULL default '0',
  `package_id` int(11) NOT NULL default '0',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM;

CREATE TABLE `currency` (
  `id` int(11) NOT NULL auto_increment,
  `name` varchar(250) NOT NULL default '',
  `symbol` char(3) NOT NULL default '',
  `abrv` varchar(4) NOT NULL default '',
  `alignment` varchar(10) NOT NULL default 'left',
  `precision` int(1) NOT NULL default '2',
  KEY `id` (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=18 ;

CREATE TABLE `customdomainfields` (
  `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` tinyint(4) NOT NULL default '20',
  `myOrder` int(11) NOT NULL default '0',
  `showcustomer` tinyint(4) NOT NULL default '0',
  `showadmin` tinyint(4) NOT NULL default '0',
  `dropdownoptions` longtext NOT NULL,
  `inSettings` tinyint(4) NOT NULL default '1',
  `InSignup` tinyint(4) NOT NULL default '0',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 ;

CREATE TABLE `domain_customdomainfields` (
  `userid` int(11) NOT NULL default '0',
  `customid` int(11) NOT NULL default '0',
  `value` text,
  PRIMARY KEY  (`userid`,`customid`)
) ENGINE=MyISAM;

CREATE TABLE `domain_packageaddon_prices` (
    `domain_id` int(11) NOT NULL default '0',
    `packageaddon_prices_id` int(11) NOT NULL default '0',
    `billing_cycle` tinyint(4) NOT NULL default '0',
    `nextbilldate` date default NULL,
    PRIMARY KEY  (`domain_id`,`packageaddon_prices_id`)
) ENGINE=MyISAM;

CREATE TABLE `email_queue` (
  `id` int(11) NOT NULL auto_increment,
  `subject` varchar(255) NOT NULL default '',
  `from` varchar(50) NOT NULL default '',
  `from_name` varchar(50) NOT NULL default '',
  `bcc` text NOT NULL,
  `priority` tinyint(4) NOT NULL default '0',
  `confirmreceipt` tinyint(4) NOT NULL default '0',
  `emailtype` varchar(50) NOT NULL default '',
  `body` text NOT NULL,
  `contenttype` tinyint(4) NOT NULL default '0',
  `dfilename` varchar(50) NOT NULL default '',
  `attachment` longtext NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM;

CREATE TABLE `groups` (
  `id` int(11) NOT NULL auto_increment,
  `name` varchar(50) NOT NULL,
  `isadmin` tinyint(4) NOT NULL default '1',
  `issuperadmin` tinyint(4) NOT NULL default '0',
  `description` text NOT NULL,
  `usedefaultcolor` tinyint(4) NOT NULL default '1',
  `groupcolor` varchar(7),
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM;

CREATE TABLE `email_queue_addressees` (
    `email_queue_id` INT NOT NULL ,
    `userid` INT NOT NULL ,
    PRIMARY KEY ( `email_queue_id` , `userid` )
) ENGINE = MYISAM ;

CREATE TABLE `help` (
  `id` int(11) NOT NULL auto_increment,
  `title` varchar(40) NOT NULL default '',
  `detail` text NOT NULL,
  `linkwords` varchar(40) NOT NULL default 'Click to view available tags',
  `width` int(3) NOT NULL default '240',
  `height` int(3) NOT NULL default '320',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `id` (`id`),
  KEY `id_2` (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=8 ;

CREATE TABLE `invoice` (
  `id` int(11) NOT NULL auto_increment,
  `customerid` int(11) NOT NULL default '0',
  `billdate` date NOT NULL default '0000-00-00',
  `description` varchar(50) NOT NULL default '',
  `amount` float NOT NULL default '0',
  `subtotal` float NOT NULL default '0',
  `sent` tinyint(4) NOT NULL default '0',
  `status` tinyint(4) NOT NULL default '0',
  `archive` tinyint(4) NOT NULL default '0',
  `sentdate` date default NULL,
  `datepaid` date default NULL,
  `tax` float NOT NULL default '0',
  `processorid` varchar(255) NOT NULL default '',
  `pluginused` VARCHAR( 15 ) DEFAULT 'none' NOT NULL,
  `checknum` VARCHAR( 50 ) NOT NULL ,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `id` (`id`),
  INDEX ( `customerid` )
) ENGINE=MyISAM AUTO_INCREMENT=1 ;

CREATE TABLE `invoiceentry` (
  `id` int(11) NOT NULL auto_increment,
  `customerid` int(11) NOT NULL default '0',
  `description` varchar(95) NOT NULL default '',
  `detail` text NOT NULL,
  `invoiceid` int(11) NOT NULL default '0',
  `date` date NOT NULL default '0000-00-00',
  `billingtypeid` int(11) NOT NULL default '0',
  `is_prorating` tinyint(4) NOT NULL default '0',
  `price` float NOT NULL default '0',
  `price_percent` float NOT NULL default '0',
  `recurring` int(11) NOT NULL default '0',
  `recurringappliesto` int(11) default '0',
  `appliestoid` int(11) NOT NULL default '0',
  `coupon_applicable_to` tinyint(4) NOT NULL default '0',
  `includenextpayment` tinyint(4) NOT NULL default '0',
  `paymentterm` tinyint(4) NOT NULL default '0',
  `setup` tinyint(4) NOT NULL default '0',
  `addon_setup` tinyint(4) NOT NULL default '0',
  `taxable` tinyint(4) NOT NULL default '0',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM COMMENT='Maintain information of work completed for customer' AUTO_INCREMENT=1 ;

CREATE TABLE `invoicetransaction` (
  `id` int(11) NOT NULL auto_increment,
  `invoiceid` int(11) NOT NULL default '0',
  `accepted` tinyint(4) NOT NULL default '0',
  `response` text NOT NULL,
  `transactiondate` datetime NOT NULL default '0000-00-00 00:00:00',
  `transactionid` VARCHAR( 25 ) DEFAULT 'NA' NOT NULL,
  `action` VARCHAR( 10 ) DEFAULT 'none' NOT NULL,
  `last4` VARCHAR( 5 ) DEFAULT '0000' NOT NULL,
  `amount` FLOAT DEFAULT '0.0' NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 ;


CREATE TABLE `nameserver` (
  `id` int(11) NOT NULL auto_increment,
  `serverid` int(11) NOT NULL default '0',
  `ip` varchar(50) NOT NULL default '',
  `hostname` varchar(50) NOT NULL default '',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 ;


CREATE TABLE `package` (
  `id` int(11) NOT NULL auto_increment,
  `planname` varchar(45) NOT NULL default '',
  `description` text NOT NULL,
  `planid` int(11) NOT NULL default '0',
  `price` float NOT NULL default '0',
  `showpackage` smallint(6) NOT NULL default '1',
  `price3` float NOT NULL default '0',
  `price6` float NOT NULL default '0',
  `price12` float NOT NULL default '0',
  `price24` float NOT NULL default '0',
  `price1included` tinyint(4) NOT NULL default '1',
  `price3included` tinyint(4) NOT NULL default '1',
  `price6included` tinyint(4) NOT NULL default '1',
  `price12included` tinyint(4) NOT NULL default '1',
  `price24included` tinyint(4) NOT NULL default '1',
  `setup` float NOT NULL default '0',
  `usedefaultwelcome` tinyint(4) NOT NULL default '1',
  `welcomeemail_text` text NOT NULL,
  `welcomeemail_html` text NOT NULL,
  `welcomeemail_subject` varchar(50) NOT NULL,
  `taxable` tinyint(4) NOT NULL default '0',
  `style` tinyint(4) default '0',
  `automaticactivation` tinyint(4) default '1',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `id` (`id`),
  KEY `id_2` (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=14 ;

CREATE TABLE `package_variable` (
  `packageid` int(11) NOT NULL default '0',
  `varname` varchar(50) NOT NULL default '',
  `value` varchar(200) NOT NULL default '',
  PRIMARY KEY  (`packageid`,`varname`)
) ENGINE=MyISAM;

CREATE TABLE `packageaddon` (
    `id` INT NOT NULL AUTO_INCREMENT ,
    `package_id` INT NOT NULL ,
    `name` varchar(50) NOT NULL,
    `description` text NOT NULL,
    `plugin_var` VARCHAR( 50 ) NOT NULL ,
    `order` int(11) NOT NULL default '0',
    `taxable` tinyint(4) NOT NULL default '0',
    PRIMARY KEY ( `id` )
) ENGINE=MyISAM;

CREATE TABLE `packageaddon_prices` (
    `id` int(11) NOT NULL auto_increment,
    `packageaddon_id` int(11) NOT NULL default '0',
    `sortkey` int(11) NOT NULL default '0',
    `detail` varchar(50) NOT NULL default '',
    `plugin_var_value` varchar(50) NOT NULL default '',
    `price0` float NOT NULL default '-1',
    `price1` float NOT NULL default '-1',
    `price1_force` smallint(6) NOT NULL default '0',
    `price3` float NOT NULL default '-1',
    `price3_force` smallint(6) NOT NULL default '0',
    `price6` float NOT NULL default '-1',
    `price6_force` tinyint(4) NOT NULL default '0',
    `price12` float NOT NULL default '-1',
    `price12_force` tinyint(4) NOT NULL default '0',
    `price24` float NOT NULL default '-1',
    `price24_force` tinyint(4) NOT NULL default '0',
    PRIMARY KEY  (`id`)
) ENGINE=MyISAM;

CREATE TABLE `package_server` (
  `id` int(11) NOT NULL auto_increment,
  `package_id` int(11) NOT NULL default '0',
  `server_id` int(11) NOT NULL default '0',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM;

CREATE TABLE `promotion` (
  `id` int(11) NOT NULL auto_increment,
  `code` varchar(20) NOT NULL default '',
  `description` text NOT NULL,
  `active` tinyint(4) NOT NULL default '1',
  `showuser` tinyint(4) NOT NULL default '1',
  `welcomeemail_text` text NOT NULL,
  `welcomeemail_html` text NOT NULL,
  `welcomeemail_subject` varchar(50) NOT NULL,
  `isdefault` smallint(1) NOT NULL default '0',
  `name` varchar(50) NOT NULL default '',
  `regdomain` smallint(1) NOT NULL default '1',
  `issub` tinyint(4) NOT NULL default '0',
  `maindomain` varchar(50) NOT NULL default 'yourdomain.com',
  `allowreg` tinyint(4) NOT NULL default '1',
  `allowtransfer` tinyint(4) NOT NULL default '0',
  `allowselfmanage` tinyint(4) NOT NULL default '1',
  `promorder` int(11) NOT NULL ,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=6 ;

CREATE TABLE `promotion_customdomainfields` (
`promotionid` INT NOT NULL ,
`customid` INT NOT NULL
) ENGINE = MYISAM ;

CREATE TABLE `recurringfee` (
  `id` int(11) NOT NULL auto_increment,
  `customerid` int(11) NOT NULL default '0',
  `billingtypeid` int(11) NOT NULL default '0',
  `packageaddon_prices_id` int(11) NOT NULL default '0',
  `description` text default NULL,
  `detail` text default NULL,
  `amount` float NOT NULL default '0',
  `amount_percent` float NOT NULL default '0',
  `appliestoid` int(11) NOT NULL default '0',
  `coupon_applicable_to` tinyint(4) NOT NULL default '0',
  `nextbilldate` date default NULL,
  `paymentterm` tinyint(4) default NULL,
  `disablegenerate` tinyint(4) NOT NULL default '0',
  `taxable` tinyint(4) NOT NULL default '0',
  `monthlyusage` text default NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `id` (`id`),
  KEY `id_2` (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 ;

CREATE TABLE `registrars` (
    `plugin` VARCHAR( 20 ) NOT NULL ,
    `tld` VARCHAR( 10 ) NOT NULL ,
    `extra_attributes` TEXT NOT NULL ,
    PRIMARY KEY ( `plugin` , `tld` )
);

CREATE TABLE `report` (
    `name` VARCHAR( 80 ) NOT NULL ,
    `public` TINYINT DEFAULT '0' NOT NULL ,
    `quickgraph` TINYINT DEFAULT '0' NOT NULL ,
    `dashboard` TINYINT DEFAULT '0' NOT NULL ,
    PRIMARY KEY ( `name` )
);

CREATE TABLE `server` (
  `id` int(11) NOT NULL auto_increment,
  `name` varchar(25) NOT NULL default '',
  `hostname` varchar(50) NOT NULL default '',
  `sharedip` varchar(50) NOT NULL default '',
  `isdefault` tinyint(1) NOT NULL default '0',
  `plugin` varchar(25) NOT NULL default '',
  `last_utilization` datetime NOT NULL default '0000-00-00 00:00:00',
  `domains_quota` int(11) NOT NULL default '0',
  `statsurl` VARCHAR( 225 ) NOT NULL ,
  `statsviewable` TINYINT DEFAULT '0' NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM;

CREATE TABLE `serverip` (
  `serverid` int(11) NOT NULL default '0',
  `ip` varchar(50) NOT NULL default ''
) ENGINE=MyISAM;

CREATE TABLE `serverplugin_options` (
  `serverid` int(11) NOT NULL default '0',
  `optionname` varchar(125) NOT NULL default '',
  `value` longtext NOT NULL,
  PRIMARY KEY  (`serverid`,`optionname`)
) ENGINE=MyISAM;

CREATE TABLE `setting_options` (
  `id` int(11) NOT NULL auto_increment,
  `settingid` int(11) NOT NULL default '0',
  `name` varchar(50) NOT NULL default '',
  `value` text,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `id` (`id`),
  KEY `id_2` (`id`)
) ENGINE=MyISAM COMMENT='Contains all the available options for a giving setting' AUTO_INCREMENT=1 ;

CREATE TABLE `taxrule` (
  `countrycode` varchar(5) NOT NULL default '',
  `state` varchar(20) NOT NULL default '',
  `tax` float NOT NULL default '0',
  PRIMARY KEY  (`countrycode`,`state`)
) ENGINE=MyISAM;

CREATE TABLE `tld` (
  `id` int(11) NOT NULL auto_increment,
  `name` varchar(15) NOT NULL default '',
  `period` int(11) NOT NULL default '1',
  `price` float NOT NULL default '9.95',
  `renewal` float NOT NULL default '9.95',
  `transferprice` float NOT NULL default '9.95',
  `package` int(11) NOT NULL default '0',
  `billingcycle` int(11) NOT NULL default '1',
  `plugin` varchar(25) NOT NULL default '',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=4 ;

CREATE TABLE `users` (
  `id` int(11) NOT NULL auto_increment,
  `current` tinyint(1) default '1',
  `paymenttype` varchar(30) NOT NULL default '0',
  `clienttype` tinyint(4) NOT NULL default '0',
  `groupid` int(10) default '1',
  `password` varchar(45) default NULL,
  `dateActivated` date default NULL,
  `signature_text` text default NULL,
  `signature_html` text default NULL,
  `lastseen` datetime default NULL,
  `isOrganization` tinyint(4) default '0',
  `active` smallint(6) NOT NULL default '1',
  `recurring` tinyint(4) default '1',
  `currency` varchar(5) default '0',
  `data1` text default NULL,
  `autopayment` smallint(1) NOT NULL default '0',
  `ccmonth` varchar(4) NOT NULL default '0',
  `ccyear` varchar(4) NOT NULL default '0',
  `cclastfour` varchar(5) NOT NULL default '',
  `data2` text default NULL,
  `data3` text default NULL,
  `passphrased` smallint(1) NOT NULL default '0',
  `updating` tinyint(4) NOT NULL default '0',
  `taxable` tinyint(4) NOT NULL default '0',
  `status` tinyint(4) NOT NULL default '0',
  `firstname` varchar(25) NOT NULL default '',
  `lastname` varchar(25) NOT NULL default '',
  `email` varchar(60) NOT NULL default '',
  `organization` varchar(60) NOT NULL default '',
  `usernotes` longtext default NULL,
  `usernotespos` varchar(75) NOT NULL default '',
  `warningmask` int(11) NOT NULL default '0',
  `balance` FLOAT DEFAULT '0' NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=101 ;
