-- Enquiries table schema CREATE TABLE IF NOT EXISTS `enquiries` ( `id` int(11) NOT NULL AUTO_INCREMENT, `created` datetime NOT NULL, `submitted` date DEFAULT NULL, `title` varchar(255) NOT NULL COMMENT 'enquirynumber', `user_id` int(11) NOT NULL, `customer_id` int(11) NOT NULL, `contact_id` int(11) NOT NULL, `contact_user_id` int(11) NOT NULL, `state_id` int(11) NOT NULL, `country_id` int(11) NOT NULL, `principle_id` int(11) NOT NULL, `status_id` int(11) NOT NULL, `comments` text NOT NULL, `principle_code` int(3) NOT NULL COMMENT 'Numeric Principle Code', `gst` tinyint(1) NOT NULL COMMENT 'GST applicable on this enquiry', `billing_address_id` int(11) DEFAULT NULL, `shipping_address_id` int(11) DEFAULT NULL, `posted` tinyint(1) NOT NULL COMMENT 'has the enquired been posted', `email_count` int(11) NOT NULL DEFAULT 0, `invoice_count` int(11) NOT NULL DEFAULT 0, `job_count` int(11) NOT NULL DEFAULT 0, `quote_count` int(11) NOT NULL DEFAULT 0, `archived` tinyint(4) NOT NULL DEFAULT 0, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;