DROP TABLE IF EXISTS DISTRICT_AREA_CODE;
DROP TABLE IF EXISTS DISTRICT_SUBDIVISION_AREA_CODE;
DROP TABLE IF EXISTS PARISH_AREA_CODE;
DROP TABLE IF EXISTS AREA_CODE;

CREATE TABLE DISTRICT_AREA_CODE (
  ID_INTERNAL INT(11) NOT NULL auto_increment,
  CODE TEXT NOT NULL,
  DESCRIPTION TEXT NOT NULL,
  KEY_ROOT_DOMAIN_OBJECT INT(11) NOT NULL DEFAULT '1',
  PRIMARY KEY (ID_INTERNAL)
) ENGINE=InnoDB;

CREATE TABLE DISTRICT_SUBDIVISION_AREA_CODE (
  ID_INTERNAL INT(11) NOT NULL auto_increment,
  KEY_DISTRICT INT(11) NOT NULL,
  CODE TEXT NOT NULL,
  DESCRIPTION TEXT NOT NULL,
  KEY_ROOT_DOMAIN_OBJECT int(11) NOT NULL DEFAULT '1',
  PRIMARY KEY (ID_INTERNAL)
) ENGINE=InnoDB;

CREATE TABLE PARISH_AREA_CODE (
  ID_INTERNAL INT(11) NOT NULL auto_increment,
  KEY_DISTRICT_SUBDIVISION INT(11) NOT NULL,
  CODE TEXT NOT NULL,
  DESCRIPTION TEXT NOT NULL,
  KEY_ROOT_DOMAIN_OBJECT int(11) NOT NULL DEFAULT '1',
  PRIMARY KEY (ID_INTERNAL)
) ENGINE=InnoDB;

CREATE TABLE AREA_CODE (
  ID_INTERNAL INT(11) NOT NULL auto_increment,
  KEY_PARISH INT(11) NOT NULL,
  CODE TEXT NOT NULL,
  AREA_CODE TEXT NOT NULL,
  SUB_AREA_CODE TEXT NOT NULL,
  DESCRIPTION TEXT NOT NULL,
  KEY_ROOT_DOMAIN_OBJECT int(11) NOT NULL DEFAULT '1',
  PRIMARY KEY (ID_INTERNAL)
) ENGINE=InnoDB;