Add Important asset, document, file, add file Description to DB Structure

This commit is contained in:
johnnyq 2024-03-15 18:32:42 -04:00
parent d32925eefc
commit 27a96c2293
3 changed files with 20 additions and 5 deletions

View File

@ -1636,10 +1636,21 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.1.0'");
}
// if (CURRENT_DATABASE_VERSION == '1.1.0') {
// // Insert queries here required to update to DB version 1.1.1
if (CURRENT_DATABASE_VERSION == '1.1.0') {
mysqli_query($mysqli, "ALTER TABLE `files` ADD `file_description` TEXT DEFAULT NULL AFTER `file_name`");
mysqli_query($mysqli, "ALTER TABLE `files` ADD `file_important` TINYINT(1) NOT NULL DEFAULT '0' AFTER `file_hash`");
mysqli_query($mysqli, "ALTER TABLE `documents` ADD `document_important` TINYINT(1) NOT NULL DEFAULT '0' AFTER `document_content_raw`");
mysqli_query($mysqli, "ALTER TABLE `assets` ADD `asset_important` TINYINT(1) NOT NULL DEFAULT '0' AFTER `asset_notes`");
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.1.1'");
}
// if (CURRENT_DATABASE_VERSION == '1.1.1') {
// // Insert queries here required to update to DB version 1.1.2
// // Then, update the database to the next sequential version
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.1.1'");
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.1.2'");
// }
} else {

View File

@ -5,5 +5,5 @@
* It is used in conjunction with database_updates.php
*/
DEFINE("LATEST_DATABASE_VERSION", "1.1.0");
DEFINE("LATEST_DATABASE_VERSION", "1.1.1");

6
db.sql
View File

@ -143,6 +143,7 @@ CREATE TABLE `assets` (
`asset_warranty_expire` date DEFAULT NULL,
`asset_install_date` date DEFAULT NULL,
`asset_notes` text DEFAULT NULL,
`asset_important` tinyint(1) NOT NULL DEFAULT 0,
`asset_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`asset_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
`asset_archived_at` datetime DEFAULT NULL,
@ -461,6 +462,7 @@ CREATE TABLE `documents` (
`document_description` text DEFAULT NULL,
`document_content` longtext NOT NULL,
`document_content_raw` longtext NOT NULL,
`document_important` tinyint(1) NOT NULL DEFAULT 0,
`document_parent` int(11) NOT NULL DEFAULT 0,
`document_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`document_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
@ -591,8 +593,10 @@ CREATE TABLE `files` (
`file_id` int(11) NOT NULL AUTO_INCREMENT,
`file_reference_name` varchar(200) DEFAULT NULL,
`file_name` varchar(200) NOT NULL,
`file_description` text DEFAULT NULL,
`file_ext` varchar(200) DEFAULT NULL,
`file_hash` varchar(200) DEFAULT NULL,
`file_important` tinyint(1) NOT NULL DEFAULT 0,
`file_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`file_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
`file_archived_at` datetime DEFAULT NULL,
@ -1769,4 +1773,4 @@ CREATE TABLE `vendors` (
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2024-03-05 18:47:45
-- Dump completed on 2024-03-15 18:31:42