CREATE TABLE IF NOT EXISTS `maintenance_orders` (
  `id` text PRIMARY KEY NOT NULL,
  `vehicle` text NOT NULL,
  `task` text NOT NULL,
  `type` text NOT NULL,
  `status` text NOT NULL,
  `priority` text NOT NULL,
  `owner` text NOT NULL,
  `due` text NOT NULL,
  `cost` text NOT NULL,
  `category` text,
  `component_ref` text,
  `meter` text,
  `next_due` text,
  `created_by` text NOT NULL,
  `created_at` text NOT NULL,
  `updated_at` text NOT NULL
);
--> statement-breakpoint
CREATE INDEX IF NOT EXISTS `idx_maintenance_orders_status_due` ON `maintenance_orders` (`status`,`due`);
--> statement-breakpoint
PRAGMA optimize;
