 # Table structure for table `moderators`
 #
 
-CREATE TABLE {$db_prefix}moderators (
-  id_board smallint(5) unsigned NOT NULL default '0',
-  id_member mediumint(8) unsigned NOT NULL default '0',
-  PRIMARY KEY (id_board, id_member)
-) ENGINE=MyISAM;
+$db_table->db_create_table('{db_prefix}moderators',
+	array(
+		array('name' => 'id_board',  'type' => 'smallint', 'size' => 5, 'unsigned' => true, 'default' => 0),
+		array('name' => 'id_member', 'type' => 'mediumint', 'size' => 8, 'unsigned' => true, 'default' => 0),
+	),
+	array(
+		array('name' => 'id_board', 'columns' => array('id_board', 'id_member'), 'type' => 'primary'),
+	)
+);
 
 #
 # Table structure for table `openid_assoc`
 #
 
-CREATE TABLE {$db_prefix}openid_assoc (
-  server_url text NOT NULL,
-  handle varchar(255) NOT NULL default '',
-  secret text NOT NULL,
-  issued int(10) NOT NULL default '0',
-  expires int(10) NOT NULL default '0',
-  assoc_type varchar(64) NOT NULL default '',
-  PRIMARY KEY (server_url(125), handle(125)),
-  KEY expires (expires)
-) ENGINE=MyISAM;
+$db_table->db_create_table('{db_prefix}openid_assoc',
+	array(
+		array('name' => 'server_url', 'type' => 'text'),
+		array('name' => 'handle',     'type' => 'varchar', 'size' => 255, 'default' => ''),
+		array('name' => 'secret',     'type' => 'text'),
+		array('name' => 'issued',     'type' => 'int', 'size' => 10, 'default' => 0),
+		array('name' => 'expires',    'type' => 'int', 'size' => 10, 'default' => 0),
+		array('name' => 'assoc_type', 'type' => 'varchar', 'size' => 64, 'default' => ''),
+	),
+	array(
+		array('name' => 'server_handle', 'columns' => array('server_url(125)', 'handle(125)'), 'type' => 'primary'),
+		array('name' => 'expires',       'columns' => array('expires'), 'type' => 'key'),
+	)
+);
 
 #
 # Table structure for table `package_servers`
 #
 
-CREATE TABLE {$db_prefix}package_servers (
-  id_server smallint(5) unsigned NOT NULL auto_increment,
-  name varchar(255) NOT NULL default '',
-  url varchar(255) NOT NULL default '',
-  PRIMARY KEY (id_server)
-) ENGINE=MyISAM;
+$db_table->db_create_table('{db_prefix}package_servers',
+	array(
+		array('name' => 'id_server', 'type' => 'smallint', 'size' => 5, 'unsigned' => true, 'auto' => true),
+		array('name' => 'name',      'type' => 'varchar', 'size' => 255, 'default' => ''),
+		array('name' => 'url',       'type' => 'varchar', 'size' => 255, 'default' => ''),
+	),
+	array(
+		array('name' => 'id_server', 'columns' => array('id_server'), 'type' => 'primary'),
+	)
+);
 
 #
 # Dumping data for table `package_servers`

# Table structure for table `permission_profiles`
#

CREATE TABLE {$db_prefix}permission_profiles (
  id_profile smallint(5) NOT NULL auto_increment,
  profile_name varchar(255) NOT NULL default '',
  PRIMARY KEY (id_profile)
) ENGINE=MyISAM;

#
# Dumping data for table `permission_profiles`

# Table structure for table `personal_messages`
#

$db_table->db_create_table('{db_prefix}personal_messages',
	array(
		array('name' => 'id_pm',             'type' => 'int', 'size' => 10, 'unsigned' => true, 'auto' => true),
		array('name' => 'id_pm_head',        'type' => 'int', 'size' => 10, 'unsigned' => true, 'default' => 0),
		array('name' => 'id_member_from',    'type' => 'mediumint', 'size' => 8, 'unsigned' => true, 'default' => 0),
		array('name' => 'deleted_by_sender', 'type' => 'tinyint', 'size' => 3, 'unsigned' => true, 'default' => 0),
		array('name' => 'from_name',         'type' => 'varchar', 'size' => 255, 'default' => ''),
		array('name' => 'msgtime',           'type' => 'int', 'size' => 10, 'unsigned' => true, 'default' => 0),
		array('name' => 'subject',           'type' => 'varchar', 'size' => 255, 'default' => ''),
		array('name' => 'body',              'type' => 'text'),
	),
	array(
		array('name' => 'id_pm',      'columns' => array('id_pm'), 'type' => 'primary'),
		array('name' => 'id_member',  'columns' => array('id_member_from', 'deleted_by_sender'), 'type' => 'key'),
		array('name' => 'msgtime',    'columns' => array('msgtime'), 'type' => 'key'),
		array('name' => 'id_pm_head', 'columns' => array('id_pm_head'), 'type' => 'key'),
	)
);

#
# Table structure for table `pm_recipients`
#

$db_table->db_create_table('{db_prefix}pm_recipients',
	array(
		array('name' => 'id_pm',     'type' => 'int', 'size' => 10, 'unsigned' => true, 'default' => 0),
		array('name' => 'id_member', 'type' => 'mediumint', 'size' => 8, 'unsigned' => true, 'default' => 0),
		array('name' => 'labels',    'type' => 'varchar', 'size' => 60, 'default' => -1,
		array('name' => 'bcc',       'type' => 'tinyint', 'size' => 3, 'unsigned' => true, 'default' => 0),
		array('name' => 'is_read',   'type' => 'tinyint', 'size' => 3, 'unsigned' => true, 'default' => 0),
		array('name' => 'is_new',    'type' => 'tinyint', 'size' => 3, 'unsigned' => true, 'default' => 0),
		array('name' => 'deleted',   'type' => 'tinyint', 'size' => 3, 'unsigned' => true, 'default' => 0),
	),
	array(
		array('name' => 'id_pm_member', 'columns' => array('id_pm', 'id_member'), 'type' => 'primary'),
		array('name' => 'id_member',    'columns' => array('id_member', 'deleted', 'id_pm'), 'type' => 'unique'),
	)
);

#
# Table structure for table `pm_rules`
#

$db_table->db_create_table('{db_prefix}pm_rules',
	array(
		array('name' => 'id_rule',   'type' => 'int', 'size' => 10, 'unsigned' => true, 'auto' => true),
		array('name' => 'id_member', 'type' => 'int', 'size' => 10, 'unsigned' => true, 'default' => 0),
		array('name' => 'rule_name', 'type' => 'varchar', 'size' => 60, 'default' => ''),
		array('name' => 'criteria',  'type' => 'text'),
		array('name' => 'actions',   'type' => 'text'),
		array('name' => 'delete_pm', 'type' => 'tinyint', 'size' => 3, 'unsigned' => true, 'default' => 0),
		array('name' => 'is_or',     'type' => 'tinyint', 'size' => 3, 'unsigned' => true, 'default' => 0),
	),
	array(
		array('name' => 'id_rule',   'columns' => array('id_rule'), 'type' => 'primary'),
		array('name' => 'id_member', 'columns' => array('id_member'), 'type' => 'key'),
		array('name' => 'delete_pm', 'columns' => array('delete_pm'), 'type' => 'key'),
	)
);

#
# Table structure for table `polls`
#

$db_table->db_create_table('{db_prefix}polls',
	array(
		array('name' => 'id_poll',          'type' => 'mediumint', 'size' => 8, 'unsigned' => true, 'auto' => true),
		array('name' => 'question',         'type' => 'varchar', 'size' => 255, 'default' => ''),
		array('name' => 'voting_locked',    'type' => 'tinyint', 'size' => 1, 'default' => 0),
		array('name' => 'max_votes',        'type' => 'tinyint', 'size' => 3, 'unsigned' => true, 'default' => 1),
		array('name' => 'expire_time',      'type' => 'int', 'size' => 10, 'unsigned' => true, 'default' => 0),
		array('name' => 'hide_results',     'type' => 'tinyint', 'size' => 3, 'unsigned' => true, 'default' => 0),
		array('name' => 'change_vote',      'type' => 'tinyint', 'size' => 3, 'unsigned' => true, 'default' => 0),
		array('name' => 'guest_vote',       'type' => 'tinyint', 'size' => 3, 'unsigned' => true, 'default' => 0),
		array('name' => 'num_guest_voters', 'type' => 'int', 'size' => 10, 'unsigned' => true, 'default' => 0),
		array('name' => 'reset_poll',       'type' => 'int', 'size' => 10, 'unsigned' => true, 'default' => 0),
		array('name' => 'id_member',        'type' => 'mediumint', 'size' => 8, 'unsigned' => true, 'default' => 0),
		array('name' => 'poster_name',      'type' => 'varchar', 'size' => 255, 'default' => ''),
	),
	array(
		array('name' => 'id_poll', 'columns' => array('id_poll'), 'type' => 'primary'),
	)
);

#
# Table structure for table `poll_choices`
#

$db_table->db_create_table('{db_prefix}poll_choices',
	array(
		array('name' => 'id_poll',   'type' => 'mediumint', 'size' => 8, 'unsigned' => true, 'default' => 0),
		array('name' => 'id_choice', 'type' => 'tinyint', 'size' => 3, 'unsigned' => true, 'default' => 0),
		array('name' => 'label',     'type' => 'varchar', 'size' => 255, 'default' => ''),
		array('name' => 'votes',     'type' => 'smallint', 'size' => 5, 'unsigned' => true, 'default' => 0),
	),
	array(
		array('name' => 'id_poll', 'columns' => array('id_poll', 'id_choice'), 'type' => 'primary'),
	)
);

#
# Table structure for table `postby_emails`
#

$db_table->db_create_table('{db_prefix}postby_emails',
	array(
		array('name' => 'id_email',  'type' => 'varchar', 'size' => 50, 'default' => ''),
		array('name' => 'time_sent', 'type' => 'int', 'size' => 10, 'default' => 0),
		array('name' => 'email_to',  'type' => 'varchar', 'size' => 50, 'default' => ''),
	),
	array(
		array('name' => 'id_email', 'columns' => array('id_email'), 'type' => 'primary'),
	)
);

#
# Table structure for table `postby_emails_error`
#

$db_table->db_create_table('{db_prefix}postby_emails_error',
	array(
		array('name' => 'id_email',     'type' => 'int', 'size' => 10, 'auto' => true),
		array('name' => 'error',        'type' => 'varchar', 'size' => 255, 'default' => ''),
		array('name' => 'data_id',      'type' => 'varchar', 'size' => 255, 'default' => 0),
		array('name' => 'subject',      'type' => 'varchar', 'size' => 255, 'default' => ''),
		array('name' => 'id_message',   'type' => 'int', 'size' => 10, 'default' => 0),
		array('name' => 'id_board',     'type' => 'smallint', 'size' => 5, 'default' => 0),
		array('name' => 'email_from',   'type' => 'varchar', 'size' => 50, 'default' => ''),
		array('name' => 'message_type', 'type' => 'char', 'size' => 10, 'default' => ''),
		array('name' => 'message',      'type' => 'mediumtext'),
	),
	array(
		array('name' => 'id_email', 'columns' => array('id_email'), 'type' => 'primary'),
	)
);

#
# Table structure for table `postby_emails_filters`
#

$db_table->db_create_table('{db_prefix}postby_emails_filters',
	array(
		array('name' => 'id_filter',    'type' => 'int', 'size' => 10, 'auto' => true),
		array('name' => 'filter_style', 'type' => 'char', 'size' => 5, 'default' => ''),
		array('name' => 'filter_type',  'type' => 'varchar', 'size' => 255, 'default' => ''),
		array('name' => 'filter_to',    'type' => 'varchar', 'size' => 255, 'default' => ''),
		array('name' => 'filter_from',  'type' => 'varchar', 'size' => 255, 'default' => ''),
		array('name' => 'filter_name',  'type' => 'varchar', 'size' => 255, 'default' => ''),
		array('name' => 'filter_order', 'type' => 'int', 'size' => 10, 'default' => 0),
	),
	array(
		array('name' => 'id_filter', 'columns' => array('id_filter'), 'type' => 'primary'),
	)
);

#
# Table structure for table `scheduled_tasks`
#

$db_table->db_create_table('{db_prefix}scheduled_tasks',
	array(
		array('name' => 'id_task',         'type' => 'smallint', 'size' => 5, 'auto' => true),
		array('name' => 'next_time',       'type' => 'int', 'size' => 10, 'default' => 0),
		array('name' => 'time_offset',     'type' => 'int', 'size' => 10, 'default' => 0),
		array('name' => 'time_regularity', 'type' => 'smallint', 'size' => 5, 'default' => 0),
		array('name' => 'time_unit',       'type' => 'varchar', 'size' => 1, 'default' => 'h'),
		array('name' => 'disabled',        'type' => 'tinyint', 'size' => 3, 'default' => 0),
		array('name' => 'task',            'type' => 'varchar', 'size' => 24, 'default' => ''),
	),
	array(
		array('name' => 'id_task',   'columns' => array('id_task'), 'type' => 'primary'),
		array('name' => 'next_time', 'columns' => array('next_time'), 'type' => 'key'),
		array('name' => 'disabled',  'columns' => array('disabled'), 'type' => 'key'),
		array('name' => 'task',      'columns' => array('task'), 'type' => 'unique'),
	)
);

#
# Dumping data for table `scheduled_tasks`
