Dropped api_key_updated_at field and unused tables contracts, messages and roles

This commit is contained in:
johnnyq 2022-05-07 16:57:20 -04:00
parent 5044dc6084
commit 8d2570f688
3 changed files with 16 additions and 61 deletions

View File

@ -209,13 +209,25 @@ if(LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION){
if(CURRENT_DATABASE_VERSION == '0.0.9'){
// Insert queries here required to update to DB version 0.0.9
// Remove unused tables
mysqli_query($mysqli, "DROP TABLE contracts");
mysqli_query($mysqli, "DROP TABLE messages");
mysqli_query($mysqli, "DROP TABLE roles");
// ALTER queries.....
//Remove updated at as API keys can only be added or revoked
mysqli_query($mysqli, "ALTER TABLE `api_keys` DROP `api_key_updated_at`");
// Then, update the database to the next sequential version
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.1.0'");
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.1.0'");
}
//if(CURRENT_DATABASE_VERSION == '0.1.0'){
// Insert queries here required to update to DB version 0.1.0
// Then, update the database to the next sequential version
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.1.1'");
//}
// etc
}

View File

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

59
db.sql
View File

@ -308,29 +308,6 @@ CREATE TABLE `contacts` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `contracts`
--
DROP TABLE IF EXISTS `contracts`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `contracts` (
`contract_id` int(11) NOT NULL AUTO_INCREMENT,
`contract_title` varchar(200) NOT NULL,
`contract_description` longtext DEFAULT NULL,
`contract_start_date` date DEFAULT NULL,
`contract_end_date` date NOT NULL,
`contract_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`contract_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
`contract_archived_at` datetime DEFAULT NULL,
`contract_vendor_id` int(11) NOT NULL,
`contract_client_id` int(11) NOT NULL,
`company_id` int(11) NOT NULL,
PRIMARY KEY (`contract_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `custom_links`
--
@ -656,26 +633,6 @@ CREATE TABLE `logs` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `messages`
--
DROP TABLE IF EXISTS `messages`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `messages` (
`message_id` int(11) NOT NULL AUTO_INCREMENT,
`message_email` varchar(250) NOT NULL,
`message_ip` varchar(200) DEFAULT NULL,
`message_sent_at` datetime DEFAULT NULL,
`message_opened_at` datetime DEFAULT NULL,
`message_campaign_id` int(11) NOT NULL,
`message_client_id` int(11) DEFAULT NULL,
`company_id` int(11) NOT NULL,
PRIMARY KEY (`message_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `networks`
--
@ -873,20 +830,6 @@ CREATE TABLE `revenues` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `roles`
--
DROP TABLE IF EXISTS `roles`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `roles` (
`role_id` int(11) NOT NULL AUTO_INCREMENT,
`role_name` varchar(200) NOT NULL,
PRIMARY KEY (`role_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `scheduled_tickets`
--
@ -1439,4 +1382,4 @@ CREATE TABLE `vendors` (
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2022-05-06 12:03:14
-- Dump completed on 2022-05-07 16:56:32