i'm having problems getting the migration files to work. can someone look these over and let me know what is wrong please
first is create_tables
Code: Select all
namespace spaceace\ajaxchat\migrations;
class create_table extends \phpbb\db\migration\migration
{
static public function depends_on()
{
return array();
}
public function update_schema()
{
return array(
'add_tables' => array(
$this->table_prefix . 'ajax_chat' => array(
'COLUMNS' => array(
'message_id' => array('UINT:11', NOT NULL, 'auto_increment'),
'chat_id' => array('UINT:11', NOT NULL, 0),
'user_id' => array('UINT:11', NOT NULL, 0),
'username' => array('VCHAR:255', NOT NULL, ''),
'user_colour' => array('VCHAR:6', NOT NULL, ''),
'message' => array('MTEXT_UNI', NOT NULL, ''),
'bbcode_uid' => array('VCHAR:8', NOT NULL, ''),
'bbcode_bitfield' => array('VCHAR:255', NOT NULL, ''),
'bbcode_options' => array('UINT:11', NOT NULL, 7),
'time' => array('UINT:11', NOT NULL, 0),
),
'PRIMARY_KEY' => 'message_id',
),
$this->table_prefix . 'ajax_caht_sessions' => array(
'COLUMNS' => array(
'user_id' => array('MEDIUMINT:8', NOT NULL, 0),
'username' => array('VCHAR:255', NOT NULL, ''),
'user_colour' => array('VCHAR:6', NOT NULL, ''),
'user_login' => array('UINT:11', NOT NULL, 0),
'user_firstpost' => array('UINT:11', NOT NULL, 0),
'user_lastpost' => array('UINT:11', NOT NULL, 0),
'user_lastupdate' => array('UINT:11', NOT NULL, 0),
),
'PRIMARY_KEY' => 'user_id',
),
),
);
}
public function revert_schema()
{
return array(
'drop_tables' => array(
$this->table_prefix . 'ajax_caht',
$this->table_prefix . 'ajax_caht_sessions',
),
);
}
}
next is update_table
Code: Select all
namespace spaceace\ajaxchat\migrations;
class update_table extends \phpbb\db\migration\migration
{
static public function depends_on()
{
return array();
}
public function update_schema()
{
return array(
'add_columns' => array(
$this->table_prefix . 'users' => array(
'ajax_chat_view' => array('TINYINT(1)', NOT NULL, 1),
'ajax_chat_position' => array('TINYINT(1)', NOT NULL, 1),
'ajax_chat_avatars' => array('TINYINT(1)', NOT NULL, 1),
'ajax_chat_sound' => array('TINYINT(1)', NOT NULL, 1),
),
)
);
}
public function revert_schema()
{
return array(
'drop_columns' => array(
$this->table_prefix . 'users' => array(
'ajax_ajax_chat_view',
'ajax_chat_position',
'ajax_chat_avatars',
'ajax_chat_sound',
)
),
);
}
}
finally is update_chat_bbcodes
Code: Select all
namespace spaceace\ajaxchat\migrations;
class update_bbcodes extends \phpbb\db\migration\migration
{
public function update_data()
{
return array(
array('custom', array(array($this, 'update_chat_bbcodes'))),
// Stop tracking the version number in the db
array('config.remove', array('modx_version')),
);
}
public function update_chat_bbcodes()
{
$bbcode_data = array(
'color2=' => array(
'bbcode_helpline' => '',
'bbcode_match' => '[color2={COLOR}]{TEXT}[/color2]',
'bbcode_tpl' => '<span style="color: {COLOR}">{TEXT}</span>',
),
);
global $request, $user;
$acp_manager = new \spaceace\ajaxchat\core\acp_manager($this->db, $request, $user, $this->phpbb_root_path, $this->php_ext);
$acp_manager->install_bbcodes($bbcode_data);
}
}
the problem i get is an error page with this
Parse error: syntax error, unexpected T_STRING, expecting ')' in /ext/spaceace/ajaxchat/migrations/update_table.php on line 15