J_L

Untitled

J_L
Feb 16th, 2013
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 1.46 KB | None | 0 0
  1. CREATE TABLE IF NOT EXISTS `tip` (
  2.   `id` bigint(20) NOT NULL AUTO_INCREMENT,
  3.   `ticket_id` bigint(20) NOT NULL,
  4.   `opportunity_id` bigint(20) NOT NULL,
  5.   `opportunity_possible_result_id` bigint(20) NOT NULL,
  6.   `resolution_id` smallint(6) NOT NULL,
  7.   PRIMARY KEY (`id`),
  8.   KEY `fk_tip_ticket_id_ticket_id` (`ticket_id`),
  9.   KEY `fk_tip_opportunity_id_opportunity_id_idx` (`opportunity_id`),
  10.   KEY `fk_tip_opportunity_pr_id_opportunity_pr_id_idx` (`opportunity_possible_result_id`),
  11.   KEY `fk_tip_resolution_id_resolution_id_idx` (`resolution_id`)
  12. ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=3 ;
  13.  
  14.  
  15. INSERT INTO `tip` (`id`, `ticket_id`, `opportunity_id`, `opportunity_possible_result_id`, `resolution_id`) VALUES
  16. (1, 1, 11, 63, 1),
  17. (2, 2, 11, 53, 1);
  18.  
  19.  
  20. --
  21. -- Omezení
  22. --
  23. ALTER TABLE `tip`
  24.   ADD CONSTRAINT `fk_tip_opportunity_id_opportunity_id` FOREIGN KEY (`opportunity_id`) REFERENCES `opportunity` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  25.   ADD CONSTRAINT `fk_tip_opportunity_pr_id_opportunity_pr_id` FOREIGN KEY (`opportunity_possible_result_id`) REFERENCES `opportunity_possible_result` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  26.   ADD CONSTRAINT `fk_tip_resolution_id_resolution_id` FOREIGN KEY (`resolution_id`) REFERENCES `resolution` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  27.   ADD CONSTRAINT `fk_tip_ticket_id_ticket_id` FOREIGN KEY (`ticket_id`) REFERENCES `ticket` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
Advertisement
Add Comment
Please, Sign In to add comment