MyBB Community Forums

Full Version: does creating db tables work for any db?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have a quick question, this particular code works but I don't know how to test it using other DB types for install as I only have MySQL. Does a db write query for creating tables in a MyBB plugin account for other possible db types (like PostgreSQL).

if(!$db->table_exists("directory")) {
 $db->write_query("
  CREATE TABLE ".TABLE_PREFIX."directory (
  `id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
  `name` varchar(255) NOT NULL,
  `link` varchar(255) NOT NULL,
  `image` varchar(255) NOT NULL,
  `descr` varchar(255) NOT NULL
  ) ENGINE=MyISAM;
 ");
}

Also, should I be using MyISAM compared to InnoDB? I know I had read SOMEWHERE but cannot remember where that 2.0 future will use InnoDB (possibly false information)?..

I'm new and self teaching while working my way towards a future in Dev but sometimes I just feel like I don't know enough to decipher preferred methods.
Currently, data definition queries have to be provided individually for each engine, e.g.: https://github.com/kawaii/mybb-amnesia/b...p#L41-L170

This is sometimes the case for other queries as well, e.g.: https://github.com/mybb/mybb/blob/634257...#L276-L285

You can use InnoDB (default) on MySQL.

https://github.com/mybb/deploy may help with testing on various database systems.
Very helpful, thank you for this! Smile