PunBB automatically compares extension version installed with version which is in manifest.xml, so just update version number and edit <install>
This is for example pun_pm's <install>
[code=php]
// Setup main table
if (!$forum_db->table_exists('pun_pm_messages'))
{
$schema = array(
'FIELDS' => array(
'id' => array(
'datatype' => 'SERIAL',
'allow_null' => false
),
'sender_id' => array(
'datatype' => 'INT(10) UNSIGNED',
'allow_null' => false,
'default' => '0'
),
'receiver_id' => array(
'datatype' => 'INT(10) UNSIGNED',
'allow_null' => true
),
'lastedited_at' => array(
'datatype' => 'INT(10) UNSIGNED',
'allow_null' => false,
'default' => '0'
),
'read_at' => array(
'datatype' => 'INT(10) UNSIGNED',
'allow_null' => false,
'default' => '0'
),
'subject' => array(
'datatype' => 'VARCHAR(255)',
'allow_null' => false,
'default' => '\'\''
),
'body' => array(
'datatype' => 'TEXT',
'allow_null' => false
),
'status' => array(
'datatype' => 'VARCHAR(9)',
'allow_null' => false,
'default' => '\'draft\'',
),
'deleted_by_sender' => array(
'datatype' => 'TINYINT(1)',
'allow_null' => false,
'default' => '0'
),
'deleted_by_receiver'=> array(
'datatype' => 'TINYINT(1)',
'allow_null' => false,
'default' => '0'
)
),
'PRIMARY KEY' => array('id'),
'INDEXES' => array(
'sender_id_idx' => array('sender_id'),
'receiver_id_idx' => array('receiver_id'),
)
);
$forum_db->create_table('pun_pm_messages', $schema);
}
else if (defined('EXT_CUR_VERSION') && version_compare(EXT_CUR_VERSION, '1.1b2', '<')) {
$forum_db->add_field('pun_pm_messages', 'lastedited_at_new', 'INT(10) UNSIGNED', false, '0');
$forum_db->add_field('pun_pm_messages', 'read_at_new', 'INT(10) UNSIGNED', false, '0');
$forum_db->query('UPDATE '.$forum_db->prefix.'pun_pm_messages SET lastedited_at_new = UNIX_TIMESTAMP(lastedited_at)');
$forum_db->query('UPDATE '.$forum_db->prefix.'pun_pm_messages SET read_at_new = UNIX_TIMESTAMP(read_at)');
$forum_db->drop_field('pun_pm_messages', 'lastedited_at');
$forum_db->drop_field('pun_pm_messages', 'read_at');
$forum_db->query('ALTER TABLE '.$forum_db->prefix.'pun_pm_messages
CHANGE lastedited_at_new lastedited_at INT(10) UNSIGNED NOT NULL DEFAULT 0,
CHANGE read_at_new read_at INT(10) UNSIGNED NOT NULL DEFAULT 0,
MODIFY status VARCHAR(9) NOT NULL DEFAULT \'draft\'') or error(__FILE__, __LINE__);
}
// Add extension options to the config table
if (!isset($forum_config['o_pun_pm_inbox_size']))
{
$query = array(
'INSERT' => 'conf_name, conf_value',
'INTO' => 'config',
'VALUES' => '\'o_pun_pm_inbox_size\', \'100\''
);
$forum_db->query_build($query) or error(__FILE__, __LINE__);
}
if (!isset($forum_config['o_pun_pm_outbox_size']))
{
$query = array(
'INSERT' => 'conf_name, conf_value',
'INTO' => 'config',
'VALUES' => '\'o_pun_pm_outbox_size\', \'100\''
);
$forum_db->query_build($query) or error(__FILE__, __LINE__);
}
if (!isset($forum_config['o_pun_pm_show_new_count']))
{
$query = array(
'INSERT' => 'conf_name, conf_value',
'INTO' => 'config',
'VALUES' => '\'o_pun_pm_show_new_count\', \'1\''
);
$forum_db->query_build($query) or error(__FILE__, __LINE__);
}
if (!isset($forum_config['o_pun_pm_show_global_link']))
{
$query = array(
'INSERT' => 'conf_name, conf_value',
'INTO' => 'config',
'VALUES' => '\'o_pun_pm_show_global_link\', \'1\''
);
$forum_db->query_build($query) or error(__FILE__, __LINE__);
}
// Field for cache
if (!$forum_db->field_exists('users', 'pun_pm_new_messages'))
$forum_db->add_field('users', 'pun_pm_new_messages', 'INT(10)', true);
// User options
if (!$forum_db->field_exists('users', 'pun_pm_long_subject'))
$forum_db->add_field('users', 'pun_pm_long_subject', 'TINYINT(1)', false, 1);
[/code]
Eraversum - scifi browser-based online webgame