rename table ANNOUNCEMENT to OLD_ANNOUNCEMENT;
create table ANNOUNCEMENT (
  ID_INTERNAL int(11) NOT NULL auto_increment,
  KEY_CREATOR int(11),
  KEY_ROOT_DOMAIN_OBJECT int not null default 1,
  KEY_ANNOUNCEMENT_BOARD int NOT NULL,
  CREATION_DATE DATETIME NOT NULL,
  REFERED_SUBJECT_BEGIN DATETIME,
  REFERED_SUBJECT_END DATETIME,
  PUBLICATION_BEGIN DATETIME,
  PUBLICATION_END DATETIME,
  LAST_MODIFICATION DATETIME,
  SUBJECT LONGTEXT NOT NULL,
  BODY LONGTEXT NOT NULL,
  KEYWORDS LONGTEXT,
  PLACE VARCHAR(255),
  AUTHOR VARCHAR(255),
  AUTHOR_EMAIL VARCHAR(255),
  EXCERPT LONGTEXT,
  VISIBLE int(11) not null,
  PRIMARY KEY(ID_INTERNAL),
  KEY (KEY_CREATOR),
  KEY (KEY_ROOT_DOMAIN_OBJECT),
  KEY (KEY_ANNOUNCEMENT_BOARD)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS ANNOUNCEMENT_BOARD;
create table ANNOUNCEMENT_BOARD (
  ID_INTERNAL int(11) NOT NULL auto_increment,
  READERS blob,
  WRITERS blob,
  MANAGERS blob,
  CREATION_DATE DATETIME NOT NULL,
  EXECUTION_COURSE_PERMITTED_WRITE_GROUP_TYPE varchar(50),
  EXECUTION_COURSE_PERMITTED_READ_GROUP_TYPE varchar(50),
  EXECUTION_COURSE_PERMITTED_MANAGEMENT_GROUP_TYPE varchar(50),
  UNIT_PERMITTED_WRITE_GROUP_TYPE varchar(50),
  UNIT_PERMITTED_READ_GROUP_TYPE varchar(50),
  UNIT_PERMITTED_MANAGEMENT_GROUP_TYPE varchar(50),
  KEY_ROOT_DOMAIN_OBJECT int(11) not null default 1,  
  KEY_PARTY int(11),
  KEY_EXECUTION_COURSE int(11),
  NAME VARCHAR(255),
  MANDATORY int(11) not null,
  OJB_CONCRETE_CLASS VARCHAR(255) not null,
  PRIMARY KEY(ID_INTERNAL),
  KEY (KEY_ROOT_DOMAIN_OBJECT),
  KEY (KEY_PARTY),
  KEY (KEY_EXECUTION_COURSE)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS ANNOUNCEMENT_BOARD_BOOKMARK;
create table ANNOUNCEMENT_BOARD_BOOKMARK (
  ID_INTERNAL int(11) NOT NULL auto_increment,
  KEY_PERSON int(11),
  KEY_ANNOUNCEMENT_BOARD int(11),
  PRIMARY KEY(ID_INTERNAL),
  UNIQUE (KEY_PERSON, KEY_ANNOUNCEMENT_BOARD),
  KEY (KEY_PERSON),
  KEY (KEY_ANNOUNCEMENT_BOARD)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
