use ljimport;

drop table if exists iqueue;
drop table if exists ihistory;

# import requests
create table iqueue (
  importid int(10) unsigned NOT NULL auto_increment,
  remote_site varchar(255) NOT NULL,
  remote_protocol varchar(255) NOT NULL,
  remote_user varchar(20) NOT NULL,
  remote_pass varchar(255) NOT NULL,
  local_site varchar(255) NOT NULL,
  local_protocol varchar(255) NOT NULL,
  local_user varchar(20) NOT NULL,
  local_pass varchar(255) NOT NULL,
  opt_overwrite enum('0', '1') NOT NULL default '1',
  opt_comments enum('0', '1') NOT NULL default '0',
  PRIMARY KEY pi_id (importid),
  KEY s1_luser (local_user, importid)
);

# import history
create table ihistory (
  importid int(10) unsigned NOT NULL auto_increment,
  remote_site varchar(255) NOT NULL,
  remote_user varchar(20) NOT NULL,
  local_site varchar(255) NOT NULL,
  local_user varchar(20) NOT NULL,
  opt_overwrite enum('0', '1') NOT NULL default '1',
  opt_comments enum('0', '1') NOT NULL default '0',
  idate datetime NOT NULL default '0000-00-00 00:00:00',
  istatus varchar(20) NOT NULL,
  PRIMARY KEY pi_id (importid),
  KEY s1_luser (local_user, importid),
  KEY s2_idate (idate, local_user),
  KEY s3_istatus (istatus, local_user)
);
