created/updated timestamp update

Convert all created_at and modified_at fields to default to current timestamp/update timestamp.
We can cleanup the SQL code in post.php (and other places) to no longer manually set these values at a later date, but it will work fine for now
This commit is contained in:
Marcus Hill
2022-04-17 23:16:36 +01:00
parent 6091d373bc
commit a6833ac3a4
3 changed files with 185 additions and 87 deletions

166
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,
`account_updated_at` datetime DEFAULT NULL,
`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,8 +47,8 @@ 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,
`api_key_updated_at` datetime DEFAULT NULL,
`api_key_created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`api_key_updated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`api_key_expire` date NOT NULL,
`api_key_client_id` int(11) NOT NULL DEFAULT '0',
`company_id` int(11) NOT NULL,
@@ -79,8 +79,8 @@ CREATE TABLE `assets` (
`asset_reciept` varchar(200) DEFAULT NULL,
`asset_notes` text DEFAULT NULL,
`asset_meshcentral_id` varchar(200) DEFAULT NULL,
`asset_created_at` datetime NOT NULL,
`asset_updated_at` datetime DEFAULT NULL,
`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,
@@ -104,8 +104,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,
`calendar_updated_at` datetime DEFAULT NULL,
`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`)
@@ -131,8 +131,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,
`message_updated_at` datetime DEFAULT NULL,
`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,
@@ -157,8 +157,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,
`campaign_updated_at` datetime DEFAULT NULL,
`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`)
@@ -177,8 +177,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,
`category_updated_at` datetime DEFAULT NULL,
`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`)
@@ -200,8 +200,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,
`certificate_updated_at` datetime DEFAULT NULL,
`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,
@@ -241,8 +241,8 @@ CREATE TABLE `clients` (
`client_net_terms` int(10) NOT NULL,
`client_notes` text DEFAULT NULL,
`client_meshcentral_group` varchar(200) DEFAULT NULL,
`client_created_at` datetime NOT NULL,
`client_updated_at` datetime DEFAULT NULL,
`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,
@@ -273,8 +273,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,
`company_updated_at` datetime DEFAULT NULL,
`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;
@@ -300,8 +300,8 @@ 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,
`contact_updated_at` datetime DEFAULT NULL,
`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_id` int(11) DEFAULT NULL,
@@ -324,8 +324,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,
`contract_updated_at` datetime DEFAULT 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,
@@ -347,7 +347,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,
`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,8 +363,8 @@ DROP TABLE IF EXISTS `departments`;
CREATE TABLE `departments` (
`department_id` int(11) NOT NULL AUTO_INCREMENT,
`department_name` varchar(200) NOT NULL,
`department_created_at` datetime NOT NULL,
`department_updated_at` datetime DEFAULT NULL,
`department_created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`department_updated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`department_archived_at` datetime DEFAULT NULL,
`department_client_id` int(11) NOT NULL,
`company_id` int(11) NOT NULL,
@@ -399,8 +399,8 @@ 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,
`document_updated_at` datetime DEFAULT NULL,
`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,
@@ -445,8 +445,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,
`domain_updated_at` datetime DEFAULT NULL,
`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,
@@ -470,8 +470,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,
`event_updated_at` datetime DEFAULT NULL,
`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,
@@ -497,8 +497,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,
`expense_updated_at` datetime DEFAULT NULL,
`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,
@@ -522,8 +522,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,
`file_updated_at` datetime DEFAULT NULL,
`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,
@@ -560,7 +560,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,
`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,
@@ -586,8 +586,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,
`item_updated_at` datetime DEFAULT NULL,
`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,
@@ -617,8 +617,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,
`invoice_updated_at` datetime DEFAULT NULL,
`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,
@@ -646,8 +646,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,
`location_updated_at` datetime DEFAULT NULL,
`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,
@@ -672,8 +672,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,
`login_updated_at` datetime DEFAULT NULL,
`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,
@@ -699,7 +699,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,
`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,
@@ -746,8 +746,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,
`network_updated_at` datetime DEFAULT NULL,
`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,
@@ -790,8 +790,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,
`payment_updated_at` datetime DEFAULT NULL,
`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,
@@ -813,8 +813,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,
`product_updated_at` datetime DEFAULT NULL,
`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,
@@ -841,8 +841,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,
`quote_updated_at` datetime DEFAULT NULL,
`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,
@@ -864,7 +864,7 @@ 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,
`record_created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`record_updated_at` datetime NOT NULL,
`record_archived_at` datetime DEFAULT NULL,
`record_domain_id` int(11) NOT NULL,
@@ -892,8 +892,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,
`recurring_updated_at` datetime DEFAULT NULL,
`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,
@@ -917,8 +917,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,
`revenue_updated_at` datetime DEFAULT NULL,
`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,
@@ -958,8 +958,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,
`scheduled_ticket_updated_at` datetime DEFAULT 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_by` int(11) NOT NULL,
`scheduled_ticket_client_id` int(11) DEFAULT NULL,
`scheduled_ticket_contact_id` int(11) DEFAULT NULL,
@@ -1075,8 +1075,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,
`service_updated_at` datetime DEFAULT NULL,
`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,
@@ -1165,7 +1165,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,
`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`)
@@ -1190,8 +1190,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,
`software_updated_at` datetime DEFAULT NULL,
`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,
@@ -1241,8 +1241,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,
`tag_updated_at` datetime DEFAULT NULL,
`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;
@@ -1259,8 +1259,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,
`tax_updated_at` datetime DEFAULT NULL,
`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`)
@@ -1279,8 +1279,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,
`ticket_reply_updated_at` datetime 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_archived_at` datetime DEFAULT NULL,
`ticket_reply_by` int(11) NOT NULL,
`ticket_reply_ticket_id` int(11) NOT NULL,
@@ -1322,8 +1322,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,
`ticket_updated_at` datetime DEFAULT NULL,
`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,
@@ -1349,8 +1349,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,
`transfer_updated_at` datetime DEFAULT NULL,
`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,
@@ -1376,8 +1376,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,
`trip_updated_at` datetime DEFAULT NULL,
`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,
@@ -1448,8 +1448,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,
`user_updated_at` datetime DEFAULT NULL,
`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;
@@ -1479,8 +1479,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,
`vendor_updated_at` datetime DEFAULT NULL,
`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,