Fixed issue with Account Transfers and adding Revenue, updated DB to update created_at and updated_at to the new SQL Timestamp

This commit is contained in:
johnnyq 2022-05-06 12:04:12 -04:00
parent 867f5edb8a
commit 598f1b1aa1
3 changed files with 99 additions and 94 deletions

View File

@ -201,10 +201,19 @@ if(LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION){
if(CURRENT_DATABASE_VERSION == '0.0.8'){
// Insert queries here required to update to DB version 0.0.9
mysqli_query($mysqli, "ALTER TABLE `revenues` CHANGE `revenue_created_at` `revenue_created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, CHANGE `revenue_updated_at` `revenue_updated_at` DATETIME on update CURRENT_TIMESTAMP NULL DEFAULT NULL; ");
// Then, update the database to the next sequential version
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.0.9'");
}
if(CURRENT_DATABASE_VERSION == '0.0.9'){
// Insert queries here required to update to DB version 0.0.9
// ALTER queries.....
// Then, update the database to the next sequential version
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.0.9'");
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.1.0'");
}
// etc

View File

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

180
db.sql
View File

@ -28,8 +28,8 @@ CREATE TABLE `accounts` (
`opening_balance` decimal(15,2) NOT NULL DEFAULT 0.00,
`account_currency_code` varchar(200) NOT NULL,
`account_notes` text DEFAULT NULL,
`account_created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`account_updated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`account_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`account_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
`account_archived_at` datetime DEFAULT NULL,
`company_id` int(11) NOT NULL,
PRIMARY KEY (`account_id`)
@ -47,10 +47,10 @@ CREATE TABLE `api_keys` (
`api_key_id` int(11) NOT NULL AUTO_INCREMENT,
`api_key_name` varchar(255) NOT NULL,
`api_key_secret` varchar(255) NOT NULL,
`api_key_created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`api_key_updated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`api_key_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`api_key_updated_at` datetime DEFAULT NULL,
`api_key_expire` date NOT NULL,
`api_key_client_id` int(11) NOT NULL DEFAULT '0',
`api_key_client_id` int(11) NOT NULL DEFAULT 0,
`company_id` int(11) NOT NULL,
PRIMARY KEY (`api_key_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@ -78,8 +78,8 @@ CREATE TABLE `assets` (
`asset_install_date` date DEFAULT NULL,
`asset_reciept` varchar(200) DEFAULT NULL,
`asset_notes` text DEFAULT NULL,
`asset_created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`asset_updated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`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,
`asset_login_id` int(11) DEFAULT NULL,
`asset_vendor_id` int(11) DEFAULT NULL,
@ -103,8 +103,8 @@ CREATE TABLE `calendars` (
`calendar_id` int(11) NOT NULL AUTO_INCREMENT,
`calendar_name` varchar(200) NOT NULL,
`calendar_color` varchar(200) NOT NULL,
`calendar_created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`calendar_updated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`calendar_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`calendar_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
`calendar_archived_at` datetime DEFAULT NULL,
`company_id` int(11) NOT NULL,
PRIMARY KEY (`calendar_id`)
@ -130,8 +130,8 @@ CREATE TABLE `campaign_messages` (
`message_bounced_at` datetime DEFAULT NULL,
`message_opened_at` datetime DEFAULT NULL,
`message_clicked_at` datetime DEFAULT NULL,
`message_created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`message_updated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`message_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`message_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
`message_client_tag_id` int(11) NOT NULL,
`message_contact_id` int(11) NOT NULL,
`message_campaign_id` int(11) NOT NULL,
@ -156,8 +156,8 @@ CREATE TABLE `campaigns` (
`campaign_content` longtext NOT NULL,
`campaign_status` varchar(20) NOT NULL,
`campaign_scheduled_at` datetime DEFAULT NULL,
`campaign_created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`campaign_updated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`campaign_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`campaign_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
`campaign_archived_at` datetime DEFAULT NULL,
`company_id` int(11) NOT NULL,
PRIMARY KEY (`campaign_id`)
@ -176,8 +176,8 @@ CREATE TABLE `categories` (
`category_name` varchar(200) NOT NULL,
`category_type` varchar(200) NOT NULL,
`category_color` varchar(200) DEFAULT NULL,
`category_created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`category_updated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`category_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`category_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
`category_archived_at` datetime DEFAULT NULL,
`company_id` int(11) NOT NULL,
PRIMARY KEY (`category_id`)
@ -199,8 +199,8 @@ CREATE TABLE `certificates` (
`certificate_expire` date DEFAULT NULL,
`certificate_public_key` text DEFAULT NULL,
`certificate_notes` text DEFAULT NULL,
`certificate_created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`certificate_updated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`certificate_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`certificate_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
`certificate_archived_at` datetime DEFAULT NULL,
`certificate_domain_id` int(11) DEFAULT NULL,
`certificate_client_id` int(11) NOT NULL,
@ -239,8 +239,8 @@ CREATE TABLE `clients` (
`client_currency_code` varchar(200) NOT NULL,
`client_net_terms` int(10) NOT NULL,
`client_notes` text DEFAULT NULL,
`client_created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`client_updated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`client_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`client_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
`client_archived_at` datetime DEFAULT NULL,
`client_accessed_at` datetime DEFAULT NULL,
`primary_location` int(11) DEFAULT NULL,
@ -271,8 +271,8 @@ CREATE TABLE `companies` (
`company_logo` varchar(250) DEFAULT NULL,
`company_locale` varchar(200) DEFAULT NULL,
`company_currency` varchar(200) NOT NULL,
`company_created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`company_updated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`company_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`company_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
`company_archived_at` datetime DEFAULT NULL,
PRIMARY KEY (`company_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
@ -289,7 +289,6 @@ CREATE TABLE `contacts` (
`contact_id` int(11) NOT NULL AUTO_INCREMENT,
`contact_name` varchar(200) NOT NULL,
`contact_title` varchar(200) DEFAULT NULL,
`contact_department` varchar(200) DEFAULT NULL,
`contact_email` varchar(200) DEFAULT NULL,
`contact_phone` varchar(200) DEFAULT NULL,
`contact_extension` varchar(200) DEFAULT NULL,
@ -299,10 +298,11 @@ CREATE TABLE `contacts` (
`contact_auth_method` varchar(200) DEFAULT NULL,
`contact_password_hash` varchar(200) DEFAULT NULL,
`contact_important` tinyint(1) NOT NULL DEFAULT 0,
`contact_created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`contact_updated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`contact_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`contact_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
`contact_archived_at` datetime DEFAULT NULL,
`contact_location_id` int(11) DEFAULT NULL,
`contact_department` varchar(200) DEFAULT NULL,
`contact_client_id` int(11) NOT NULL,
`company_id` int(11) NOT NULL,
PRIMARY KEY (`contact_id`)
@ -322,8 +322,8 @@ CREATE TABLE `contracts` (
`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_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,
@ -345,7 +345,7 @@ CREATE TABLE `custom_links` (
`custom_link_icon` varchar(100) DEFAULT NULL,
`custom_link_url` varchar(250) NOT NULL,
`custom_link_order` int(11) DEFAULT NULL,
`custom_link_created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`custom_link_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`company_id` int(11) NOT NULL,
PRIMARY KEY (`custom_link_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@ -363,23 +363,19 @@ CREATE TABLE `documents` (
`document_name` varchar(200) NOT NULL,
`document_content` longtext NOT NULL,
`document_content_raw` longtext NOT NULL,
`document_created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`document_updated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`document_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`document_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
`document_archived_at` datetime DEFAULT NULL,
`document_template` tinyint(1) NOT NULL,
`document_folder_id` int(11) DEFAULT NULL,
`document_contact_id` int(11) NOT NULL DEFAULT 0,
`document_client_id` int(11) NOT NULL,
`company_id` int(11) NOT NULL,
PRIMARY KEY (`document_id`)
PRIMARY KEY (`document_id`),
FULLTEXT KEY `document_content_raw` (`document_content_raw`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Indexes for table `documents`
--
ALTER TABLE `documents` ADD FULLTEXT KEY `document_content_raw` (`document_content_raw`);
--
-- Table structure for table `domains`
--
@ -395,8 +391,8 @@ CREATE TABLE `domains` (
`domain_name_servers` varchar(255) DEFAULT NULL,
`domain_mail_servers` varchar(255) DEFAULT NULL,
`domain_raw_whois` text DEFAULT NULL,
`domain_created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`domain_updated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`domain_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`domain_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
`domain_archived_at` datetime DEFAULT NULL,
`domain_registrar` int(11) DEFAULT NULL,
`domain_webhost` int(11) DEFAULT NULL,
@ -420,8 +416,8 @@ CREATE TABLE `events` (
`event_start` datetime NOT NULL,
`event_end` datetime DEFAULT NULL,
`event_repeat` varchar(200) DEFAULT NULL,
`event_created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`event_updated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`event_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`event_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
`event_archived_at` datetime DEFAULT NULL,
`event_client_id` int(11) DEFAULT NULL,
`event_location_id` int(11) DEFAULT NULL,
@ -447,8 +443,8 @@ CREATE TABLE `expenses` (
`expense_reference` varchar(200) DEFAULT NULL,
`expense_payment_method` varchar(200) DEFAULT NULL,
`expense_receipt` varchar(200) DEFAULT NULL,
`expense_created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`expense_updated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`expense_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`expense_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
`expense_archived_at` datetime DEFAULT NULL,
`expense_vendor_id` int(11) DEFAULT NULL,
`expense_client_id` int(11) DEFAULT NULL,
@ -472,8 +468,8 @@ CREATE TABLE `files` (
`file_reference_name` varchar(200) DEFAULT NULL,
`file_name` varchar(200) NOT NULL,
`file_ext` varchar(200) DEFAULT NULL,
`file_created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`file_updated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`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,
`file_contact_id` int(11) NOT NULL DEFAULT 0,
`file_client_id` int(11) NOT NULL,
@ -510,7 +506,7 @@ CREATE TABLE `history` (
`history_id` int(11) NOT NULL AUTO_INCREMENT,
`history_status` varchar(200) NOT NULL,
`history_description` varchar(200) NOT NULL,
`history_created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`history_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`history_archived_at` datetime DEFAULT NULL,
`history_invoice_id` int(11) DEFAULT NULL,
`history_recurring_id` int(11) DEFAULT NULL,
@ -536,8 +532,8 @@ CREATE TABLE `invoice_items` (
`item_subtotal` decimal(15,2) NOT NULL,
`item_tax` decimal(15,2) DEFAULT NULL,
`item_total` decimal(15,2) NOT NULL,
`item_created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`item_updated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`item_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`item_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
`item_archived_at` datetime DEFAULT NULL,
`item_tax_id` int(11) DEFAULT NULL,
`item_quote_id` int(11) DEFAULT NULL,
@ -567,8 +563,8 @@ CREATE TABLE `invoices` (
`invoice_currency_code` varchar(200) NOT NULL,
`invoice_note` text DEFAULT NULL,
`invoice_url_key` varchar(200) DEFAULT NULL,
`invoice_created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`invoice_updated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`invoice_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`invoice_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
`invoice_archived_at` datetime DEFAULT NULL,
`invoice_category_id` int(11) NOT NULL,
`invoice_client_id` int(11) NOT NULL,
@ -596,8 +592,8 @@ CREATE TABLE `locations` (
`location_hours` varchar(200) DEFAULT NULL,
`location_photo` varchar(200) DEFAULT NULL,
`location_notes` text DEFAULT NULL,
`location_created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`location_updated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`location_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`location_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
`location_archived_at` datetime DEFAULT NULL,
`location_contact_id` int(11) DEFAULT NULL,
`location_client_id` int(11) DEFAULT NULL,
@ -622,8 +618,8 @@ CREATE TABLE `logins` (
`login_password` varbinary(200) DEFAULT NULL,
`login_otp_secret` varchar(200) DEFAULT NULL,
`login_note` text DEFAULT NULL,
`login_created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`login_updated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`login_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`login_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
`login_archived_at` datetime DEFAULT NULL,
`login_contact_id` int(11) NOT NULL DEFAULT 0,
`login_vendor_id` int(11) DEFAULT NULL,
@ -649,7 +645,7 @@ CREATE TABLE `logs` (
`log_description` varchar(255) NOT NULL,
`log_ip` varchar(200) DEFAULT NULL,
`log_user_agent` varchar(250) DEFAULT NULL,
`log_created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`log_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`log_archived_at` datetime DEFAULT NULL,
`log_client_id` int(11) DEFAULT NULL,
`log_invoice_id` int(11) DEFAULT NULL,
@ -696,8 +692,8 @@ CREATE TABLE `networks` (
`network_gateway` varchar(200) NOT NULL,
`network_dhcp_range` varchar(200) DEFAULT NULL,
`network_notes` text DEFAULT NULL,
`network_created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`network_updated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`network_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`network_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
`network_archived_at` datetime DEFAULT NULL,
`network_location_id` int(11) DEFAULT NULL,
`network_client_id` int(11) NOT NULL,
@ -717,7 +713,7 @@ CREATE TABLE `notifications` (
`notification_id` int(11) NOT NULL AUTO_INCREMENT,
`notification_type` varchar(200) NOT NULL,
`notification` varchar(255) NOT NULL,
`notification_timestamp` datetime NOT NULL,
`notification_timestamp` datetime NOT NULL DEFAULT current_timestamp(),
`notification_dismissed_at` datetime DEFAULT NULL,
`notification_dismissed_by` int(11) DEFAULT NULL,
`notification_client_id` int(11) DEFAULT NULL,
@ -740,8 +736,8 @@ CREATE TABLE `payments` (
`payment_currency_code` varchar(10) NOT NULL,
`payment_method` varchar(200) DEFAULT NULL,
`payment_reference` varchar(200) DEFAULT NULL,
`payment_created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`payment_updated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`payment_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`payment_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
`payment_archived_at` datetime DEFAULT NULL,
`payment_account_id` int(11) NOT NULL,
`payment_invoice_id` int(11) DEFAULT NULL,
@ -763,8 +759,8 @@ CREATE TABLE `products` (
`product_description` text DEFAULT NULL,
`product_price` decimal(15,2) NOT NULL,
`product_currency_code` varchar(200) NOT NULL,
`product_created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`product_updated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`product_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`product_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
`product_archived_at` datetime DEFAULT NULL,
`product_tax_id` int(11) DEFAULT NULL,
`product_category_id` int(11) NOT NULL,
@ -791,8 +787,8 @@ CREATE TABLE `quotes` (
`quote_currency_code` varchar(200) NOT NULL,
`quote_note` text DEFAULT NULL,
`quote_url_key` varchar(200) DEFAULT NULL,
`quote_created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`quote_updated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`quote_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`quote_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
`quote_archived_at` datetime DEFAULT NULL,
`quote_category_id` int(11) NOT NULL,
`quote_client_id` int(11) NOT NULL,
@ -814,8 +810,8 @@ CREATE TABLE `records` (
`record` varchar(200) NOT NULL,
`record_value` varchar(200) NOT NULL,
`record_priority` int(11) DEFAULT NULL,
`record_created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`record_updated_at` datetime NOT NULL,
`record_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`record_updated_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(),
`record_archived_at` datetime DEFAULT NULL,
`record_domain_id` int(11) NOT NULL,
`company_id` int(11) NOT NULL,
@ -842,8 +838,8 @@ CREATE TABLE `recurring` (
`recurring_amount` decimal(15,2) DEFAULT NULL,
`recurring_currency_code` varchar(200) NOT NULL,
`recurring_note` text DEFAULT NULL,
`recurring_created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`recurring_updated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`recurring_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`recurring_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
`recurring_archived_at` datetime DEFAULT NULL,
`recurring_category_id` int(11) NOT NULL,
`recurring_client_id` int(11) NOT NULL,
@ -867,8 +863,8 @@ CREATE TABLE `revenues` (
`revenue_payment_method` varchar(200) DEFAULT NULL,
`revenue_reference` varchar(200) DEFAULT NULL,
`revenue_description` varchar(200) DEFAULT NULL,
`revenue_created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`revenue_updated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`revenue_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`revenue_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
`revenue_archived_at` datetime DEFAULT NULL,
`revenue_category_id` int(11) NOT NULL,
`revenue_account_id` int(11) NOT NULL,
@ -908,8 +904,8 @@ CREATE TABLE `scheduled_tickets` (
`scheduled_ticket_frequency` varchar(10) NOT NULL,
`scheduled_ticket_start_date` date NOT NULL,
`scheduled_ticket_next_run` date NOT NULL,
`scheduled_ticket_created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`scheduled_ticket_updated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`scheduled_ticket_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`scheduled_ticket_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
`scheduled_ticket_created_by` int(11) NOT NULL,
`scheduled_ticket_client_id` int(11) DEFAULT NULL,
`scheduled_ticket_contact_id` int(11) DEFAULT NULL,
@ -1025,8 +1021,8 @@ CREATE TABLE `services` (
`service_importance` varchar(10) CHARACTER SET latin1 NOT NULL,
`service_backup` varchar(200) DEFAULT NULL,
`service_notes` text CHARACTER SET latin1 NOT NULL,
`service_created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`service_updated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`service_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`service_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
`service_review_due` date DEFAULT NULL,
`service_client_id` int(11) NOT NULL,
`company_id` int(11) NOT NULL,
@ -1112,7 +1108,7 @@ CREATE TABLE `shared_items` (
`item_note` varchar(255) DEFAULT NULL,
`item_views` int(11) NOT NULL,
`item_view_limit` int(11) DEFAULT NULL,
`item_created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`item_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`item_expire_at` datetime DEFAULT NULL,
`item_client_id` int(11) NOT NULL,
PRIMARY KEY (`item_id`)
@ -1137,8 +1133,8 @@ CREATE TABLE `software` (
`software_purchase` date DEFAULT NULL,
`software_expire` date DEFAULT NULL,
`software_notes` text DEFAULT NULL,
`software_created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`software_updated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`software_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`software_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
`software_archived_at` datetime DEFAULT NULL,
`software_login_id` int(11) DEFAULT NULL,
`software_client_id` int(11) NOT NULL,
@ -1188,8 +1184,8 @@ CREATE TABLE `tags` (
`tag_type` int(11) NOT NULL,
`tag_color` varchar(200) DEFAULT NULL,
`tag_icon` varchar(200) DEFAULT NULL,
`tag_created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`tag_updated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`tag_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`tag_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
`company_id` int(11) NOT NULL,
PRIMARY KEY (`tag_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@ -1206,8 +1202,8 @@ CREATE TABLE `taxes` (
`tax_id` int(11) NOT NULL AUTO_INCREMENT,
`tax_name` varchar(200) NOT NULL,
`tax_percent` float NOT NULL,
`tax_created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`tax_updated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`tax_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`tax_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
`tax_archived_at` datetime DEFAULT NULL,
`company_id` int(11) NOT NULL,
PRIMARY KEY (`tax_id`)
@ -1226,8 +1222,8 @@ CREATE TABLE `ticket_replies` (
`ticket_reply` longtext NOT NULL,
`ticket_reply_type` varchar(10) NOT NULL,
`ticket_reply_time_worked` time DEFAULT NULL,
`ticket_reply_created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`ticket_reply_updated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`ticket_reply_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`ticket_reply_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
`ticket_reply_archived_at` datetime DEFAULT NULL,
`ticket_reply_by` int(11) NOT NULL,
`ticket_reply_ticket_id` int(11) NOT NULL,
@ -1269,8 +1265,8 @@ CREATE TABLE `tickets` (
`ticket_priority` varchar(200) DEFAULT NULL,
`ticket_status` varchar(200) NOT NULL,
`ticket_feedback` varchar(200) DEFAULT NULL,
`ticket_created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`ticket_updated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`ticket_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`ticket_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
`ticket_archived_at` datetime DEFAULT NULL,
`ticket_closed_at` datetime DEFAULT NULL,
`ticket_created_by` int(11) NOT NULL,
@ -1296,8 +1292,8 @@ DROP TABLE IF EXISTS `transfers`;
CREATE TABLE `transfers` (
`transfer_id` int(11) NOT NULL AUTO_INCREMENT,
`transfer_notes` text DEFAULT NULL,
`transfer_created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`transfer_updated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`transfer_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`transfer_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
`transfer_archived_at` datetime DEFAULT NULL,
`transfer_expense_id` int(11) NOT NULL,
`transfer_revenue_id` int(11) NOT NULL,
@ -1323,8 +1319,8 @@ CREATE TABLE `trips` (
`trip_end_odmeter` int(11) DEFAULT NULL,
`trip_miles` float(15,1) NOT NULL,
`round_trip` int(1) NOT NULL,
`trip_created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`trip_updated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`trip_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`trip_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
`trip_archived_at` datetime DEFAULT NULL,
`trip_user_id` int(11) NOT NULL DEFAULT 0,
`trip_client_id` int(11) DEFAULT NULL,
@ -1395,8 +1391,8 @@ CREATE TABLE `users` (
`user_specific_encryption_ciphertext` varchar(200) DEFAULT NULL,
`user_php_session` varchar(255) DEFAULT NULL,
`user_extension_key` varchar(18) DEFAULT NULL,
`user_created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`user_updated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`user_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`user_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
`user_archived_at` datetime DEFAULT NULL,
PRIMARY KEY (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
@ -1426,8 +1422,8 @@ CREATE TABLE `vendors` (
`vendor_account_number` varchar(200) DEFAULT NULL,
`vendor_notes` text DEFAULT NULL,
`vendor_global` tinyint(1) DEFAULT NULL,
`vendor_created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`vendor_updated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`vendor_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`vendor_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
`vendor_archived_at` datetime DEFAULT NULL,
`vendor_client_id` int(11) DEFAULT NULL,
`company_id` int(11) NOT NULL,
@ -1444,4 +1440,4 @@ CREATE TABLE `vendors` (
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2022-04-14 22:58:14
-- Dump completed on 2022-05-06 12:03:14