Updated DB Structure Defaults and dropped some unused fields

This commit is contained in:
johnnyq 2023-01-23 21:43:45 -05:00
parent 058102bb47
commit 1aa7c7be3a
3 changed files with 381 additions and 90 deletions

View File

@ -467,11 +467,305 @@ if(LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION){
}
//if(CURRENT_DATABASE_VERSION == '0.3.1'){
// Insert queries here required to update to DB version 0.3.2
if (CURRENT_DATABASE_VERSION == '0.3.1') {
// Assets
mysqli_query($mysqli, "UPDATE `assets` SET `asset_login_id` = 0 WHERE `asset_login_id` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `assets` CHANGE `asset_login_id` `asset_login_id` INT(11) NOT NULL DEFAULT 0");
mysqli_query($mysqli, "UPDATE `assets` SET `asset_vendor_id` = 0 WHERE `asset_vendor_id` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `assets` CHANGE `asset_vendor_id` `asset_vendor_id` INT(11) NOT NULL DEFAULT 0");
mysqli_query($mysqli, "UPDATE `assets` SET `asset_location_id` = 0 WHERE `asset_location_id` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `assets` CHANGE `asset_location_id` `asset_location_id` INT(11) NOT NULL DEFAULT 0");
mysqli_query($mysqli, "UPDATE `assets` SET `asset_network_id` = 0 WHERE `asset_network_id` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `assets` CHANGE `asset_network_id` `asset_network_id` INT(11) NOT NULL DEFAULT 0");
mysqli_query($mysqli, "UPDATE `assets` SET `asset_client_id` = 0 WHERE `asset_client_id` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `assets` CHANGE `asset_client_id` `asset_client_id` INT(11) NOT NULL DEFAULT 0");
// Certificates
mysqli_query($mysqli, "UPDATE `certificates` SET `certificate_domain_id` = 0 WHERE `certificate_domain_id` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `certificates` CHANGE `certificate_domain_id` `certificate_domain_id` INT(11) NOT NULL DEFAULT 0");
mysqli_query($mysqli, "ALTER TABLE `certificates` CHANGE `certificate_client_id` `certificate_client_id` INT(11) NOT NULL DEFAULT 0");
// Clients
mysqli_query($mysqli, "UPDATE `clients` SET `primary_location` = 0 WHERE `primary_location` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `clients` CHANGE `primary_location` `primary_location` INT(11) NOT NULL DEFAULT 0");
mysqli_query($mysqli, "UPDATE `clients` SET `primary_contact` = 0 WHERE `primary_contact` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `clients` CHANGE `primary_contact` `primary_contact` INT(11) NOT NULL DEFAULT 0");
// Contacts
mysqli_query($mysqli, "UPDATE `contacts` SET `contact_location_id` = 0 WHERE `contact_location_id` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `contacts` CHANGE `contact_location_id` `contact_location_id` INT(11) NOT NULL DEFAULT 0");
mysqli_query($mysqli, "ALTER TABLE `contacts` CHANGE `contact_client_id` `contact_client_id` INT(11) NOT NULL DEFAULT 0");
// Documents
mysqli_query($mysqli, "ALTER TABLE `documents` CHANGE `document_template` `document_template` TINYINT(1) NOT NULL DEFAULT 0");
mysqli_query($mysqli, "UPDATE `documents` SET `document_folder_id` = 0 WHERE `document_folder_id` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `documents` CHANGE `document_folder_id` `document_folder_id` INT(11) NOT NULL DEFAULT 0");
mysqli_query($mysqli, "ALTER TABLE `documents` CHANGE `document_client_id` `document_client_id` INT(11) NOT NULL DEFAULT 0");
// Domains
mysqli_query($mysqli, "UPDATE `domains` SET `domain_registrar` = 0 WHERE `domain_registrar` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `domains` CHANGE `domain_registrar` `domain_registrar` INT(11) NOT NULL DEFAULT 0");
mysqli_query($mysqli, "UPDATE `domains` SET `domain_webhost` = 0 WHERE `domain_webhost` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `domains` CHANGE `domain_webhost` `domain_webhost` INT(11) NOT NULL DEFAULT 0");
mysqli_query($mysqli, "ALTER TABLE `domains` CHANGE `domain_client_id` `domain_client_id` INT(11) NOT NULL DEFAULT 0");
// Events
mysqli_query($mysqli, "UPDATE `events` SET `event_client_id` = 0 WHERE `event_client_id` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `events` CHANGE `event_client_id` `event_client_id` INT(11) NOT NULL DEFAULT 0");
mysqli_query($mysqli, "UPDATE `events` SET `event_location_id` = 0 WHERE `event_location_id` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `events` CHANGE `event_location_id` `event_location_id` INT(11) NOT NULL DEFAULT 0");
mysqli_query($mysqli, "ALTER TABLE `events` CHANGE `event_calendar_id` `event_calendar_id` INT(11) NOT NULL DEFAULT 0");
// Expenses
mysqli_query($mysqli, "UPDATE `expenses` SET `expense_vendor_id` = 0 WHERE `expense_vendor_id` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `expenses` CHANGE `expense_vendor_id` `expense_vendor_id` INT(11) NOT NULL DEFAULT 0");
mysqli_query($mysqli, "UPDATE `expenses` SET `expense_client_id` = 0 WHERE `expense_client_id` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `expenses` CHANGE `expense_client_id` `expense_client_id` INT(11) NOT NULL DEFAULT 0");
mysqli_query($mysqli, "UPDATE `expenses` SET `expense_category_id` = 0 WHERE `expense_category_id` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `expenses` CHANGE `expense_category_id` `expense_category_id` INT(11) NOT NULL DEFAULT 0");
// Files
mysqli_query($mysqli, "ALTER TABLE `files` CHANGE `file_client_id` `file_client_id` INT(11) NOT NULL DEFAULT 0");
// Folders
mysqli_query($mysqli, "UPDATE `folders` SET `parent_folder` = 0 WHERE `parent_folder` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `folders` CHANGE `parent_folder` `parent_folder` INT(11) NOT NULL DEFAULT 0");
mysqli_query($mysqli, "ALTER TABLE `folders` CHANGE `folder_client_id` `folder_client_id` INT(11) NOT NULL DEFAULT 0");
// History
mysqli_query($mysqli, "UPDATE `history` SET `history_invoice_id` = 0 WHERE `history_invoice_id` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `history` CHANGE `history_invoice_id` `history_invoice_id` INT(11) NOT NULL DEFAULT 0");
mysqli_query($mysqli, "UPDATE `history` SET `history_recurring_id` = 0 WHERE `history_recurring_id` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `history` CHANGE `history_recurring_id` `history_recurring_id` INT(11) NOT NULL DEFAULT 0");
mysqli_query($mysqli, "UPDATE `history` SET `history_quote_id` = 0 WHERE `history_quote_id` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `history` CHANGE `history_quote_id` `history_quote_id` INT(11) NOT NULL DEFAULT 0");
// Invoices
mysqli_query($mysqli, "UPDATE `invoices` SET `invoice_amount` = 0.00 WHERE `invoice_amount` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `invoices` CHANGE `invoice_amount` `invoice_amount` DECIMAL(15,2) NOT NULL DEFAULT 0.00");
// Invoice Items
mysqli_query($mysqli, "ALTER TABLE `invoice_items` CHANGE `item_quantity` `item_quantity` DECIMAL(15,2) NOT NULL DEFAULT 0.00");
mysqli_query($mysqli, "ALTER TABLE `invoice_items` CHANGE `item_price` `item_price` DECIMAL(15,2) NOT NULL DEFAULT 0.00");
mysqli_query($mysqli, "ALTER TABLE `invoice_items` CHANGE `item_subtotal` `item_subtotal` DECIMAL(15,2) NOT NULL DEFAULT 0.00");
mysqli_query($mysqli, "UPDATE `invoice_items` SET `item_tax` = 0.00 WHERE `item_tax` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `invoice_items` CHANGE `item_tax` `item_tax` DECIMAL(15,2) NOT NULL DEFAULT 0.00");
mysqli_query($mysqli, "ALTER TABLE `invoice_items` CHANGE `item_total` `item_total` DECIMAL(15,2) NOT NULL DEFAULT 0.00");
mysqli_query($mysqli, "UPDATE `invoice_items` SET `item_tax_id` = 0 WHERE `item_tax_id` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `invoice_items` CHANGE `item_tax_id` `item_tax_id` INT(11) NOT NULL DEFAULT 0");
mysqli_query($mysqli, "UPDATE `invoice_items` SET `item_quote_id` = 0 WHERE `item_quote_id` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `invoice_items` CHANGE `item_quote_id` `item_quote_id` INT(11) NOT NULL DEFAULT 0");
mysqli_query($mysqli, "UPDATE `invoice_items` SET `item_recurring_id` = 0 WHERE `item_recurring_id` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `invoice_items` CHANGE `item_recurring_id` `item_recurring_id` INT(11) NOT NULL DEFAULT 0");
mysqli_query($mysqli, "UPDATE `invoice_items` SET `item_invoice_id` = 0 WHERE `item_invoice_id` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `invoice_items` CHANGE `item_invoice_id` `item_invoice_id` INT(11) NOT NULL DEFAULT 0");
// Locations
mysqli_query($mysqli, "UPDATE `locations` SET `location_contact_id` = 0 WHERE `location_contact_id` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `locations` CHANGE `location_contact_id` `location_contact_id` INT(11) NOT NULL DEFAULT 0");
mysqli_query($mysqli, "UPDATE `locations` SET `location_client_id` = 0 WHERE `location_client_id` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `locations` CHANGE `location_client_id` `location_client_id` INT(11) NOT NULL DEFAULT 0");
// Logins
mysqli_query($mysqli, "UPDATE `logins` SET `login_vendor_id` = 0 WHERE `login_vendor_id` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `logins` CHANGE `login_vendor_id` `login_vendor_id` INT(11) NOT NULL DEFAULT 0");
mysqli_query($mysqli, "UPDATE `logins` SET `login_asset_id` = 0 WHERE `login_asset_id` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `logins` CHANGE `login_asset_id` `login_asset_id` INT(11) NOT NULL DEFAULT 0");
mysqli_query($mysqli, "UPDATE `logins` SET `login_software_id` = 0 WHERE `login_software_id` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `logins` CHANGE `login_software_id` `login_software_id` INT(11) NOT NULL DEFAULT 0");
mysqli_query($mysqli, "UPDATE `logins` SET `login_client_id` = 0 WHERE `login_client_id` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `logins` CHANGE `login_client_id` `login_client_id` INT(11) NOT NULL DEFAULT 0");
// Logs
mysqli_query($mysqli, "UPDATE `logs` SET `log_client_id` = 0 WHERE `log_client_id` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `logs` CHANGE `log_client_id` `log_client_id` INT(11) NOT NULL DEFAULT 0");
mysqli_query($mysqli, "ALTER TABLE `logs` DROP `log_invoice_id`");
mysqli_query($mysqli, "ALTER TABLE `logs` DROP `log_quote_id`");
mysqli_query($mysqli, "ALTER TABLE `logs` DROP `log_recurring_id`");
mysqli_query($mysqli, "ALTER TABLE `logs` DROP `log_entity_id`");
mysqli_query($mysqli, "UPDATE `logs` SET `log_user_id` = 0 WHERE `log_user_id` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `logs` CHANGE `log_user_id` `log_user_id` INT(11) NOT NULL DEFAULT 0");
// Networks
mysqli_query($mysqli, "UPDATE `networks` SET `network_location_id` = 0 WHERE `network_location_id` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `networks` CHANGE `network_location_id` `network_location_id` INT(11) NOT NULL DEFAULT 0");
mysqli_query($mysqli, "ALTER TABLE `networks` CHANGE `network_client_id` `network_client_id` INT(11) NOT NULL DEFAULT 0");
// Notifications
mysqli_query($mysqli, "UPDATE `notifications` SET `notification_client_id` = 0 WHERE `notification_client_id` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `notifications` CHANGE `notification_client_id` `notification_client_id` INT(11) NOT NULL DEFAULT 0");
mysqli_query($mysqli, "ALTER TABLE `notifications` CHANGE `notification_user_id` `notification_user_id` INT(11) NOT NULL DEFAULT 0");
// Payments
mysqli_query($mysqli, "UPDATE `payments` SET `payment_invoice_id` = 0 WHERE `payment_invoice_id` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `payments` CHANGE `payment_invoice_id` `payment_invoice_id` INT(11) NOT NULL DEFAULT 0");
// Products
mysqli_query($mysqli, "UPDATE `products` SET `product_tax_id` = 0 WHERE `product_tax_id` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `products` CHANGE `product_tax_id` `product_tax_id` INT(11) NOT NULL DEFAULT 0");
// Quotes
mysqli_query($mysqli, "UPDATE `quotes` SET `quote_amount` = 0.00 WHERE `quote_amount` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `quotes` CHANGE `quote_amount` `quote_amount` DECIMAL(15,2) NOT NULL DEFAULT 0.00");
// Recurring
mysqli_query($mysqli, "UPDATE `recurring` SET `recurring_amount` = 0.00 WHERE `recurring_amount` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `recurring` CHANGE `recurring_amount` `recurring_amount` DECIMAL(15,2) NOT NULL DEFAULT 0.00");
// Revenues
mysqli_query($mysqli, "UPDATE `revenues` SET `revenue_amount` = 0.00 WHERE `revenue_amount` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `revenues` CHANGE `revenue_amount` `revenue_amount` DECIMAL(15,2) NOT NULL DEFAULT 0.00");
mysqli_query($mysqli, "UPDATE `revenues` SET `revenue_category_id` = 0 WHERE `revenue_category_id` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `revenues` CHANGE `revenue_category_id` `revenue_category_id` INT(11) NOT NULL DEFAULT 0");
mysqli_query($mysqli, "UPDATE `revenues` SET `revenue_client_id` = 0 WHERE `revenue_client_id` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `revenues` CHANGE `revenue_client_id` `revenue_client_id` INT(11) NOT NULL DEFAULT 0");
// Scheduled Tickets
mysqli_query($mysqli, "ALTER TABLE `scheduled_tickets` CHANGE `scheduled_ticket_created_by` `scheduled_ticket_created_by` INT(11) NOT NULL DEFAULT 0");
mysqli_query($mysqli, "UPDATE `scheduled_tickets` SET `scheduled_ticket_client_id` = 0 WHERE `scheduled_ticket_client_id` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `scheduled_tickets` CHANGE `scheduled_ticket_client_id` `scheduled_ticket_client_id` INT(11) NOT NULL DEFAULT 0");
mysqli_query($mysqli, "UPDATE `scheduled_tickets` SET `scheduled_ticket_contact_id` = 0 WHERE `scheduled_ticket_contact_id` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `scheduled_tickets` CHANGE `scheduled_ticket_contact_id` `scheduled_ticket_contact_id` INT(11) NOT NULL DEFAULT 0");
mysqli_query($mysqli, "UPDATE `scheduled_tickets` SET `scheduled_ticket_asset_id` = 0 WHERE `scheduled_ticket_asset_id` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `scheduled_tickets` CHANGE `scheduled_ticket_asset_id` `scheduled_ticket_asset_id` INT(11) NOT NULL DEFAULT 0");
// Settings
mysqli_query($mysqli, "ALTER TABLE `settings` CHANGE `config_ticket_email_parse` `config_ticket_email_parse` TINYINT(1) NOT NULL DEFAULT 0");
mysqli_query($mysqli, "ALTER TABLE `settings` CHANGE `config_ticket_client_general_notifications` `config_ticket_client_general_notifications` TINYINT(1) NOT NULL DEFAULT 1");
mysqli_query($mysqli, "ALTER TABLE `settings` CHANGE `config_enable_cron` `config_enable_cron` TINYINT(1) NOT NULL DEFAULT 0");
mysqli_query($mysqli, "ALTER TABLE `settings` CHANGE `config_recurring_auto_send_invoice` `config_recurring_auto_send_invoice` TINYINT(1) NOT NULL DEFAULT 1");
mysqli_query($mysqli, "UPDATE `settings` SET `config_enable_alert_domain_expire` = 1 WHERE `config_enable_alert_domain_expire` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `settings` CHANGE `config_enable_alert_domain_expire` `config_enable_alert_domain_expire` TINYINT(1) NOT NULL DEFAULT 1");
mysqli_query($mysqli, "UPDATE `settings` SET `config_send_invoice_reminders` = 1 WHERE `config_send_invoice_reminders` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `settings` CHANGE `config_send_invoice_reminders` `config_send_invoice_reminders` TINYINT(1) NOT NULL DEFAULT 1");
mysqli_query($mysqli, "UPDATE `settings` SET `config_stripe_enable` = 0 WHERE `config_stripe_enable` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `settings` CHANGE `config_stripe_enable` `config_stripe_enable` TINYINT(1) NOT NULL DEFAULT 0");
// Software
mysqli_query($mysqli, "UPDATE `software` SET `software_template` = 0 WHERE `software_template` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `software` CHANGE `software_template` `software_template` TINYINT(1) NOT NULL DEFAULT 0");
mysqli_query($mysqli, "UPDATE `software` SET `software_login_id` = 0 WHERE `software_login_id` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `software` CHANGE `software_login_id` `software_login_id` INT(11) NOT NULL DEFAULT 0");
// Tags
mysqli_query($mysqli, "ALTER TABLE `tags` ADD `tag_archived_at` DATETIME NULL DEFAULT NULL AFTER `tag_updated_at`");
// Tickets
mysqli_query($mysqli, "UPDATE `tickets` SET `ticket_closed_by` = 0 WHERE `ticket_closed_by` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `tickets` CHANGE `ticket_closed_by` `ticket_closed_by` INT(11) NOT NULL DEFAULT 0");
mysqli_query($mysqli, "UPDATE `tickets` SET `ticket_vendor_id` = 0 WHERE `ticket_vendor_id` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `tickets` CHANGE `ticket_vendor_id` `ticket_vendor_id` INT(11) NOT NULL DEFAULT 0");
mysqli_query($mysqli, "UPDATE `tickets` SET `ticket_client_id` = 0 WHERE `ticket_client_id` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `tickets` CHANGE `ticket_client_id` `ticket_client_id` INT(11) NOT NULL DEFAULT 0");
mysqli_query($mysqli, "UPDATE `tickets` SET `ticket_contact_id` = 0 WHERE `ticket_contact_id` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `tickets` CHANGE `ticket_contact_id` `ticket_contact_id` INT(11) NOT NULL DEFAULT 0");
mysqli_query($mysqli, "UPDATE `tickets` SET `ticket_location_id` = 0 WHERE `ticket_location_id` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `tickets` CHANGE `ticket_location_id` `ticket_location_id` INT(11) NOT NULL DEFAULT 0");
mysqli_query($mysqli, "UPDATE `tickets` SET `ticket_asset_id` = 0 WHERE `ticket_asset_id` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `tickets` CHANGE `ticket_asset_id` `ticket_asset_id` INT(11) NOT NULL DEFAULT 0");
//Trips
mysqli_query($mysqli, "UPDATE `trips` SET `trip_client_id` = 0 WHERE `trip_client_id` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `trips` CHANGE `trip_client_id` `trip_client_id` INT(11) NOT NULL DEFAULT 0");
// Users
mysqli_query($mysqli, "ALTER TABLE `users` CHANGE `user_status` `user_status` TINYINT(1) NOT NULL DEFAULT 1");
// Vendors
mysqli_query($mysqli, "ALTER TABLE `vendors` CHANGE `vendor_template` `vendor_template` TINYINT(1) NOT NULL DEFAULT 0");
mysqli_query($mysqli, "UPDATE `vendors` SET `vendor_client_id` = 0 WHERE `vendor_client_id` IS NULL");
mysqli_query($mysqli, "ALTER TABLE `vendors` CHANGE `vendor_client_id` `vendor_client_id` INT(11) NOT NULL DEFAULT 0");
// Then, update the database to the next sequential version
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.3.2'");
}
//if(CURRENT_DATABASE_VERSION == '0.3.2'){
// Insert queries here required to update to DB version 0.3.3
// Then, update the database to the next sequential version
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.3.2'");
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.3.3'");
//}

View File

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

169
db.sql
View File

@ -122,12 +122,12 @@ CREATE TABLE `assets` (
`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,
`asset_location_id` int(11) 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,
`asset_network_id` int(11) DEFAULT NULL,
`asset_client_id` int(11) DEFAULT NULL,
`asset_network_id` int(11) NOT NULL DEFAULT 0,
`asset_client_id` int(11) NOT NULL DEFAULT 0,
`company_id` int(11) NOT NULL,
PRIMARY KEY (`asset_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
@ -190,8 +190,8 @@ CREATE TABLE `certificates` (
`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,
`certificate_domain_id` int(11) NOT NULL DEFAULT 0,
`certificate_client_id` int(11) NOT NULL DEFAULT 0,
`company_id` int(11) NOT NULL,
PRIMARY KEY (`certificate_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
@ -231,8 +231,8 @@ CREATE TABLE `clients` (
`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,
`primary_contact` int(11) DEFAULT NULL,
`primary_location` int(11) NOT NULL DEFAULT 0,
`primary_contact` int(11) NOT NULL DEFAULT 0,
`company_id` int(11) NOT NULL,
PRIMARY KEY (`client_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
@ -347,9 +347,9 @@ CREATE TABLE `contacts` (
`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_location_id` int(11) NOT NULL DEFAULT 0,
`contact_department` varchar(200) DEFAULT NULL,
`contact_client_id` int(11) NOT NULL,
`contact_client_id` int(11) NOT NULL DEFAULT 0,
`company_id` int(11) NOT NULL,
PRIMARY KEY (`contact_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
@ -370,9 +370,9 @@ CREATE TABLE `documents` (
`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_client_id` int(11) NOT NULL,
`document_template` tinyint(1) NOT NULL DEFAULT 0,
`document_folder_id` int(11) NOT NULL DEFAULT 0,
`document_client_id` int(11) NOT NULL DEFAULT 0,
`company_id` int(11) NOT NULL,
PRIMARY KEY (`document_id`),
FULLTEXT KEY `document_content_raw` (`document_content_raw`)
@ -398,9 +398,9 @@ CREATE TABLE `domains` (
`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,
`domain_client_id` int(11) NOT NULL,
`domain_registrar` int(11) NOT NULL DEFAULT 0,
`domain_webhost` int(11) NOT NULL DEFAULT 0,
`domain_client_id` int(11) NOT NULL DEFAULT 0,
`company_id` int(11) NOT NULL,
PRIMARY KEY (`domain_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
@ -423,9 +423,9 @@ CREATE TABLE `events` (
`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,
`event_calendar_id` int(11) NOT NULL,
`event_client_id` int(11) NOT NULL DEFAULT 0,
`event_location_id` int(11) NOT NULL DEFAULT 0,
`event_calendar_id` int(11) NOT NULL DEFAULT 0,
`company_id` int(11) NOT NULL,
PRIMARY KEY (`event_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
@ -450,9 +450,9 @@ CREATE TABLE `expenses` (
`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,
`expense_category_id` int(11) DEFAULT NULL,
`expense_vendor_id` int(11) NOT NULL DEFAULT 0,
`expense_client_id` int(11) NOT NULL DEFAULT 0,
`expense_category_id` int(11) NOT NULL DEFAULT 0,
`expense_account_id` int(11) DEFAULT NULL,
`company_id` int(11) NOT NULL,
PRIMARY KEY (`expense_id`)
@ -474,7 +474,7 @@ CREATE TABLE `files` (
`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_client_id` int(11) NOT NULL,
`file_client_id` int(11) NOT NULL DEFAULT 0,
`company_id` int(11) NOT NULL,
PRIMARY KEY (`file_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
@ -490,8 +490,8 @@ DROP TABLE IF EXISTS `folders`;
CREATE TABLE `folders` (
`folder_id` int(11) NOT NULL AUTO_INCREMENT,
`folder_name` varchar(200) NOT NULL,
`parent_folder` int(11) DEFAULT NULL,
`folder_client_id` int(11) DEFAULT NULL,
`parent_folder` int(11) NOT NULL DEFAULT 0,
`folder_client_id` int(11) NOT NULL DEFAULT 0,
`company_id` int(11) NOT NULL,
PRIMARY KEY (`folder_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
@ -509,9 +509,9 @@ CREATE TABLE `history` (
`history_status` varchar(200) NOT NULL,
`history_description` varchar(200) NOT NULL,
`history_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`history_invoice_id` int(11) DEFAULT NULL,
`history_recurring_id` int(11) DEFAULT NULL,
`history_quote_id` int(11) DEFAULT NULL,
`history_invoice_id` int(11) NOT NULL DEFAULT 0,
`history_recurring_id` int(11) NOT NULL DEFAULT 0,
`history_quote_id` int(11) NOT NULL DEFAULT 0,
`company_id` int(11) NOT NULL,
PRIMARY KEY (`history_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
@ -552,18 +552,18 @@ CREATE TABLE `invoice_items` (
`item_id` int(11) NOT NULL AUTO_INCREMENT,
`item_name` varchar(200) NOT NULL,
`item_description` text DEFAULT NULL,
`item_quantity` decimal(15,2) NOT NULL,
`item_price` decimal(15,2) NOT NULL,
`item_subtotal` decimal(15,2) NOT NULL,
`item_tax` decimal(15,2) DEFAULT NULL,
`item_total` decimal(15,2) NOT NULL,
`item_quantity` decimal(15,2) NOT NULL DEFAULT 0.00,
`item_price` decimal(15,2) NOT NULL DEFAULT 0.00,
`item_subtotal` decimal(15,2) NOT NULL DEFAULT 0.00,
`item_tax` decimal(15,2) NOT NULL DEFAULT 0.00,
`item_total` decimal(15,2) NOT NULL DEFAULT 0.00,
`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,
`item_recurring_id` int(11) DEFAULT NULL,
`item_invoice_id` int(11) DEFAULT NULL,
`item_tax_id` int(11) NOT NULL DEFAULT 0,
`item_quote_id` int(11) NOT NULL DEFAULT 0,
`item_recurring_id` int(11) NOT NULL DEFAULT 0,
`item_invoice_id` int(11) NOT NULL DEFAULT 0,
`company_id` int(11) NOT NULL,
PRIMARY KEY (`item_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
@ -584,7 +584,7 @@ CREATE TABLE `invoices` (
`invoice_status` varchar(200) NOT NULL,
`invoice_date` date NOT NULL,
`invoice_due` date NOT NULL,
`invoice_amount` decimal(15,2) DEFAULT NULL,
`invoice_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
`invoice_currency_code` varchar(200) NOT NULL,
`invoice_note` text DEFAULT NULL,
`invoice_url_key` varchar(200) DEFAULT NULL,
@ -620,8 +620,8 @@ CREATE TABLE `locations` (
`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,
`location_contact_id` int(11) NOT NULL DEFAULT 0,
`location_client_id` int(11) NOT NULL DEFAULT 0,
`company_id` int(11) NOT NULL,
PRIMARY KEY (`location_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
@ -647,10 +647,10 @@ CREATE TABLE `logins` (
`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,
`login_asset_id` int(11) DEFAULT NULL,
`login_software_id` int(11) DEFAULT NULL,
`login_client_id` int(11) DEFAULT NULL,
`login_vendor_id` int(11) NOT NULL DEFAULT 0,
`login_asset_id` int(11) NOT NULL DEFAULT 0,
`login_software_id` int(11) NOT NULL DEFAULT 0,
`login_client_id` int(11) NOT NULL DEFAULT 0,
`company_id` int(11) NOT NULL,
PRIMARY KEY (`login_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
@ -671,12 +671,8 @@ CREATE TABLE `logs` (
`log_ip` varchar(200) DEFAULT NULL,
`log_user_agent` varchar(250) DEFAULT NULL,
`log_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`log_client_id` int(11) DEFAULT NULL,
`log_invoice_id` int(11) DEFAULT NULL,
`log_quote_id` int(11) DEFAULT NULL,
`log_recurring_id` int(11) DEFAULT NULL,
`log_user_id` int(11) DEFAULT NULL,
`log_entity_id` int(11) NOT NULL DEFAULT 0,
`log_client_id` int(11) NOT NULL DEFAULT 0,
`log_user_id` int(11) NOT NULL DEFAULT 0,
`company_id` int(11) DEFAULT NULL,
PRIMARY KEY (`log_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
@ -700,8 +696,8 @@ CREATE TABLE `networks` (
`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,
`network_location_id` int(11) NOT NULL DEFAULT 0,
`network_client_id` int(11) NOT NULL DEFAULT 0,
`company_id` int(11) NOT NULL,
PRIMARY KEY (`network_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
@ -721,8 +717,8 @@ CREATE TABLE `notifications` (
`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,
`notification_user_id` tinyint(1) DEFAULT 0,
`notification_client_id` int(11) NOT NULL DEFAULT 0,
`notification_user_id` int(11) NOT NULL DEFAULT 0,
`company_id` int(11) NOT NULL,
PRIMARY KEY (`notification_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
@ -746,7 +742,7 @@ CREATE TABLE `payments` (
`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,
`payment_invoice_id` int(11) NOT NULL DEFAULT 0,
`company_id` int(11) NOT NULL,
PRIMARY KEY (`payment_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
@ -768,7 +764,7 @@ CREATE TABLE `products` (
`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_tax_id` int(11) NOT NULL DEFAULT 0,
`product_category_id` int(11) NOT NULL,
`company_id` int(11) NOT NULL,
PRIMARY KEY (`product_id`)
@ -789,7 +785,7 @@ CREATE TABLE `quotes` (
`quote_scope` varchar(255) DEFAULT NULL,
`quote_status` varchar(200) NOT NULL,
`quote_date` date NOT NULL,
`quote_amount` decimal(15,2) DEFAULT NULL,
`quote_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
`quote_currency_code` varchar(200) NOT NULL,
`quote_note` text DEFAULT NULL,
`quote_url_key` varchar(200) DEFAULT NULL,
@ -841,7 +837,7 @@ CREATE TABLE `recurring` (
`recurring_last_sent` date DEFAULT NULL,
`recurring_next_date` date NOT NULL,
`recurring_status` int(1) NOT NULL,
`recurring_amount` decimal(15,2) DEFAULT NULL,
`recurring_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
`recurring_currency_code` varchar(200) NOT NULL,
`recurring_note` text DEFAULT NULL,
`recurring_created_at` datetime NOT NULL DEFAULT current_timestamp(),
@ -864,7 +860,7 @@ DROP TABLE IF EXISTS `revenues`;
CREATE TABLE `revenues` (
`revenue_id` int(11) NOT NULL AUTO_INCREMENT,
`revenue_date` date NOT NULL,
`revenue_amount` decimal(15,2) NOT NULL,
`revenue_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
`revenue_currency_code` varchar(200) NOT NULL,
`revenue_payment_method` varchar(200) DEFAULT NULL,
`revenue_reference` varchar(200) DEFAULT NULL,
@ -872,9 +868,9 @@ CREATE TABLE `revenues` (
`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_category_id` int(11) NOT NULL DEFAULT 0,
`revenue_account_id` int(11) NOT NULL,
`revenue_client_id` int(11) DEFAULT NULL,
`revenue_client_id` int(11) NOT NULL DEFAULT 0,
`company_id` int(11) NOT NULL,
PRIMARY KEY (`revenue_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
@ -898,10 +894,10 @@ CREATE TABLE `scheduled_tickets` (
`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_by` int(11) NOT NULL,
`scheduled_ticket_client_id` int(11) DEFAULT NULL,
`scheduled_ticket_contact_id` int(11) DEFAULT NULL,
`scheduled_ticket_asset_id` int(11) DEFAULT NULL,
`scheduled_ticket_created_by` int(11) NOT NULL DEFAULT 0,
`scheduled_ticket_client_id` int(11) NOT NULL DEFAULT 0,
`scheduled_ticket_contact_id` int(11) NOT NULL DEFAULT 0,
`scheduled_ticket_asset_id` int(11) NOT NULL DEFAULT 0,
`company_id` int(11) NOT NULL,
PRIMARY KEY (`scheduled_ticket_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
@ -1066,14 +1062,14 @@ CREATE TABLE `settings` (
`config_ticket_next_number` int(11) DEFAULT NULL,
`config_ticket_from_name` varchar(200) DEFAULT NULL,
`config_ticket_from_email` varchar(200) DEFAULT NULL,
`config_ticket_email_parse` int(1) NOT NULL DEFAULT 0,
`config_ticket_client_general_notifications` int(1) NOT NULL DEFAULT 1,
`config_enable_cron` tinyint(1) DEFAULT NULL,
`config_recurring_auto_send_invoice` tinyint(1) DEFAULT NULL,
`config_enable_alert_domain_expire` tinyint(1) DEFAULT NULL,
`config_send_invoice_reminders` tinyint(1) DEFAULT NULL,
`config_ticket_email_parse` tinyint(1) NOT NULL DEFAULT 0,
`config_ticket_client_general_notifications` tinyint(1) NOT NULL DEFAULT 1,
`config_enable_cron` tinyint(1) NOT NULL DEFAULT 0,
`config_recurring_auto_send_invoice` tinyint(1) NOT NULL DEFAULT 1,
`config_enable_alert_domain_expire` tinyint(1) NOT NULL DEFAULT 1,
`config_send_invoice_reminders` tinyint(1) NOT NULL DEFAULT 1,
`config_invoice_overdue_reminders` varchar(200) DEFAULT NULL,
`config_stripe_enable` tinyint(1) DEFAULT NULL,
`config_stripe_enable` tinyint(1) NOT NULL DEFAULT 0,
`config_stripe_publishable` varchar(255) DEFAULT NULL,
`config_stripe_secret` varchar(255) DEFAULT NULL,
`config_azure_client_id` varchar(200) DEFAULT NULL,
@ -1128,11 +1124,11 @@ CREATE TABLE `software` (
`software_purchase` date DEFAULT NULL,
`software_expire` date DEFAULT NULL,
`software_notes` text DEFAULT NULL,
`software_template` tinyint(1) DEFAULT 0,
`software_template` tinyint(1) NOT NULL DEFAULT 0,
`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_login_id` int(11) NOT NULL DEFAULT 0,
`software_client_id` int(11) NOT NULL,
`company_id` int(11) NOT NULL,
PRIMARY KEY (`software_id`)
@ -1224,6 +1220,7 @@ CREATE TABLE `tags` (
`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_archived_at` datetime DEFAULT NULL,
`company_id` int(11) NOT NULL,
PRIMARY KEY (`tag_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
@ -1309,12 +1306,12 @@ CREATE TABLE `tickets` (
`ticket_closed_at` datetime DEFAULT NULL,
`ticket_created_by` int(11) NOT NULL,
`ticket_assigned_to` int(11) NOT NULL DEFAULT 0,
`ticket_closed_by` int(11) DEFAULT NULL,
`ticket_vendor_id` int(11) DEFAULT NULL,
`ticket_client_id` int(11) DEFAULT NULL,
`ticket_contact_id` int(11) DEFAULT NULL,
`ticket_location_id` int(11) DEFAULT NULL,
`ticket_asset_id` int(11) DEFAULT NULL,
`ticket_closed_by` int(11) NOT NULL DEFAULT 0,
`ticket_vendor_id` int(11) NOT NULL DEFAULT 0,
`ticket_client_id` int(11) NOT NULL DEFAULT 0,
`ticket_contact_id` int(11) NOT NULL DEFAULT 0,
`ticket_location_id` int(11) NOT NULL DEFAULT 0,
`ticket_asset_id` int(11) NOT NULL DEFAULT 0,
`company_id` int(11) NOT NULL,
PRIMARY KEY (`ticket_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
@ -1361,7 +1358,7 @@ CREATE TABLE `trips` (
`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,
`trip_client_id` int(11) NOT NULL DEFAULT 0,
`company_id` int(11) NOT NULL,
PRIMARY KEY (`trip_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
@ -1424,7 +1421,7 @@ CREATE TABLE `users` (
`user_name` varchar(200) NOT NULL,
`user_email` varchar(200) NOT NULL,
`user_password` varchar(200) NOT NULL,
`user_status` tinyint(1) DEFAULT 1,
`user_status` tinyint(1) NOT NULL DEFAULT 1,
`user_token` varchar(200) DEFAULT NULL,
`user_avatar` varchar(200) DEFAULT NULL,
`user_specific_encryption_ciphertext` varchar(200) DEFAULT NULL,
@ -1500,11 +1497,11 @@ CREATE TABLE `vendors` (
`vendor_code` varchar(200) DEFAULT NULL,
`vendor_account_number` varchar(200) DEFAULT NULL,
`vendor_notes` text DEFAULT NULL,
`vendor_template` tinyint(1) DEFAULT 0,
`vendor_template` tinyint(1) NOT NULL DEFAULT 0,
`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,
`vendor_client_id` int(11) NOT NULL DEFAULT 0,
`company_id` int(11) NOT NULL,
PRIMARY KEY (`vendor_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
@ -1519,4 +1516,4 @@ CREATE TABLE `vendors` (
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2023-01-22 20:00:27
-- Dump completed on 2023-01-23 21:43:07