DROP TABLE IF EXISTS FUNCTIONALITY;
CREATE TABLE `FUNCTIONALITY` (
  `ID_INTERNAL` INTEGER  NOT NULL AUTO_INCREMENT,
  `OJB_CONCRETE_CLASS` VARCHAR(255) NOT NULL,
  `KEY_ROOT_DOMAIN_OBJECT` INTEGER  NOT NULL DEFAULT 1,
  `KEY_PARENT` INTEGER,
  `KEY_MODULE` INTEGER,
  `KEY_AVAILABILITY_POLICY` INTEGER,
  `NAME` TEXT NOT NULL,
  `TITLE` TEXT,
  `DESCRIPTION` TEXT,
  `PATH` VARCHAR(255),
  `PREFIX` VARCHAR(255),
  `RELATIVE` BOOLEAN NOT NULL DEFAULT 1,
  `ENABLED` BOOLEAN NOT NULL DEFAULT 1,
  `PARAMETERS` VARCHAR(255),
  `ORDER_IN_MODULE` INTEGER,
  PRIMARY KEY(`ID_INTERNAL`)
) ENGINE = InnoDB DEFAULT CHARACTER SET latin1;

DROP TABLE IF EXISTS AVAILABILITY_POLICY;
CREATE TABLE `AVAILABILITY_POLICY` (
  `ID_INTERNAL` INTEGER NOT NULL,
  `OJB_CONCRETE_CLASS` VARCHAR(255) NOT NULL,
  `KEY_ROOT_DOMAIN_OBJECT` INTEGER NOT NULL DEFAULT 1,
  `KEY_FUNCTIONALITY` INTEGER NOT NULL,
  `EXPRESSION` TEXT
) ENGINE = InnoDB DEFAULT CHARACTER SET latin1;
