mirror of
https://github.com/itflow-org/itflow
synced 2026-02-28 02:44:53 +00:00
Add full text index & search for document contents (related to #440)
This commit is contained in:
@@ -19,24 +19,43 @@ if(LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION){
|
||||
|
||||
if(CURRENT_DATABASE_VERSION == '0.0.1'){
|
||||
// Insert queries here required to update to DB version 0.0.2
|
||||
// mysqli_query($mysqli, "ALTER TABLE .....");
|
||||
|
||||
mysqli_query($mysqli, "ALTER TABLE `settings` ADD `config_module_enable_itdoc` TINYINT(1) DEFAULT 1 AFTER `config_backup_path`");
|
||||
mysqli_query($mysqli, "ALTER TABLE `settings` ADD `config_module_enable_ticketing` TINYINT(1) DEFAULT 1 AFTER `config_module_enable_itdoc`");
|
||||
mysqli_query($mysqli, "ALTER TABLE `settings` ADD `config_module_enable_accounting` TINYINT(1) DEFAULT 1 AFTER `config_module_enable_ticketing`");
|
||||
|
||||
// Then, update the database to the next sequential version
|
||||
//mysqli_query($mysqli, "UPDATE settings SET config_current_database_version = '0.0.2' WHERE company_id = '1'");
|
||||
|
||||
// Update the database to the next sequential version
|
||||
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.0.2'");
|
||||
}
|
||||
|
||||
if(CURRENT_DATABASE_VERSION == '0.0.2'){
|
||||
// Insert queries here required to update to DB version 0.0.3
|
||||
|
||||
// Add document content raw column & index
|
||||
mysqli_query($mysqli, "ALTER TABLE `documents` ADD `document_content_raw` LONGTEXT NOT NULL AFTER `document_content`, ADD FULLTEXT `document_content_raw` (`document_content_raw`)");
|
||||
|
||||
// Populate content raw column with existing document data
|
||||
$documents_sql = mysqli_query($mysqli, "SELECT * FROM `documents`");
|
||||
while($row = mysqli_fetch_array($documents_sql)){
|
||||
$id = $row['document_id'];
|
||||
$name = $row['document_name'];
|
||||
$content = $row['document_content'];
|
||||
$content_raw = trim(mysqli_real_escape_string($mysqli, strip_tags($name . " " . str_replace("<", " <", $content))));
|
||||
|
||||
mysqli_query($mysqli, "UPDATE `documents` SET `document_content_raw` = '$content_raw' WHERE `document_id` = '$id'");
|
||||
}
|
||||
|
||||
// Then, update the database to the next sequential version
|
||||
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.0.3'");
|
||||
}
|
||||
|
||||
if(CURRENT_DATABASE_VERSION == '0.0.3'){
|
||||
// Insert queries here required to update to DB version 0.0.4
|
||||
// mysqli_query($mysqli, "ALTER TABLE .....");
|
||||
|
||||
|
||||
// Then, update the database to the next sequential version
|
||||
//mysqli_query($mysqli, "UPDATE settings SET config_current_database_version = '0.0.3' WHERE company_id = '1'");
|
||||
//mysqli_query($mysqli, "UPDATE settings SET config_current_database_version = '0.0.3'");
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user