system.install

  1. 6.x modules/system/system.install
  2. 4.x modules/system/system.install
  3. 5.x modules/system/system.install

The install file for the System module

This file is responsible for installing all of the required tables for FlightPath.

File

modules/system/system.install
View source
  1. <?php
  2. /**
  3. * @file
  4. * The install file for the System module
  5. *
  6. * This file is responsible for installing all of the required tables
  7. * for FlightPath.
  8. */
  9. /**
  10. * Implementation of hook_enable.
  11. *
  12. * This is meant to be called during initial installation. We will make all of the
  13. * database changes we need to make in order to have FlightPath up and running.
  14. */
  15. function system_enable() {
  16. // Set up our default roles
  17. db_query("INSERT INTO roles (rid, name)
  18. VALUES (1, 'anonymous user'),
  19. (2, 'authenticated user')");
  20. // Add in the anonymous user into the users table (uid = 0)
  21. db_query("INSERT INTO users (user_id, cwid, user_name) VALUES (0, 0, 'anonymous')");
  22. // Let's figure out what the current schema value is for this system module...
  23. $info_contents = file_get_contents("modules/system/system.info");
  24. // From the info_contents variable, split up and place into an array.
  25. $info_details_array = array();
  26. $lines = explode("\n", $info_contents);
  27. foreach ($lines as $line) {
  28. if (trim($line) == "") continue;
  29. $temp = explode("=", trim($line));
  30. $info_details_array[trim($temp[0])] = trim(substr($line, strlen($temp[0]) + 1));
  31. }
  32. // Set up the modules table-- add the system module first.
  33. db_query("INSERT INTO modules (path, name, version, enabled, weight, type, `schema`)
  34. VALUES ('modules/system', 'system', 'core', 1, '-999', 'module', '?') ", $info_details_array["schema"]);
  35. // Let's perform installations on the other modules we want enabled by default.
  36. $modules = array("admin", "advise", "blocks", "comments", "student_search", "update_status", "content", "announcements", "tinymce", "course_search", "blank_degrees", "user");
  37. foreach ($modules as $module) {
  38. system_enable_module(array("module" => $module, "path" => "modules/$module", "version" => "core"));
  39. }
  40. // Set up some blocks for the system module by default.
  41. db_query("INSERT INTO blocks (section, region, module, delta, weight)
  42. VALUES ('system_main', 'right_col', 'system', 'tools', 1),
  43. ('system_main', 'right_col', 'system', 'admin_tools', 2),
  44. ('system_main', 'left_col', 'announcements', 'primary', 0),
  45. ('system_login', 'left_col', 'blocks', 'block_1', 0),
  46. ('system_login', 'right_col', 'system', 'login_form', 0),
  47. ('system_login', 'top', 'blocks', 'block_2', 0)
  48. ");
  49. // Set up some basic permissions for authenticated user.
  50. db_query("INSERT INTO role_permissions (rid, perm)
  51. VALUES
  52. (2, 'access_logged_in_content'),
  53. (2, 'view_comments') ");
  54. }
  55. function system_update($old_schema, $new_schema) {
  56. if ($old_schema <= 1) {
  57. // Add column to the faculty table
  58. db_query("ALTER TABLE faculty
  59. ADD COLUMN department_code varchar(10) NOT NULL AFTER college,
  60. ADD INDEX (department_code)");
  61. }
  62. if ($old_schema < 3) {
  63. // Add an index to the advising_comments table for access_type
  64. db_query("ALTER TABLE advising_comments
  65. ADD INDEX (access_type) ");
  66. }
  67. if ($old_schema < 4) {
  68. // Add college-related tables
  69. db_query("CREATE TABLE `colleges` (
  70. `college_code` varchar(10) NOT NULL,
  71. `title` varchar(255) NOT NULL,
  72. PRIMARY KEY (`college_code`)
  73. ) ");
  74. db_query("CREATE TABLE `degree_college` (
  75. `major_code` varchar(20) NOT NULL,
  76. `college_code` varchar(10) NOT NULL,
  77. PRIMARY KEY (`major_code`),
  78. KEY `college_code` (`college_code`)
  79. ) ");
  80. fp_add_message(t("Added college-related tables to database."));
  81. }
  82. if ($old_schema < 5) {
  83. // Update hour fields to be decimal type.
  84. db_query("ALTER TABLE `advised_courses` MODIFY `var_hours` DECIMAL(8,4) NOT NULL");
  85. db_query("ALTER TABLE `student_courses` MODIFY `hours_awarded` DECIMAL(8,4) NOT NULL");
  86. db_query("ALTER TABLE `student_substitutions` MODIFY `sub_hours` DECIMAL(8,4) NOT NULL");
  87. db_query("ALTER TABLE `courses` MODIFY `min_hours` DECIMAL(8,4) NOT NULL");
  88. db_query("ALTER TABLE `courses` MODIFY `max_hours` DECIMAL(8,4) NOT NULL");
  89. db_query("ALTER TABLE `courses` MODIFY `repeat_hours` DECIMAL(8,4) NOT NULL");
  90. db_query("ALTER TABLE `draft_courses` MODIFY `min_hours` DECIMAL(8,4) NOT NULL");
  91. db_query("ALTER TABLE `draft_courses` MODIFY `max_hours` DECIMAL(8,4) NOT NULL");
  92. db_query("ALTER TABLE `draft_courses` MODIFY `repeat_hours` DECIMAL(8,4) NOT NULL");
  93. db_query("ALTER TABLE `degree_requirements` MODIFY `group_hours_required` DECIMAL(8,4) NOT NULL");
  94. db_query("ALTER TABLE `draft_degree_requirements` MODIFY `group_hours_required` DECIMAL(8,4) NOT NULL");
  95. db_query("ALTER TABLE `student_transfer_courses` MODIFY `hours_awarded` DECIMAL(8,4) NOT NULL");
  96. db_query("ALTER TABLE `transfer_courses` MODIFY `min_hours` DECIMAL(8,4) NOT NULL");
  97. db_query("ALTER TABLE `transfer_courses` MODIFY `max_hours` DECIMAL(8,4) NOT NULL");
  98. // Also, expand the varchar fields for students table...
  99. db_query("ALTER TABLE `students` MODIFY `cumulative_hours` varchar(10) NOT NULL");
  100. db_query("ALTER TABLE `students` MODIFY `gpa` varchar(10) NOT NULL");
  101. fp_add_message(t("Updated database fields to allow for decimal hours."));
  102. }
  103. }
  104. /**
  105. * Implementation of hook_install.
  106. *
  107. * This will create all of our tables.
  108. */
  109. function system_install() {
  110. // Since this will ONLY be called during initial install, we do not
  111. // need to first check for existing tables; it is assumed that the database
  112. // is empty.
  113. // Therefore, let's place all of our create table statements in one query, for
  114. // simplicity.
  115. $q = "
  116. CREATE TABLE `advised_courses` (
  117. `id` int(11) NOT NULL AUTO_INCREMENT,
  118. `advising_session_id` int(11) NOT NULL,
  119. `course_id` int(11) NOT NULL,
  120. `entry_value` varchar(20) NOT NULL,
  121. `semester_num` int(11) NOT NULL,
  122. `group_id` int(11) NOT NULL,
  123. `var_hours` decimal(8,4) NOT NULL DEFAULT '0',
  124. `term_id` varchar(20) NOT NULL,
  125. PRIMARY KEY (`id`),
  126. KEY `advid` (`advising_session_id`),
  127. KEY `course_id` (`course_id`),
  128. KEY `ev` (`entry_value`)
  129. ); ";
  130. db_query($q);
  131. $q = "
  132. CREATE TABLE `advising_comments` (
  133. `id` int(11) NOT NULL AUTO_INCREMENT,
  134. `student_id` int(11) NOT NULL,
  135. `faculty_id` int(11) NOT NULL,
  136. `term_id` varchar(20) NOT NULL,
  137. `comment` text NOT NULL,
  138. `posted` int(10) unsigned NOT NULL,
  139. `access_type` varchar(20) NOT NULL,
  140. `delete_flag` tinyint(4) NOT NULL,
  141. PRIMARY KEY (`id`),
  142. KEY `student_id` (`student_id`),
  143. KEY `delete_flag` (`delete_flag`),
  144. KEY `access_type` (`access_type`)
  145. );
  146. ";
  147. db_query($q);
  148. $q = "
  149. CREATE TABLE `advising_sessions` (
  150. `advising_session_id` int(11) NOT NULL AUTO_INCREMENT,
  151. `student_id` int(11) NOT NULL,
  152. `faculty_id` int(11) NOT NULL,
  153. `term_id` varchar(20) NOT NULL,
  154. `degree_id` int(11) NOT NULL,
  155. `major_code` varchar(20) NOT NULL,
  156. `track_code` varchar(20) NOT NULL,
  157. `catalog_year` int(11) NOT NULL,
  158. `posted` int(10) unsigned NOT NULL,
  159. `is_whatif` tinyint(4) NOT NULL DEFAULT '0',
  160. `is_draft` tinyint(4) NOT NULL DEFAULT '0',
  161. `is_empty` tinyint(4) NOT NULL,
  162. PRIMARY KEY (`advising_session_id`),
  163. KEY `sid` (`student_id`),
  164. KEY `termid` (`term_id`)
  165. ); ";
  166. db_query($q);
  167. $q = "
  168. CREATE TABLE `advisor_student` (
  169. `faculty_id` int(10) unsigned NOT NULL,
  170. `student_id` int(10) unsigned NOT NULL,
  171. PRIMARY KEY (`faculty_id`,`student_id`)
  172. ); ";
  173. db_query($q);
  174. $q = "
  175. CREATE TABLE `blocks` (
  176. `bid` int(10) unsigned NOT NULL AUTO_INCREMENT,
  177. `section` varchar(255) NOT NULL,
  178. `region` varchar(255) NOT NULL,
  179. `module` varchar(255) NOT NULL,
  180. `delta` varchar(255) NOT NULL,
  181. `weight` int(11) NOT NULL,
  182. PRIMARY KEY (`bid`)
  183. ); ";
  184. db_query($q);
  185. $q = "
  186. CREATE TABLE `courses` (
  187. `id` int(11) NOT NULL AUTO_INCREMENT,
  188. `course_id` int(11) NOT NULL,
  189. `subject_id` varchar(10) NOT NULL,
  190. `course_num` varchar(10) NOT NULL,
  191. `catalog_year` int(11) NOT NULL DEFAULT '2006',
  192. `title` text NOT NULL,
  193. `description` text NOT NULL,
  194. `min_hours` decimal(8,4) NOT NULL,
  195. `max_hours` decimal(8,4) NOT NULL,
  196. `repeat_hours` decimal(8,4) NOT NULL,
  197. `exclude` tinyint(4) NOT NULL DEFAULT '0',
  198. `data_entry_comment` text NOT NULL,
  199. `delete_flag` tinyint(4) NOT NULL DEFAULT '0',
  200. PRIMARY KEY (`id`),
  201. KEY `course_id` (`course_id`),
  202. KEY `subject_id` (`subject_id`),
  203. KEY `course_num` (`course_num`),
  204. KEY `catalog_year` (`catalog_year`)
  205. ); ";
  206. db_query($q);
  207. db_query("CREATE TABLE `colleges` (
  208. `college_code` varchar(10) NOT NULL,
  209. `title` varchar(255) NOT NULL,
  210. PRIMARY KEY (`college_code`)
  211. ) ");
  212. db_query("CREATE TABLE `degree_college` (
  213. `major_code` varchar(20) NOT NULL,
  214. `college_code` varchar(10) NOT NULL,
  215. PRIMARY KEY (`major_code`),
  216. KEY `college_code` (`college_code`)
  217. ) ");
  218. $q = "
  219. CREATE TABLE `degree_requirements` (
  220. `id` int(11) NOT NULL AUTO_INCREMENT,
  221. `degree_id` int(11) NOT NULL,
  222. `semester_num` int(11) NOT NULL,
  223. `group_id` int(11) NOT NULL,
  224. `group_requirement_type` varchar(10) NOT NULL,
  225. `group_hours_required` decimal(8,4) NOT NULL,
  226. `group_min_grade` varchar(10) NOT NULL,
  227. `course_id` int(11) NOT NULL,
  228. `course_min_grade` varchar(10) NOT NULL,
  229. `course_requirement_type` varchar(10) NOT NULL,
  230. `data_entry_value` varchar(50) NOT NULL,
  231. PRIMARY KEY (`id`),
  232. KEY `degree_id` (`degree_id`),
  233. KEY `group_id` (`group_id`),
  234. KEY `dev` (`data_entry_value`)
  235. ); ";
  236. db_query($q);
  237. $q = "
  238. CREATE TABLE `degree_tracks` (
  239. `track_id` int(11) NOT NULL AUTO_INCREMENT,
  240. `catalog_year` int(11) NOT NULL DEFAULT '2006',
  241. `major_code` varchar(10) NOT NULL,
  242. `track_code` varchar(10) NOT NULL,
  243. `track_title` varchar(100) NOT NULL,
  244. `track_short_title` varchar(50) NOT NULL,
  245. `track_description` text NOT NULL,
  246. PRIMARY KEY (`track_id`)
  247. ); ";
  248. db_query($q);
  249. $q = "
  250. CREATE TABLE `degrees` (
  251. `id` int(11) NOT NULL AUTO_INCREMENT,
  252. `degree_id` int(11) NOT NULL,
  253. `major_code` varchar(20) NOT NULL,
  254. `degree_type` varchar(20) NOT NULL,
  255. `degree_class` varchar(5) NOT NULL,
  256. `title` varchar(200) NOT NULL,
  257. `public_note` text NOT NULL,
  258. `semester_titles_csv` text NOT NULL,
  259. `catalog_year` int(11) NOT NULL DEFAULT '2006',
  260. `exclude` int(11) NOT NULL DEFAULT '0',
  261. PRIMARY KEY (`id`),
  262. KEY `degree_id` (`degree_id`)
  263. ); ";
  264. db_query($q);
  265. $q = "
  266. CREATE TABLE `draft_courses` (
  267. `id` int(11) NOT NULL AUTO_INCREMENT,
  268. `course_id` int(11) NOT NULL,
  269. `subject_id` varchar(10) NOT NULL,
  270. `course_num` varchar(10) NOT NULL,
  271. `catalog_year` int(11) NOT NULL DEFAULT '2006',
  272. `title` text NOT NULL,
  273. `description` text NOT NULL,
  274. `min_hours` decimal(8,4) NOT NULL,
  275. `max_hours` decimal(8,4) NOT NULL,
  276. `repeat_hours` decimal(8,4) NOT NULL,
  277. `exclude` tinyint(4) NOT NULL DEFAULT '0',
  278. `data_entry_comment` text NOT NULL,
  279. `delete_flag` tinyint(4) NOT NULL DEFAULT '0',
  280. PRIMARY KEY (`id`),
  281. KEY `course_id` (`course_id`),
  282. KEY `subject_id` (`subject_id`),
  283. KEY `course_num` (`course_num`),
  284. KEY `catalog_year` (`catalog_year`)
  285. ); ";
  286. db_query($q);
  287. $q = "
  288. CREATE TABLE `draft_degree_requirements` (
  289. `id` int(11) NOT NULL AUTO_INCREMENT,
  290. `degree_id` int(11) NOT NULL,
  291. `semester_num` int(11) NOT NULL,
  292. `group_id` int(11) NOT NULL,
  293. `group_requirement_type` varchar(10) NOT NULL,
  294. `group_hours_required` decimal(8,4) NOT NULL,
  295. `group_min_grade` varchar(10) NOT NULL,
  296. `course_id` int(11) NOT NULL,
  297. `course_min_grade` varchar(10) NOT NULL,
  298. `course_requirement_type` varchar(10) NOT NULL,
  299. `data_entry_value` varchar(50) NOT NULL,
  300. PRIMARY KEY (`id`),
  301. KEY `degree_id` (`degree_id`),
  302. KEY `group_id` (`group_id`),
  303. KEY `dev` (`data_entry_value`)
  304. );";
  305. db_query($q);
  306. $q = "
  307. CREATE TABLE `draft_degree_tracks` (
  308. `track_id` int(11) NOT NULL AUTO_INCREMENT,
  309. `catalog_year` int(11) NOT NULL DEFAULT '2006',
  310. `major_code` varchar(10) NOT NULL,
  311. `track_code` varchar(10) NOT NULL,
  312. `track_title` varchar(100) NOT NULL,
  313. `track_short_title` varchar(50) NOT NULL,
  314. `track_description` text NOT NULL,
  315. PRIMARY KEY (`track_id`)
  316. ); ";
  317. db_query($q);
  318. $q = "
  319. CREATE TABLE `draft_degrees` (
  320. `id` int(11) NOT NULL AUTO_INCREMENT,
  321. `degree_id` int(11) NOT NULL,
  322. `major_code` varchar(20) NOT NULL,
  323. `degree_type` varchar(20) NOT NULL,
  324. `degree_class` varchar(5) NOT NULL,
  325. `title` varchar(200) NOT NULL,
  326. `public_note` text NOT NULL,
  327. `semester_titles_csv` text NOT NULL,
  328. `catalog_year` int(11) NOT NULL DEFAULT '2006',
  329. `exclude` int(11) NOT NULL DEFAULT '0',
  330. PRIMARY KEY (`id`),
  331. KEY `degree_id` (`degree_id`)
  332. );";
  333. db_query($q);
  334. $q = "
  335. CREATE TABLE `draft_group_requirements` (
  336. `id` int(11) NOT NULL AUTO_INCREMENT,
  337. `group_id` int(11) NOT NULL,
  338. `course_id` int(11) NOT NULL,
  339. `course_min_grade` varchar(10) NOT NULL,
  340. `course_repeats` int(11) NOT NULL DEFAULT '0',
  341. `child_group_id` int(11) NOT NULL,
  342. `data_entry_value` varchar(50) NOT NULL,
  343. PRIMARY KEY (`id`),
  344. KEY `group_id` (`group_id`),
  345. KEY `dev` (`data_entry_value`)
  346. ); ";
  347. db_query($q);
  348. $q = "
  349. CREATE TABLE `draft_groups` (
  350. `id` int(11) NOT NULL AUTO_INCREMENT,
  351. `group_id` int(11) NOT NULL,
  352. `group_name` varchar(200) NOT NULL,
  353. `title` varchar(255) NOT NULL,
  354. `definition` text NOT NULL,
  355. `icon_filename` text NOT NULL,
  356. `catalog_year` int(11) NOT NULL,
  357. `priority` int(11) NOT NULL DEFAULT '50',
  358. `delete_flag` tinyint(4) NOT NULL DEFAULT '0',
  359. `data_entry_comment` text NOT NULL,
  360. PRIMARY KEY (`id`),
  361. KEY `group_id` (`group_id`),
  362. KEY `group_name` (`group_name`),
  363. KEY `catalog_year` (`catalog_year`),
  364. KEY `title` (`title`)
  365. ); ";
  366. db_query($q);
  367. $q = "
  368. CREATE TABLE `draft_instructions` (
  369. `id` int(11) NOT NULL AUTO_INCREMENT,
  370. `instruction` text NOT NULL,
  371. PRIMARY KEY (`id`)
  372. );";
  373. db_query($q);
  374. $q = "
  375. CREATE TABLE `faculty` (
  376. `cwid` int(10) unsigned NOT NULL,
  377. `college` varchar(100) NOT NULL,
  378. `department_code` varchar(10) NOT NULL,
  379. `department` varchar(100) NOT NULL,
  380. `major_code` varchar(10) NOT NULL,
  381. PRIMARY KEY (`cwid`),
  382. KEY `major_code` (`major_code`),
  383. KEY `dept` (`department`),
  384. KEY `department_code` (`department_code`),
  385. KEY `college` (`college`)
  386. ); ";
  387. db_query($q);
  388. $q = "
  389. CREATE TABLE `group_requirements` (
  390. `id` int(11) NOT NULL AUTO_INCREMENT,
  391. `group_id` int(11) NOT NULL,
  392. `course_id` int(11) NOT NULL,
  393. `course_min_grade` varchar(10) NOT NULL,
  394. `course_repeats` int(11) NOT NULL DEFAULT '0',
  395. `child_group_id` int(11) NOT NULL,
  396. `data_entry_value` varchar(50) NOT NULL,
  397. PRIMARY KEY (`id`),
  398. KEY `group_id` (`group_id`),
  399. KEY `dev` (`data_entry_value`)
  400. ); ";
  401. db_query($q);
  402. $q = "
  403. CREATE TABLE `groups` (
  404. `id` int(11) NOT NULL AUTO_INCREMENT,
  405. `group_id` int(11) NOT NULL,
  406. `group_name` varchar(200) NOT NULL,
  407. `title` varchar(255) NOT NULL,
  408. `definition` text NOT NULL,
  409. `icon_filename` text NOT NULL,
  410. `catalog_year` int(11) NOT NULL,
  411. `priority` int(11) NOT NULL DEFAULT '50',
  412. `delete_flag` tinyint(4) NOT NULL DEFAULT '0',
  413. `data_entry_comment` text NOT NULL,
  414. PRIMARY KEY (`id`),
  415. KEY `group_id` (`group_id`),
  416. KEY `group_name` (`group_name`),
  417. KEY `catalog_year` (`catalog_year`),
  418. KEY `title` (`title`)
  419. ); ";
  420. db_query($q);
  421. $q = "
  422. CREATE TABLE `menu_router` (
  423. `path` varchar(255) NOT NULL,
  424. `access_callback` varchar(255) NOT NULL,
  425. `access_arguments` text NOT NULL,
  426. `page_callback` varchar(255) NOT NULL,
  427. `page_arguments` text NOT NULL,
  428. `title` varchar(255) NOT NULL,
  429. `description` text NOT NULL,
  430. `type` tinyint(3) unsigned NOT NULL,
  431. `tab_family` varchar(255) NOT NULL,
  432. `tab_parent` varchar(255) NOT NULL,
  433. `weight` int(11) NOT NULL,
  434. `icon` varchar(255) NOT NULL,
  435. `page_settings` text NOT NULL,
  436. `file` varchar(255) NOT NULL,
  437. PRIMARY KEY (`path`),
  438. KEY `type` (`type`),
  439. KEY `tab_family` (`tab_family`)
  440. ); ";
  441. db_query($q);
  442. $q = "
  443. CREATE TABLE `modules` (
  444. `path` varchar(255) NOT NULL,
  445. `name` varchar(100) NOT NULL,
  446. `version` varchar(20) NOT NULL,
  447. `requires` text NOT NULL,
  448. `enabled` int(11) NOT NULL,
  449. `weight` int(11) NOT NULL,
  450. `type` varchar(20) NOT NULL,
  451. `schema` int(11) NOT NULL,
  452. `info` text NOT NULL,
  453. PRIMARY KEY (`path`)
  454. ); ";
  455. db_query($q);
  456. $q = "
  457. CREATE TABLE `role_permissions` (
  458. `pid` int(10) unsigned NOT NULL AUTO_INCREMENT,
  459. `rid` int(10) unsigned NOT NULL,
  460. `perm` varchar(255) NOT NULL,
  461. PRIMARY KEY (`pid`),
  462. KEY `perm` (`perm`),
  463. KEY `rid` (`rid`)
  464. ); ";
  465. db_query($q);
  466. $q = "
  467. CREATE TABLE `roles` (
  468. `rid` int(11) NOT NULL AUTO_INCREMENT,
  469. `name` varchar(255) NOT NULL,
  470. PRIMARY KEY (`rid`)
  471. ); ";
  472. db_query($q);
  473. $q = "
  474. CREATE TABLE `standardized_tests` (
  475. `id` int(11) NOT NULL AUTO_INCREMENT,
  476. `test_id` varchar(20) NOT NULL,
  477. `category_id` varchar(20) NOT NULL,
  478. `position` int(11) NOT NULL,
  479. `test_description` varchar(200) NOT NULL,
  480. `category_description` varchar(200) NOT NULL,
  481. PRIMARY KEY (`id`)
  482. ); ";
  483. db_query($q);
  484. $q = "
  485. CREATE TABLE `student_courses` (
  486. `id` int(11) NOT NULL AUTO_INCREMENT,
  487. `student_id` int(11) NOT NULL,
  488. `subject_id` varchar(10) NOT NULL,
  489. `course_num` varchar(10) NOT NULL,
  490. `hours_awarded` decimal(8,4) NOT NULL,
  491. `grade` varchar(5) NOT NULL,
  492. `term_id` varchar(20) NOT NULL,
  493. PRIMARY KEY (`id`),
  494. KEY `student_id` (`student_id`)
  495. ); ";
  496. db_query($q);
  497. $q = "
  498. CREATE TABLE `student_developmentals` (
  499. `student_id` int(11) NOT NULL,
  500. `requirement` varchar(15) NOT NULL,
  501. PRIMARY KEY (`student_id`,`requirement`)
  502. ); ";
  503. db_query($q);
  504. $q = "
  505. CREATE TABLE `student_settings` (
  506. `student_id` int(11) NOT NULL,
  507. `settings` text NOT NULL,
  508. `posted` int(10) unsigned NOT NULL,
  509. PRIMARY KEY (`student_id`)
  510. ); ";
  511. db_query($q);
  512. $q = "
  513. CREATE TABLE `student_substitutions` (
  514. `id` int(11) NOT NULL AUTO_INCREMENT,
  515. `student_id` int(11) NOT NULL,
  516. `faculty_id` int(11) NOT NULL,
  517. `required_course_id` int(11) NOT NULL,
  518. `required_entry_value` varchar(20) NOT NULL,
  519. `required_group_id` int(11) NOT NULL,
  520. `required_semester_num` int(11) NOT NULL,
  521. `sub_course_id` int(11) NOT NULL,
  522. `sub_entry_value` varchar(20) NOT NULL,
  523. `sub_term_id` varchar(20) NOT NULL,
  524. `sub_transfer_flag` tinyint(4) NOT NULL,
  525. `sub_hours` decimal(8,4) NOT NULL,
  526. `sub_remarks` text NOT NULL,
  527. `posted` int(10) unsigned NOT NULL,
  528. `delete_flag` tinyint(4) NOT NULL,
  529. PRIMARY KEY (`id`),
  530. KEY `student_id` (`student_id`),
  531. KEY `rev` (`required_entry_value`),
  532. KEY `sev` (`sub_entry_value`)
  533. ); ";
  534. db_query($q);
  535. $q = "
  536. CREATE TABLE `student_tests` (
  537. `id` int(11) NOT NULL AUTO_INCREMENT,
  538. `student_id` int(11) NOT NULL,
  539. `test_id` varchar(20) NOT NULL,
  540. `category_id` varchar(20) NOT NULL,
  541. `score` varchar(10) NOT NULL,
  542. `date_taken` datetime NOT NULL,
  543. PRIMARY KEY (`id`),
  544. KEY `student_id` (`student_id`)
  545. ); ";
  546. db_query($q);
  547. $q = "
  548. CREATE TABLE `student_transfer_courses` (
  549. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  550. `student_id` int(11) NOT NULL,
  551. `transfer_course_id` int(11) NOT NULL,
  552. `student_specific_course_title` varchar(255) NOT NULL,
  553. `term_id` varchar(20) NOT NULL,
  554. `grade` varchar(5) NOT NULL,
  555. `hours_awarded` decimal(8,4) NOT NULL,
  556. PRIMARY KEY (`id`),
  557. KEY `student_id` (`student_id`),
  558. KEY `transfer_id` (`transfer_course_id`),
  559. KEY `term_id` (`term_id`),
  560. KEY `grade` (`grade`),
  561. KEY `hrs` (`hours_awarded`)
  562. ) ; ";
  563. db_query($q);
  564. $q = "
  565. CREATE TABLE `student_unassign_group` (
  566. `id` int(11) NOT NULL AUTO_INCREMENT,
  567. `student_id` int(11) NOT NULL,
  568. `faculty_id` int(11) NOT NULL,
  569. `course_id` int(11) NOT NULL,
  570. `term_id` varchar(20) NOT NULL,
  571. `transfer_flag` tinyint(4) NOT NULL DEFAULT '0',
  572. `group_id` int(11) NOT NULL,
  573. `delete_flag` tinyint(4) NOT NULL DEFAULT '0',
  574. `posted` int(10) unsigned NOT NULL,
  575. PRIMARY KEY (`id`)
  576. ); ";
  577. db_query($q);
  578. $q = "
  579. CREATE TABLE `student_unassign_transfer_eqv` (
  580. `id` int(11) NOT NULL AUTO_INCREMENT,
  581. `student_id` int(11) NOT NULL,
  582. `faculty_id` int(11) NOT NULL,
  583. `transfer_course_id` int(11) NOT NULL,
  584. `delete_flag` tinyint(4) NOT NULL DEFAULT '0',
  585. `posted` int(10) unsigned NOT NULL,
  586. PRIMARY KEY (`id`)
  587. ); ";
  588. db_query($q);
  589. $q = "
  590. CREATE TABLE `students` (
  591. `cwid` int(11) unsigned NOT NULL,
  592. `cumulative_hours` varchar(5) NOT NULL,
  593. `gpa` varchar(5) NOT NULL,
  594. `rank_code` varchar(5) NOT NULL,
  595. `major_code` varchar(20) NOT NULL,
  596. `catalog_year` int(11) NOT NULL,
  597. `is_active` tinyint(11) NOT NULL,
  598. PRIMARY KEY (`cwid`),
  599. KEY `rank_code` (`rank_code`),
  600. KEY `major_code` (`major_code`),
  601. KEY `is_active` (`is_active`)
  602. ); ";
  603. db_query($q);
  604. $q = "
  605. CREATE TABLE `subjects` (
  606. `subject_id` varchar(10) NOT NULL,
  607. `college` varchar(10) NOT NULL,
  608. `title` varchar(255) NOT NULL,
  609. PRIMARY KEY (`subject_id`)
  610. ); ";
  611. db_query($q);
  612. $q = "
  613. CREATE TABLE `transfer_courses` (
  614. `transfer_course_id` int(11) NOT NULL AUTO_INCREMENT,
  615. `institution_id` varchar(10) NOT NULL,
  616. `subject_id` varchar(10) NOT NULL,
  617. `course_num` varchar(10) NOT NULL,
  618. `title` varchar(100) NOT NULL,
  619. `description` text NOT NULL,
  620. `min_hours` decimal(8,4) NOT NULL,
  621. `max_hours` decimal(8,4) NOT NULL,
  622. PRIMARY KEY (`transfer_course_id`),
  623. KEY `ic` (`institution_id`),
  624. KEY `si` (`subject_id`),
  625. KEY `cn` (`course_num`)
  626. ); ";
  627. db_query($q);
  628. $q = "
  629. CREATE TABLE `transfer_eqv_per_student` (
  630. `id` int(11) NOT NULL AUTO_INCREMENT,
  631. `student_id` int(11) NOT NULL,
  632. `transfer_course_id` int(11) NOT NULL,
  633. `local_course_id` int(11) NOT NULL,
  634. `valid_term_id` varchar(20) NOT NULL,
  635. `broken_id` int(11) NOT NULL,
  636. PRIMARY KEY (`id`),
  637. KEY `student_id` (`student_id`),
  638. KEY `transfer_course_id` (`transfer_course_id`),
  639. KEY `local_course_id` (`local_course_id`),
  640. KEY `broken_id` (`broken_id`)
  641. ); ";
  642. db_query($q);
  643. $q = "
  644. CREATE TABLE `transfer_institutions` (
  645. `institution_id` varchar(10) NOT NULL,
  646. `name` varchar(200) NOT NULL,
  647. `state` varchar(10) NOT NULL,
  648. PRIMARY KEY (`institution_id`),
  649. KEY `state` (`state`)
  650. ); ";
  651. db_query($q);
  652. $q = "
  653. CREATE TABLE `user_roles` (
  654. `user_id` int(11) NOT NULL,
  655. `rid` int(11) NOT NULL,
  656. PRIMARY KEY (`user_id`,`rid`)
  657. ); ";
  658. db_query($q);
  659. $q = "
  660. CREATE TABLE `user_settings` (
  661. `user_id` int(11) NOT NULL,
  662. `settings` text NOT NULL,
  663. `posted` int(10) unsigned NOT NULL,
  664. PRIMARY KEY (`user_id`)
  665. ); ";
  666. db_query($q);
  667. $q = "
  668. CREATE TABLE `users` (
  669. `user_id` int(11) NOT NULL AUTO_INCREMENT,
  670. `user_name` varchar(50) NOT NULL,
  671. `password` varchar(32) NOT NULL,
  672. `is_student` tinyint(4) NOT NULL,
  673. `is_faculty` tinyint(4) NOT NULL,
  674. `email` varchar(255) NOT NULL,
  675. `cwid` int(11) NOT NULL,
  676. `f_name` varchar(100) NOT NULL,
  677. `l_name` varchar(100) NOT NULL,
  678. `is_disabled` tinyint(4) NOT NULL,
  679. PRIMARY KEY (`user_id`),
  680. KEY `cwid` (`cwid`),
  681. KEY `user_name` (`user_name`)
  682. ); ";
  683. db_query($q);
  684. $q = "
  685. CREATE TABLE `variables` (
  686. `name` varchar(255) NOT NULL,
  687. `value` text NOT NULL,
  688. PRIMARY KEY (`name`)
  689. ); ";
  690. db_query($q);
  691. $q = "
  692. CREATE TABLE `watchdog` (
  693. `wid` int(11) unsigned NOT NULL AUTO_INCREMENT,
  694. `user_id` int(11) unsigned NOT NULL DEFAULT '0',
  695. `user_name` varchar(50) NOT NULL,
  696. `cwid` int(11) NOT NULL,
  697. `type` varchar(100) NOT NULL DEFAULT '',
  698. `message` text NOT NULL,
  699. `variables` text NOT NULL,
  700. `severity` tinyint(3) unsigned NOT NULL DEFAULT '0',
  701. `extra_data` varchar(255) NOT NULL DEFAULT '',
  702. `location` text NOT NULL,
  703. `referer` text NOT NULL,
  704. `ip` varchar(64) NOT NULL DEFAULT '',
  705. `is_mobile` tinyint(4) NOT NULL,
  706. `is_student` tinyint(4) NOT NULL,
  707. `is_faculty` tinyint(4) NOT NULL,
  708. `timestamp` int(11) unsigned NOT NULL DEFAULT '0',
  709. PRIMARY KEY (`wid`),
  710. KEY `type` (`type`),
  711. KEY `uid` (`user_id`),
  712. KEY `uname` (`user_name`),
  713. KEY `severity` (`severity`),
  714. KEY `cwid` (`cwid`)
  715. ); ";
  716. db_query($q);
  717. }

Functions

Namesort descending Description
system_enable Implementation of hook_enable.
system_install Implementation of hook_install.
system_update