Drop asset_login_id as we have login_asset_id to allow 1 asset many logins, also drop the unused many to many asset login table

This commit is contained in:
johnnyq 2024-03-03 13:40:50 -05:00
parent 51248ed841
commit a91352229e
3 changed files with 14 additions and 20 deletions

View File

@ -1621,10 +1621,19 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.0.8'");
}
// if (CURRENT_DATABASE_VERSION == '1.0.8') {
// // Insert queries here required to update to DB version 1.0.9
if (CURRENT_DATABASE_VERSION == '1.0.8') {
// Removed this as login_asset_id is present in the logins table and allow 1 asset to have many logins.
mysqli_query($mysqli, "ALTER TABLE `assets` DROP `asset_login_id`");
// Dropped this unused Table as we don't need many to many relationship between assets and logins
mysqli_query($mysqli, "DROP TABLE asset_logins");
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.0.9'");
}
// if (CURRENT_DATABASE_VERSION == '1.0.9') {
// // Insert queries here required to update to DB version 1.1.0
// // Then, update the database to the next sequential version
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.0.9'");
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.1.0'");
// }
} else {

View File

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

17
db.sql
View File

@ -117,20 +117,6 @@ CREATE TABLE `asset_files` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `asset_logins`
--
DROP TABLE IF EXISTS `asset_logins`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `asset_logins` (
`asset_id` int(11) NOT NULL,
`login_id` int(11) NOT NULL,
PRIMARY KEY (`asset_id`,`login_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `assets`
--
@ -161,7 +147,6 @@ CREATE TABLE `assets` (
`asset_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
`asset_archived_at` datetime DEFAULT NULL,
`asset_accessed_at` datetime DEFAULT NULL,
`asset_login_id` int(11) NOT NULL DEFAULT 0,
`asset_vendor_id` int(11) NOT NULL DEFAULT 0,
`asset_location_id` int(11) NOT NULL DEFAULT 0,
`asset_contact_id` int(11) NOT NULL DEFAULT 0,
@ -1783,4 +1768,4 @@ CREATE TABLE `vendors` (
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2024-02-29 15:50:30
-- Dump completed on 2024-03-03 13:39:52