CREATE TABLE IF NOT EXISTS CONFIG_ACCESS (
  MODULE_ID TEXT,
  ALLOW_GLOBAL_READ INTEGER,
  ALLOW_GLOBAL_WRITE INTEGER,
  ALLOW_SET_READ_ONLY INTEGER,
  PRIMARY KEY (MODULE_ID),
  FOREIGN KEY (MODULE_ID) REFERENCES MODULE (ID) ON DELETE CASCADE
);

CREATE TABLE IF NOT EXISTS MODULE_CONFIG_ACCESS (
  MODULE_ID TEXT,
  OTHER_MODULE_ID TEXT,
  ALLOW_READ INTEGER,
  ALLOW_WRITE INTEGER,
  ALLOW_SET_READ_ONLY INTEGER,
  PRIMARY KEY (MODULE_ID),
  FOREIGN KEY (MODULE_ID) REFERENCES MODULE (ID) ON DELETE CASCADE,
  FOREIGN KEY (OTHER_MODULE_ID) REFERENCES MODULE (ID) ON DELETE CASCADE
);
