Исходная тема локализации: [Русский перевод] Medals_System_MOD
Тестируем, пишем и по возможности дорабатываем.
Код: Выделить всё
/**
* Add the medals table schema to the database:
*
* @return array Array of table schema
* @access public
*/
public function update_schema()
{
return array(
'add_tables' => array(
$this->table_prefix . 'medals' => array(
'COLUMNS' => array(
'id' => array('UINT:11', null, 'auto_increment'),
'name' => array('VCHAR:30', ''),
'image' => array('VCHAR:100', ''),
'dynamic' => array('BOOL', 0),
'device' => array('VCHAR:32', ''),
'number' => array('UINT:2', 1),
'parent' => array('UINT:5', 0),
'nominated' => array('BOOL', 0),
'order_id' => array('UINT:5', 0),
'description' => array('VCHAR:256', ''),
'points' => array('INT:4', 0),
),
'PRIMARY_KEY' => 'id',
'KEYS' => array(
'order_id' => array('INDEX', array('order_id')),
),
),
$this->table_prefix . 'medals_awarded' => array(
'COLUMNS' => array(
'id' => array('UINT:10', null, 'auto_increment'),
'medal_id' => array('UINT', 0),
'user_id' => array('UINT', 0),
'awarder_id' => array('UINT', 0),
'awarder_un' => array('VCHAR:255', ''),
'awarder_color' => array('VCHAR:6', ''),
'time' => array('TIMESTAMP', 0),
'nominated' => array('BOOL', 0),
'nominated_reason' => array('TEXT', ''),
'points' => array('INT:4', 0),
'bbuid' => array('VCHAR:255', ''),
'bitfield' => array('VCHAR:255', ''),
),
'PRIMARY_KEY' => 'id',
'KEYS' => array(
'time' => array('INDEX', 'time'),
),
),
$this->table_prefix . 'medals_cats' => array(
'COLUMNS' => array(
'id' => array('UINT:5', null, 'auto_increment'),
'name' => array('VCHAR:30', ''),
'order_id' => array('UINT:5', 0),
),
'PRIMARY_KEY' => 'id',
'KEYS' => array(
'order_id' => array('INDEX', 'order_id'),
),
),
),
'add_columns' => array(
$this->table_prefix . 'users' => array(
'medal_user_points' => array('UINT:11', 0),
),
),
);
}
/**
* Drop the medals table schema from the database
*
* @return array Array of table schema
* @access public
*/
public function revert_schema()
{
return array(
'drop_tables' => array(
$this->table_prefix . 'medals',
$this->table_prefix . 'medals_awarded',
$this->table_prefix . 'medals_cats',
),
);
}