  status enum('unavailable', 'corrupted', 'OK')
 ) ENGINE=InnoDB;
 
+CREATE TABLE wp4_table (
+ id SERIAL PRIMARY KEY,
+ local_id BIGINT UNSIGNED, FOREIGN KEY(local_id) REFERENCES ldata_table(uid) ON DELETE SET NULL ,
+ global_id VARCHAR(255),
+ views INT UNSIGNED NOT NULL DEFAULT 0,
+ need_update BOOLEAN NOT NULL DEFAULT FALSE, INDEX(need_update),
+ need_create BOOLEAN NOT NULL DEFAULT TRUE, INDEX(need_create)
+) ENGINE=InnoDB;
+
 CREATE TABLE permission_table (
  id SERIAL PRIMARY KEY,
  permType ENUM('read', 'write'), INDEX(permType),


DROP TRIGGER IF EXISTS on_ldata_update |
CREATE TRIGGER on_ldata_update
BEFORE UPDATE ON ldata_table
FOR EACH ROW BEGIN
  IF NEW.datatype = 'logical.file' THEN
    IF NEW.pdriGroupRef != OLD.pdriGroupRef THEN

DROP TABLE IF EXISTS permission_table, ldata_table, wp4_table, pdri_table, pdrigroup_table, storage_site_table, credential_table, requests_table;

CREATE TABLE pdrigroup_table (
  pdriGroupId SERIAL PRIMARY KEY,
