-- -----------------------------------------------------
-- Table `#__sr_experience_reservation_extra_xref`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `#__sr_experience_reservation_extra_xref` (
  `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
  `reservation_id` INT(11) UNSIGNED NOT NULL,
  `extra_id` INT(11) UNSIGNED NULL,
  `extra_name` VARCHAR(255) NULL,
  `extra_quantity` INT(11) NULL,
  `extra_price` DECIMAL(12,2) NULL,
  `extra_taxes` DECIMAL(12,2) NULL,
  `extra_description` TEXT NULL,
  PRIMARY KEY (`id`),
  INDEX `fk_sr_exp_res_extra_xref_sr_exp_idx` (`reservation_id` ASC),
  INDEX `fk_sr_exp_res_extra_xref_sr_extras1_idx` (`extra_id` ASC),
  CONSTRAINT `fk_sr_exp_res_extra_xref_sr_exp1`
  FOREIGN KEY (`reservation_id`)
  REFERENCES `#__sr_experience_reservations` (`id`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_sr_exp_res_extra_xref_sr_extras1`
  FOREIGN KEY (`extra_id`)
  REFERENCES `#__sr_extras` (`id`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
  ENGINE = InnoDB;

ALTER TABLE `#__sr_experiences` ADD COLUMN `contact_company_logo` VARCHAR(255) NULL AFTER `country_id`;

CREATE TABLE IF NOT EXISTS `#__sr_experience_asset_xref` (
  `experience_id` INT(11) UNSIGNED NOT NULL,
  `reservation_asset_id` INT(11) UNSIGNED NOT NULL,
  PRIMARY KEY (`experience_id`, `reservation_asset_id`),
  INDEX `fk_exp_asset_xref_assets1_idx` (`reservation_asset_id` ASC),
  CONSTRAINT `fk_exp_asset_xref_experiences1`
    FOREIGN KEY (`experience_id`)
    REFERENCES `#__sr_experiences` (`id`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_exp_asset_xref_assets1`
    FOREIGN KEY (`reservation_asset_id`)
    REFERENCES `#__sr_reservation_assets` (`id`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
  ENGINE = InnoDB;