CREATE TABLE `funded`.`performances` (
  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
  `title` VARCHAR (255),
  `manager_id` INT UNSIGNED NOT NULL,
  `user_id` INT UNSIGNED NOT NULL,
  `created_at` DATETIME,
  `updated_at` DATETIME,
  PRIMARY KEY (`id`)
) ENGINE = MYISAM;


CREATE TABLE `funded`.`performance_accounts` (
  `performance_id` INT UNSIGNED NOT NULL,
  `account_id` INT NOT NULL,
  `created_at` DATETIME,
  `updated_at` DATETIME,
  PRIMARY KEY (`performance_id`, `account_id`)
) ENGINE = MYISAM;

ALTER TABLE `funded`.`performances`
  ADD COLUMN `slug` VARCHAR (100) NOT NULL AFTER `updated_at`;


ALTER TABLE `funded`.`performance_results`
  ADD FOREIGN KEY (`performance_id`) REFERENCES `funded`.`performances`(`id`) ON DELETE CASCADE

ALTER TABLE `funded`.`performance_targets`
  ADD FOREIGN KEY (`performance_id`) REFERENCES `funded`.`performances`(`id`) ON DELETE CASCADE