-- Purchase Orders table schema (extracted from existing database)
CREATE TABLE IF NOT EXISTS `purchase_orders` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `issue_date` date NOT NULL,
  `dispatch_date` date NOT NULL,
  `date_arrived` date NOT NULL,
  `title` varchar(255) NOT NULL COMMENT 'CMC PONumber',
  `principle_id` int(11) NOT NULL,
  `principle_reference` varchar(255) NOT NULL,
  `document_id` int(11) NOT NULL,
  `currency_id` int(11) DEFAULT NULL,
  `ordered_from` text NOT NULL,
  `description` text NOT NULL,
  `dispatch_by` varchar(255) NOT NULL,
  `deliver_to` text NOT NULL,
  `shipping_instructions` text NOT NULL,
  `jobs_text` varchar(512) NOT NULL,
  `freight_forwarder_text` text NOT NULL DEFAULT '',
  `parent_purchase_order_id` int(11) NOT NULL DEFAULT 0,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;