CREATE TABLE `PARKING_REQUEST` (
  `ID_INTERNAL` int(11) unsigned NOT NULL auto_increment,
  `PARKING_REQUEST_STATE` VARCHAR(10) NOT NULL default 'PENDING',
  `FIRST_REQUEST` BIT NOT NULL,
  `CREATION_DATE` datetime NOT NULL,
  `KEY_PARKING_PARTY` int(11) unsigned NOT NULL,
  `PHONE` varchar(50) default NULL,
  `MOBILE` varchar(50) default NULL,
  `EMAIL` varchar(100) default NULL,
  `FIRST_CAR_PLATE_NUMBER` VARCHAR(10) NOT NULL,
  `FIRST_CAR_MAKE` VARCHAR(20) NOT NULL,
  `SECOND_CAR_PLATE_NUMBER` VARCHAR(10),
  `SECOND_CAR_MAKE` VARCHAR(20),
  `KEY_ROOT_DOMAIN_OBJECT` int(11) NOT NULL default '1',
  PRIMARY KEY  (`ID_INTERNAL`)
) ENGINE=InnoDB;

CREATE TABLE `PARKING_DOCUMENT` (
  `ID_INTERNAL` int(11) unsigned NOT NULL auto_increment,
  `PARKING_DOCUMENT_TYPE` VARCHAR(10) NOT NULL,
  `KEY_PARKING_REQUEST` int(11) unsigned NOT NULL,
  `KEY_PARKING_FILE` int(11) unsigned NOT NULL,
  `KEY_ROOT_DOMAIN_OBJECT` int(11) NOT NULL default '1',
  PRIMARY KEY  (`ID_INTERNAL`)
) ENGINE=InnoDB;

CREATE TABLE `PARKING_GROUP` (
  `ID_INTERNAL` int(11) unsigned NOT NULL auto_increment,
  `GROUP_NAME` VARCHAR(100),
  `KEY_ROOT_DOMAIN_OBJECT` int(11) NOT NULL default '1',
  PRIMARY KEY  (`ID_INTERNAL`)
) ENGINE=InnoDB;

CREATE TABLE `PARKING_PARTY` (
  `ID_INTERNAL` int(11) unsigned NOT NULL auto_increment,
  `KEY_PARTY` int(11) unsigned NOT NULL,
  `CARD_NUMBER` int(10) unsigned,
  `KEY_PARKING_GROUP` int(11) unsigned,
  `FIRST_CAR_PLATE_NUMBER` VARCHAR(10),
  `FIRST_CAR_MAKE` VARCHAR(20),
  `SECOND_CAR_PLATE_NUMBER` VARCHAR(10),
  `SECOND_CAR_MAKE` VARCHAR(20),
  `AUTHORIZED` BIT NOT NULL default 0,
  `KEY_ROOT_DOMAIN_OBJECT` int(11) NOT NULL default '1',
  PRIMARY KEY  (`ID_INTERNAL`)
) ENGINE=InnoDB;

alter table PARTY add column KEY_PARKING_PARTY int(11) unsigned;
