Migration::dropTable PHP Method

dropTable() public method

Drop immediatly a table if it exists
public dropTable ( $table )
    function dropTable($table)
    {
        global $DB;
        if (TableExists($table)) {
            $DB->query("DROP TABLE `{$table}`");
        }
    }

Usage Example

function plugin_moreticket_install()
{
    global $DB;
    include_once GLPI_ROOT . "/plugins/moreticket/inc/profile.class.php";
    if (!TableExists("glpi_plugin_moreticket_configs")) {
        // table sql creation
        $DB->runFile(GLPI_ROOT . "/plugins/moreticket/sql/empty-1.2.0.sql");
    }
    PluginMoreticketProfile::initProfile();
    PluginMoreticketProfile::createFirstAccess($_SESSION['glpiactiveprofile']['id']);
    $migration = new Migration("1.1.0");
    $migration->dropTable('glpi_plugin_moreticket_profiles');
    if (!FieldExists("glpi_plugin_moreticket_configs", "solution_status")) {
        $DB->runFile(GLPI_ROOT . "/plugins/moreticket/sql/update-1.1.1.sql");
    }
    if (FieldExists("glpi_plugin_moreticket_waitingtypes", "is_helpdeskvisible")) {
        $DB->runFile(GLPI_ROOT . "/plugins/moreticket/sql/update-1.1.2.sql");
    }
    if (!FieldExists("glpi_plugin_moreticket_closetickets", "documents_id")) {
        $DB->runFile(GLPI_ROOT . "/plugins/moreticket/sql/update-1.1.3.sql");
    }
    if (!FieldExists("glpi_plugin_moreticket_configs", "date_report_mandatory")) {
        $DB->runFile(GLPI_ROOT . "/plugins/moreticket/sql/update-1.2.0.sql");
    }
    return true;
}
All Usage Examples Of Migration::dropTable