Advertisement
nrogers64

Stack Overflow Question: CakePHP Containable with HABTM

Dec 11th, 2012
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 3.49 KB | None | 0 0
  1. -- See http://stackoverflow.com/questions/13826474/cakephp-containable-with-habtm
  2. --
  3. -- phpMyAdmin SQL Dump
  4. -- version 3.5.1
  5. -- http://www.phpmyadmin.net
  6. --
  7. -- Host: localhost
  8. -- Generation Time: Dec 11, 2012 at 11:37 AM
  9. -- Server version: 5.5.25
  10. -- PHP Version: 5.2.17
  11.  
  12. SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
  13. SET time_zone = "+00:00";
  14.  
  15. --
  16. -- Database: `test_db`
  17. --
  18.  
  19. -- --------------------------------------------------------
  20.  
  21. --
  22. -- Table structure for table `courses`
  23. --
  24.  
  25. CREATE TABLE `courses` (
  26.   `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  27.   `teacher_id` int(10) unsigned NOT NULL,
  28.   `title` varchar(100) NOT NULL,
  29.   `start_date` date NOT NULL,
  30.   `end_date` date NOT NULL,
  31.   `created` datetime NOT NULL,
  32.   `modified` datetime NOT NULL,
  33.   PRIMARY KEY (`id`)
  34. ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
  35.  
  36. --
  37. -- Dumping data for table `courses`
  38. --
  39.  
  40. INSERT INTO `courses` (`id`, `teacher_id`, `title`, `start_date`, `end_date`, `created`, `modified`) VALUES
  41. (1, 1, 'Introduction to Improvisation', '2012-12-17', '2012-12-21', '2012-12-11 00:00:00', '2012-12-11 00:00:00'),
  42. (2, 2, 'Painting', '2012-12-17', '2012-12-21', '2012-12-11 00:00:00', '2012-12-11 00:00:00');
  43.  
  44. -- --------------------------------------------------------
  45.  
  46. --
  47. -- Table structure for table `courses_students`
  48. --
  49.  
  50. CREATE TABLE `courses_students` (
  51.   `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  52.   `course_id` int(10) unsigned NOT NULL,
  53.   `student_id` int(10) unsigned NOT NULL,
  54.   `is_approved` tinyint(1) unsigned DEFAULT NULL,
  55.   `created` datetime NOT NULL,
  56.   `modified` datetime NOT NULL,
  57.   PRIMARY KEY (`id`)
  58. ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
  59.  
  60. --
  61. -- Dumping data for table `courses_students`
  62. --
  63.  
  64. INSERT INTO `courses_students` (`id`, `course_id`, `student_id`, `is_approved`, `created`, `modified`) VALUES
  65. (1, 1, 1, NULL, '2012-12-11 00:00:00', '2012-12-11 00:00:00'),
  66. (2, 2, 1, 1, '2012-12-11 00:00:00', '2012-12-11 00:00:00'),
  67. (3, 1, 2, 1, '2012-12-11 00:00:00', '2012-12-11 00:00:00'),
  68. (4, 2, 2, NULL, '2012-12-11 00:00:00', '2012-12-11 00:00:00');
  69.  
  70. -- --------------------------------------------------------
  71.  
  72. --
  73. -- Table structure for table `students`
  74. --
  75.  
  76. CREATE TABLE `students` (
  77.   `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  78.   `first_name` varchar(100) NOT NULL,
  79.   `last_name` varchar(100) NOT NULL,
  80.   `grade` tinyint(3) unsigned NOT NULL,
  81.   `created` datetime NOT NULL,
  82.   `modified` datetime NOT NULL,
  83.   PRIMARY KEY (`id`)
  84. ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
  85.  
  86. --
  87. -- Dumping data for table `students`
  88. --
  89.  
  90. INSERT INTO `students` (`id`, `first_name`, `last_name`, `grade`, `created`, `modified`) VALUES
  91. (1, 'Bill', 'Brown', 9, '2012-12-11 00:00:00', '2012-12-11 00:00:00'),
  92. (2, 'Sally', 'Smith', 10, '2012-12-11 00:00:00', '2012-12-11 00:00:00');
  93.  
  94. -- --------------------------------------------------------
  95.  
  96. --
  97. -- Table structure for table `teachers`
  98. --
  99.  
  100. CREATE TABLE `teachers` (
  101.   `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  102.   `first_name` varchar(100) NOT NULL,
  103.   `last_name` varchar(100) NOT NULL,
  104.   `created` datetime NOT NULL,
  105.   `modified` datetime NOT NULL,
  106.   PRIMARY KEY (`id`)
  107. ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
  108.  
  109. --
  110. -- Dumping data for table `teachers`
  111. --
  112.  
  113. INSERT INTO `teachers` (`id`, `first_name`, `last_name`, `created`, `modified`) VALUES
  114. (1, 'John', 'Doe', '2012-12-11 00:00:00', '2012-12-11 00:00:00'),
  115. (2, 'Jane', 'Doe', '2012-12-11 00:00:00', '2012-12-11 00:00:00');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement