<?php

$SQL = "create table exportjobs (

                     exportjob_serial         serial,
                     exportjob_export_code    char(36)                                     default null,
                     exportjob_subscription   bigint unsigned                              default null,
                     exportjob_export_type    varchar(255)                                 default null,
                     exportjob_status         enum('queued','running','complete','failed') not null default 'queued',
                     exportjob_file_name      varchar(255)                                 default null,
                     exportjob_file_path      varchar(1024)                                default null,
                     exportjob_file_type      varchar(10)                                  default null,
                     exportjob_notified       boolean                                      default false,
                     exportjob_download_token varchar(1024)                                default null,
                     exportjob_error_message  text                                         default null,
                     exportjob_creator        varchar(100)                                 default null,
                     exportjob_created        datetime                                     default null,
                     exportjob_completed      datetime                                     default null,

          primary key (exportjob_serial),
           unique key uq_export_job_code (exportjob_export_code),
                  key idx_status_created (exportjob_status, exportjob_created),
                  key idx_created_by (exportjob_creator),
                  key idx_token (exportjob_download_token) )";
?>