system.install

  1. 7.x modules/system/system.install
  2. 6.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", "comments", "student_search", "update_status", "content", "announcements", "tinymce", "course_search", "blank_degrees", "user",
  37. "batch", 'stats', 'smtp', 'prereqs', 'lassie', 'calendar', 'alerts', 'audit', 'engagements', 'notify', 'student_files', 'encryption',
  38. 'student_priority', 'student_profile', 'masquerade');
  39. foreach ($modules as $module) {
  40. $info_contents = file_get_contents("modules/$module/$module.info");
  41. // From the info_contents variable, split up and place into an array.
  42. $info_details_array = array();
  43. $lines = explode("\n", $info_contents);
  44. foreach ($lines as $line) {
  45. if (trim($line) == "") continue;
  46. $temp = explode("=", trim($line));
  47. $info_details_array[trim($temp[0])] = trim(substr($line, strlen($temp[0]) + 1));
  48. }
  49. $schema = 0;
  50. if (isset($info_details_array['schema'])) $schema = $info_details_array['schema'];
  51. system_enable_module(array("module" => $module, "path" => "modules/$module", "version" => "core", "schema" => $schema));
  52. }
  53. /*
  54. // Set up some blocks for the system module by default.
  55. db_query("INSERT INTO blocks (section, region, module, delta, weight)
  56. VALUES ('system_main', 'right_col', 'system', 'tools', 1),
  57. ('system_main', 'right_col', 'system', 'admin_tools', 2),
  58. ('system_main', 'left_col', 'announcements', 'primary', 0),
  59. ('system_login', 'left_col', 'blocks', 'block_1', 0),
  60. ('system_login', 'right_col', 'system', 'login_form', 0),
  61. ('system_login', 'top', 'blocks', 'block_2', 0)
  62. ");
  63. */
  64. // Set up some basic permissions for authenticated user.
  65. db_query("INSERT INTO role_permissions (rid, perm)
  66. VALUES
  67. (2, 'access_logged_in_content'),
  68. (2, 'view_comments'),
  69. (2, 'view_degree_plan_course_descriptions')
  70. ");
  71. // Add some default variable values, to make things a little easier on first-run.
  72. variable_set("earliest_catalog_year", date("Y"));
  73. variable_set("current_catalog_year", date("Y"));
  74. variable_set("current_draft_catalog_year", date("Y"));
  75. // Do we have "clean URLs" enabled?
  76. $test = system_check_clean_urls();
  77. variable_set("clean_urls", $test);
  78. }
  79. function system_update($old_schema, $new_schema) {
  80. if (intval($old_schema) < 2) {
  81. db_query("CREATE TABLE `banned_ips` (
  82. `ip_address` varchar(64) NOT NULL,
  83. `posted_ts` bigint(20) unsigned DEFAULT NULL,
  84. PRIMARY KEY (`ip_address`),
  85. KEY `posted_ts` (`posted_ts`)
  86. )");
  87. }
  88. if (intval($old_schema) < 3) {
  89. // We want to enable a new permission for authenticated users.
  90. // Delete first in case its already been enabled.
  91. db_query("DELETE from role_permissions WHERE rid = 2 AND perm = 'view_degree_plan_course_descriptions' ");
  92. db_query("INSERT INTO role_permissions (rid, perm)
  93. VALUES (2, 'view_degree_plan_course_descriptions')");
  94. }
  95. if (intval($old_schema) < 4) {
  96. // Expand the number of chars cumulative hours can be.
  97. db_query("ALTER TABLE students
  98. MODIFY cumulative_hours VARCHAR(8)");
  99. }
  100. if (intval($old_schema) < 5) {
  101. // Add additional index on watchdog to help with ban ip operations
  102. db_query("CREATE INDEX idx_watchdog_user_ip_type_ts
  103. ON watchdog (user_id, ip, `type`, `timestamp`)");
  104. }
  105. if (intval($old_schema) < 6) {
  106. // Modify banned_ips table
  107. db_query("ALTER TABLE banned_ips
  108. MODIFY ip_address VARCHAR(64)");
  109. db_query("ALTER TABLE banned_ips
  110. MODIFY posted_ts INT UNSIGNED DEFAULT NULL");
  111. }
  112. } // update
  113. /**
  114. * Implementation of hook_install.
  115. *
  116. * This will create all of our tables.
  117. */
  118. function system_install() {
  119. // Since this will ONLY be called during initial install, we do not
  120. // need to first check for existing tables; it is assumed that the database
  121. // is empty.
  122. // Therefore, let's place all of our create table statements in one query, for
  123. // simplicity.
  124. $q = "
  125. CREATE TABLE `advised_courses` (
  126. `id` int(11) NOT NULL AUTO_INCREMENT,
  127. `advising_session_id` int(11) DEFAULT '0',
  128. `course_id` int(11) DEFAULT '0',
  129. `entry_value` varchar(20) DEFAULT '',
  130. `semester_num` int(11) DEFAULT '0',
  131. `group_id` varchar(50) DEFAULT '',
  132. `var_hours` decimal(8,4) DEFAULT '0.0000',
  133. `term_id` varchar(20) DEFAULT '',
  134. `degree_id` int(11) DEFAULT '0',
  135. PRIMARY KEY (`id`),
  136. KEY `advid` (`advising_session_id`),
  137. KEY `course_id` (`course_id`),
  138. KEY `ev` (`entry_value`),
  139. KEY `degree_id` (`degree_id`),
  140. KEY `term_id` (`term_id`),
  141. KEY `semester_num` (`semester_num`)
  142. ); ";
  143. db_query($q);
  144. $q = "
  145. CREATE TABLE `advising_comments` (
  146. `id` int(11) NOT NULL AUTO_INCREMENT,
  147. `student_id` varchar(30) DEFAULT '0',
  148. `faculty_id` varchar(30) DEFAULT '0',
  149. `term_id` varchar(20) DEFAULT '',
  150. `comment` longtext DEFAULT NULL,
  151. `posted` int(10) unsigned DEFAULT 0,
  152. `access_type` varchar(20) DEFAULT '',
  153. `delete_flag` tinyint(4) DEFAULT 0,
  154. PRIMARY KEY (`id`),
  155. KEY `student_id` (`student_id`),
  156. KEY `faculty_id` (`faculty_id`),
  157. KEY `posted` (`posted`),
  158. KEY `term_id` (`term_id`),
  159. KEY `delete_flag` (`delete_flag`),
  160. KEY `access_type` (`access_type`)
  161. );
  162. ";
  163. db_query($q);
  164. $q = "
  165. CREATE TABLE `advising_sessions` (
  166. `advising_session_id` int(11) NOT NULL AUTO_INCREMENT,
  167. `student_id` varchar(30) DEFAULT '0',
  168. `faculty_id` varchar(30) DEFAULT '0',
  169. `term_id` varchar(20) DEFAULT '',
  170. `degree_id` int(11) DEFAULT 0,
  171. `major_code_csv` varchar(255) DEFAULT '',
  172. `catalog_year` int(11) DEFAULT 0,
  173. `posted` int(10) unsigned DEFAULT 0,
  174. `is_whatif` tinyint(4) DEFAULT 0,
  175. `is_draft` tinyint(4) DEFAULT 0,
  176. `is_empty` tinyint(4) DEFAULT 0,
  177. `advising_session_token` varchar(255) DEFAULT NULL,
  178. `delete_flag` tinyint(4) DEFAULT 0,
  179. `most_recent_session` tinyint(4) DEFAULT 0,
  180. PRIMARY KEY (`advising_session_id`),
  181. KEY `sid` (`student_id`),
  182. KEY `termid` (`term_id`),
  183. KEY `is_empty` (`is_empty`),
  184. KEY `posted` (`posted`),
  185. KEY `faculty_id` (`faculty_id`),
  186. KEY `catalog_year` (`catalog_year`),
  187. KEY `is_draft` (`is_draft`),
  188. KEY `is_whatif` (`is_whatif`),
  189. KEY `delete_flag` (`delete_flag`),
  190. KEY `most_recent_session` (`most_recent_session`),
  191. KEY `advising_session_token` (`advising_session_token`)
  192. ); ";
  193. db_query($q);
  194. $q = "
  195. CREATE TABLE `advisor_student` (
  196. `faculty_id` varchar(30) NOT NULL DEFAULT '0',
  197. `student_id` varchar(30) NOT NULL DEFAULT '0',
  198. PRIMARY KEY (`faculty_id`,`student_id`)
  199. ); ";
  200. db_query($q);
  201. $q = "
  202. CREATE TABLE `banned_ips` (
  203. `ip_address` varchar(64) NOT NULL,
  204. `posted_ts` int(10) unsigned DEFAULT NULL,
  205. PRIMARY KEY (`ip_address`),
  206. KEY `posted_ts` (`posted_ts`)
  207. ); ";
  208. db_query($q);
  209. $q = "
  210. CREATE TABLE `courses` (
  211. `id` int(11) NOT NULL AUTO_INCREMENT,
  212. `course_id` int(11) DEFAULT 0,
  213. `subject_id` varchar(10) DEFAULT '',
  214. `course_num` varchar(10) DEFAULT '',
  215. `catalog_year` int(11) DEFAULT 0,
  216. `title` longtext DEFAULT NULL,
  217. `description` longtext DEFAULT NULL,
  218. `min_hours` decimal(8,4) DEFAULT 0.0000,
  219. `max_hours` decimal(8,4) DEFAULT 0.0000,
  220. `repeat_hours` decimal(8,4) DEFAULT 0.0000,
  221. `exclude` tinyint(4) DEFAULT 0,
  222. `data_entry_comment` longtext DEFAULT NULL,
  223. `delete_flag` tinyint(4) DEFAULT 0,
  224. `school_id` int(11) NOT NULL DEFAULT 0,
  225. PRIMARY KEY (`id`) ,
  226. KEY `course_id` (`course_id`) ,
  227. KEY `subject_id` (`subject_id`) ,
  228. KEY `course_num` (`course_num`) ,
  229. KEY `delete_flag` (`delete_flag`) ,
  230. KEY `exclude` (`exclude`) ,
  231. KEY `catalog_year` (`catalog_year`) ,
  232. KEY `school_id` (`school_id`),
  233. KEY `catalog_year_2` (`catalog_year`,`exclude`,`school_id`,`delete_flag`),
  234. KEY `course_num_2` (`course_num`,`catalog_year`,`exclude`,`delete_flag`,`school_id`),
  235. KEY `catalog_year_3` (`catalog_year`,`exclude`,`delete_flag`)
  236. ); ";
  237. db_query($q);
  238. db_query("CREATE TABLE `colleges` (
  239. `college_code` varchar(10) NOT NULL,
  240. `title` varchar(255) DEFAULT '',
  241. `school_id` int(11) NOT NULL DEFAULT 0,
  242. PRIMARY KEY (`college_code`,`school_id`),
  243. KEY `school_id` (`school_id`)
  244. ); ");
  245. db_query("CREATE TABLE `degree_college` (
  246. `major_code` varchar(100) NOT NULL DEFAULT '',
  247. `college_code` varchar(10) DEFAULT '',
  248. `school_id` int(11) NOT NULL DEFAULT 0,
  249. PRIMARY KEY (`major_code`,`school_id`),
  250. KEY `college_code` (`college_code`),
  251. KEY `school_id` (`school_id`)
  252. ); ");
  253. $q = "
  254. CREATE TABLE `degree_requirements` (
  255. `id` int(11) AUTO_INCREMENT,
  256. `degree_id` int(11) DEFAULT '0',
  257. `semester_num` int(11) DEFAULT '0',
  258. `group_id` int(11) DEFAULT '0',
  259. `group_requirement_type` varchar(10) DEFAULT '',
  260. `group_min_hours_allowed` decimal(8,4) DEFAULT '0.0000',
  261. `group_hours_required` decimal(8,4) DEFAULT '0.0000',
  262. `group_min_grade` varchar(10) DEFAULT '',
  263. `course_id` int(11) DEFAULT '0',
  264. `course_min_grade` varchar(10) DEFAULT '',
  265. `course_requirement_type` varchar(10) DEFAULT '',
  266. `data_entry_value` varchar(50) DEFAULT '',
  267. PRIMARY KEY (`id`),
  268. KEY `degree_id` (`degree_id`),
  269. KEY `group_id` (`group_id`),
  270. KEY `dev` (`data_entry_value`)
  271. ); ";
  272. db_query($q);
  273. $q = "
  274. CREATE TABLE `degree_tracks` (
  275. `track_id` int(11) NOT NULL AUTO_INCREMENT,
  276. `catalog_year` int(11) DEFAULT 2006,
  277. `major_code` varchar(100) DEFAULT '',
  278. `track_code` varchar(20) DEFAULT '',
  279. `track_title` varchar(100) DEFAULT '',
  280. `track_short_title` varchar(50) DEFAULT '',
  281. `track_description` longtext DEFAULT NULL,
  282. `school_id` int(11) NOT NULL DEFAULT 0,
  283. PRIMARY KEY (`track_id`) ,
  284. KEY `school_id` (`school_id`)
  285. ); ";
  286. db_query($q);
  287. $q = "
  288. CREATE TABLE `degrees` (
  289. `id` int(11) NOT NULL AUTO_INCREMENT,
  290. `degree_id` int(11) DEFAULT 0,
  291. `major_code` varchar(100) DEFAULT '',
  292. `degree_type` varchar(20) DEFAULT '',
  293. `degree_level` varchar(5) DEFAULT '',
  294. `degree_class` varchar(40) DEFAULT 'MAJOR',
  295. `title` varchar(200) DEFAULT '',
  296. `public_note` longtext DEFAULT NULL,
  297. `semester_titles_csv` longtext DEFAULT NULL,
  298. `catalog_year` int(11) DEFAULT 2006,
  299. `exclude` int(11) DEFAULT 0,
  300. `allow_dynamic` int(11) DEFAULT 0,
  301. `advising_weight` int(11) DEFAULT 0,
  302. `override_degree_hours` varchar(20) DEFAULT '',
  303. `min_tracks` int(11) DEFAULT 0,
  304. `max_tracks` int(11) DEFAULT 0,
  305. `default_tracks` varchar(255) DEFAULT '',
  306. `track_selection_config` longtext DEFAULT NULL,
  307. `school_id` int(11) NOT NULL DEFAULT 0,
  308. PRIMARY KEY (`id`) ,
  309. KEY `degree_id` (`degree_id`) ,
  310. KEY `major_code` (`major_code`) ,
  311. KEY `degree_level` (`degree_level`) ,
  312. KEY `degree_class` (`degree_class`) ,
  313. KEY `allow_dynamic` (`allow_dynamic`) ,
  314. KEY `advising_weight` (`advising_weight`) ,
  315. KEY `catalog_year` (`catalog_year`) ,
  316. KEY `school_id` (`school_id`)
  317. ); ";
  318. db_query($q);
  319. $q = "
  320. CREATE TABLE `draft_courses` (
  321. `id` int(11) NOT NULL AUTO_INCREMENT,
  322. `course_id` int(11) DEFAULT 0,
  323. `subject_id` varchar(10) DEFAULT '',
  324. `course_num` varchar(10) DEFAULT '',
  325. `catalog_year` int(11) DEFAULT 2006,
  326. `title` longtext DEFAULT NULL,
  327. `description` longtext DEFAULT NULL,
  328. `min_hours` decimal(8,4) DEFAULT 0.0000,
  329. `max_hours` decimal(8,4) DEFAULT 0.0000,
  330. `repeat_hours` decimal(8,4) DEFAULT 0.0000,
  331. `exclude` tinyint(4) DEFAULT 0,
  332. `data_entry_comment` longtext DEFAULT NULL,
  333. `delete_flag` tinyint(4) DEFAULT 0,
  334. `school_id` int(11) NOT NULL DEFAULT 0,
  335. PRIMARY KEY (`id`) ,
  336. KEY `course_id` (`course_id`) ,
  337. KEY `subject_id` (`subject_id`) ,
  338. KEY `course_num` (`course_num`) ,
  339. KEY `delete_flag` (`delete_flag`) ,
  340. KEY `exclude` (`exclude`) ,
  341. KEY `catalog_year` (`catalog_year`) ,
  342. KEY `school_id` (`school_id`),
  343. KEY `catalog_year_2` (`catalog_year`,`exclude`,`school_id`,`delete_flag`),
  344. KEY `course_num_2` (`course_num`,`catalog_year`,`exclude`,`delete_flag`,`school_id`),
  345. KEY `catalog_year_3` (`catalog_year`,`exclude`,`delete_flag`)
  346. ); ";
  347. db_query($q);
  348. $q = "
  349. CREATE TABLE `draft_degree_requirements` (
  350. `id` int(11) AUTO_INCREMENT,
  351. `degree_id` int(11) DEFAULT '0',
  352. `semester_num` int(11) DEFAULT '0',
  353. `group_id` int(11) DEFAULT '0',
  354. `group_requirement_type` varchar(10) DEFAULT '',
  355. `group_min_hours_allowed` decimal(8,4) DEFAULT '0.0000',
  356. `group_hours_required` decimal(8,4) DEFAULT '0.0000',
  357. `group_min_grade` varchar(10) DEFAULT '',
  358. `course_id` int(11) DEFAULT '0',
  359. `course_min_grade` varchar(10) DEFAULT '',
  360. `course_requirement_type` varchar(10) DEFAULT '',
  361. `data_entry_value` varchar(50) DEFAULT '',
  362. PRIMARY KEY (`id`),
  363. KEY `degree_id` (`degree_id`),
  364. KEY `group_id` (`group_id`),
  365. KEY `dev` (`data_entry_value`)
  366. );";
  367. db_query($q);
  368. $q = "
  369. CREATE TABLE `draft_degree_tracks` (
  370. `track_id` int(11) NOT NULL AUTO_INCREMENT,
  371. `catalog_year` int(11) DEFAULT 2006,
  372. `major_code` varchar(100) DEFAULT '',
  373. `track_code` varchar(20) DEFAULT '',
  374. `track_title` varchar(100) DEFAULT '',
  375. `track_short_title` varchar(50) DEFAULT '',
  376. `track_description` longtext DEFAULT NULL,
  377. `school_id` int(11) NOT NULL DEFAULT 0,
  378. PRIMARY KEY (`track_id`) ,
  379. KEY `school_id` (`school_id`)
  380. ); ";
  381. db_query($q);
  382. $q = "
  383. CREATE TABLE `draft_degrees` (
  384. `id` int(11) NOT NULL AUTO_INCREMENT,
  385. `degree_id` int(11) DEFAULT 0,
  386. `major_code` varchar(100) DEFAULT '',
  387. `degree_type` varchar(20) DEFAULT '',
  388. `degree_level` varchar(5) DEFAULT '',
  389. `degree_class` varchar(40) DEFAULT 'MAJOR',
  390. `title` varchar(200) DEFAULT '',
  391. `public_note` longtext DEFAULT NULL,
  392. `semester_titles_csv` longtext DEFAULT NULL,
  393. `catalog_year` int(11) DEFAULT 2006,
  394. `exclude` int(11) DEFAULT 0,
  395. `allow_dynamic` int(11) DEFAULT 0,
  396. `advising_weight` int(11) DEFAULT 0,
  397. `override_degree_hours` varchar(20) DEFAULT '',
  398. `min_tracks` int(11) DEFAULT 0,
  399. `max_tracks` int(11) DEFAULT 0,
  400. `default_tracks` varchar(255) DEFAULT '',
  401. `track_selection_config` longtext DEFAULT NULL,
  402. `school_id` int(11) NOT NULL DEFAULT 0,
  403. PRIMARY KEY (`id`) ,
  404. KEY `degree_id` (`degree_id`) ,
  405. KEY `major_code` (`major_code`) ,
  406. KEY `exclude` (`exclude`) ,
  407. KEY `allow_dynamic` (`allow_dynamic`) ,
  408. KEY `advising_weight` (`advising_weight`) ,
  409. KEY `degree_level` (`degree_level`) ,
  410. KEY `degree_class` (`degree_class`) ,
  411. KEY `catalog_year` (`catalog_year`) ,
  412. KEY `school_id` (`school_id`)
  413. ); ";
  414. db_query($q);
  415. $q = "
  416. CREATE TABLE `draft_group_requirements` (
  417. `id` int(11) AUTO_INCREMENT,
  418. `group_id` int(11) DEFAULT '0',
  419. `course_id` int(11) DEFAULT '0',
  420. `course_min_grade` varchar(10) DEFAULT '',
  421. `course_repeats` int(11) DEFAULT '0',
  422. `attributes` varchar(255) DEFAULT '',
  423. `child_group_id` int(11) DEFAULT '0',
  424. `data_entry_value` varchar(50) DEFAULT '',
  425. PRIMARY KEY (`id`),
  426. KEY `group_id` (`group_id`),
  427. KEY `dev` (`data_entry_value`)
  428. ); ";
  429. db_query($q);
  430. $q = "
  431. CREATE TABLE `draft_groups` (
  432. `id` int(11) NOT NULL AUTO_INCREMENT,
  433. `group_id` int(11) DEFAULT 0,
  434. `group_name` varchar(200) DEFAULT '',
  435. `title` varchar(255) DEFAULT '',
  436. `public_note` longtext DEFAULT NULL,
  437. `definition` longtext DEFAULT NULL,
  438. `icon_filename` longtext DEFAULT NULL,
  439. `catalog_year` int(11) DEFAULT 2006,
  440. `priority` int(11) DEFAULT 50,
  441. `delete_flag` tinyint(4) DEFAULT 0,
  442. `data_entry_comment` longtext DEFAULT NULL,
  443. `catalog_repeat` tinyint(4) DEFAULT 0,
  444. `school_id` int(11) NOT NULL DEFAULT 0,
  445. PRIMARY KEY (`id`) ,
  446. KEY `group_id` (`group_id`) ,
  447. KEY `group_name` (`group_name`) ,
  448. KEY `catalog_year` (`catalog_year`) ,
  449. KEY `title` (`title`) ,
  450. KEY `delete_flag` (`delete_flag`) ,
  451. KEY `catalog_repeat` (`catalog_repeat`) ,
  452. KEY `priority` (`priority`) ,
  453. KEY `school_id` (`school_id`)
  454. ); ";
  455. db_query($q);
  456. $q = "
  457. CREATE TABLE `draft_instructions` (
  458. `id` int(11) NOT NULL AUTO_INCREMENT,
  459. `instruction` longtext DEFAULT NULL,
  460. `school_id` int(11) NOT NULL DEFAULT 0,
  461. PRIMARY KEY (`id`) ,
  462. KEY `school_id` (`school_id`)
  463. ); ";
  464. db_query($q);
  465. $q = "
  466. CREATE TABLE `faculty` (
  467. `cwid` varchar(30) NOT NULL,
  468. `college` varchar(255) DEFAULT '',
  469. `department_code` varchar(255) DEFAULT '',
  470. `major_code_csv` varchar(255) DEFAULT '',
  471. PRIMARY KEY (`cwid`),
  472. KEY `major_code_csv` (`major_code_csv`),
  473. KEY `department_code` (`department_code`),
  474. KEY `college` (`college`)
  475. ); ";
  476. db_query($q);
  477. $q = "
  478. CREATE TABLE `group_requirements` (
  479. `id` int(11) AUTO_INCREMENT,
  480. `group_id` int(11) DEFAULT '0',
  481. `course_id` int(11) DEFAULT '0',
  482. `course_min_grade` varchar(10) DEFAULT '',
  483. `course_repeats` int(11) DEFAULT '0',
  484. `attributes` varchar(255) DEFAULT '',
  485. `child_group_id` int(11) DEFAULT '0',
  486. `data_entry_value` varchar(50) DEFAULT '',
  487. PRIMARY KEY (`id`),
  488. KEY `group_id` (`group_id`),
  489. KEY `dev` (`data_entry_value`)
  490. ); ";
  491. db_query($q);
  492. $q = "
  493. CREATE TABLE `groups` (
  494. `id` int(11) NOT NULL AUTO_INCREMENT,
  495. `group_id` int(11) DEFAULT 0,
  496. `group_name` varchar(200) DEFAULT '',
  497. `title` varchar(255) DEFAULT '',
  498. `public_note` longtext DEFAULT NULL,
  499. `definition` longtext DEFAULT NULL,
  500. `icon_filename` longtext DEFAULT NULL,
  501. `catalog_year` int(11) DEFAULT 2006,
  502. `priority` int(11) DEFAULT 50,
  503. `delete_flag` tinyint(4) DEFAULT 0,
  504. `data_entry_comment` longtext DEFAULT NULL,
  505. `catalog_repeat` tinyint(4) DEFAULT 0,
  506. `school_id` int(11) NOT NULL DEFAULT 0,
  507. PRIMARY KEY (`id`) ,
  508. KEY `group_id` (`group_id`) ,
  509. KEY `group_name` (`group_name`) ,
  510. KEY `catalog_year` (`catalog_year`) ,
  511. KEY `title` (`title`) ,
  512. KEY `delete_flag` (`delete_flag`) ,
  513. KEY `catalog_repeat` (`catalog_repeat`) ,
  514. KEY `priority` (`priority`) ,
  515. KEY `school_id` (`school_id`)
  516. ); ";
  517. db_query($q);
  518. $q = "
  519. CREATE TABLE `menu_router` (
  520. `path` varchar(255) ,
  521. `access_callback` varchar(255) DEFAULT '',
  522. `access_arguments` longtext,
  523. `page_callback` varchar(255) DEFAULT '',
  524. `page_arguments` longtext,
  525. `title` varchar(255) DEFAULT '',
  526. `description` longtext,
  527. `type` tinyint(3) unsigned DEFAULT '0',
  528. `tab_family` varchar(255) DEFAULT '',
  529. `tab_parent` varchar(255) DEFAULT '',
  530. `weight` int(11) DEFAULT '0',
  531. `icon` varchar(255) DEFAULT '',
  532. `page_settings` longtext,
  533. `file` varchar(255) DEFAULT '',
  534. PRIMARY KEY (`path`),
  535. KEY `type` (`type`),
  536. KEY `tab_family` (`tab_family`)
  537. ); ";
  538. db_query($q);
  539. $q = "
  540. CREATE TABLE `modules` (
  541. `path` varchar(255) ,
  542. `name` varchar(100) DEFAULT '',
  543. `version` varchar(20) DEFAULT '',
  544. `requires` longtext,
  545. `enabled` int(11) DEFAULT '0',
  546. `weight` int(11) DEFAULT '0',
  547. `type` varchar(20) DEFAULT '',
  548. `schema` int(11) DEFAULT '0',
  549. `info` longtext,
  550. PRIMARY KEY (`path`)
  551. ); ";
  552. db_query($q);
  553. $q = "
  554. CREATE TABLE `role_permissions` (
  555. `pid` int(10) unsigned AUTO_INCREMENT,
  556. `rid` int(10) unsigned DEFAULT '0',
  557. `perm` varchar(255) DEFAULT '',
  558. PRIMARY KEY (`pid`),
  559. KEY `perm` (`perm`),
  560. KEY `rid` (`rid`)
  561. ); ";
  562. db_query($q);
  563. $q = "
  564. CREATE TABLE `roles` (
  565. `rid` int(11) AUTO_INCREMENT,
  566. `name` varchar(255) DEFAULT '',
  567. PRIMARY KEY (`rid`)
  568. ); ";
  569. db_query($q);
  570. $q = "
  571. CREATE TABLE `standardized_tests` (
  572. `id` int(11) NOT NULL AUTO_INCREMENT,
  573. `test_id` varchar(20) DEFAULT '',
  574. `category_id` varchar(20) DEFAULT '',
  575. `position` int(11) DEFAULT 0,
  576. `test_description` varchar(200) DEFAULT '',
  577. `category_description` varchar(200) DEFAULT '',
  578. `school_id` int(11) NOT NULL DEFAULT 0,
  579. PRIMARY KEY (`id`) ,
  580. KEY `school_id` (`school_id`)
  581. ); ";
  582. db_query($q);
  583. $q = "
  584. CREATE TABLE `student_courses` (
  585. `id` int(11) NOT NULL AUTO_INCREMENT,
  586. `student_id` varchar(30) DEFAULT '',
  587. `subject_id` varchar(10) DEFAULT '',
  588. `course_num` varchar(10) DEFAULT '',
  589. `hours_awarded` decimal(8,4) DEFAULT 0.0000,
  590. `grade` varchar(5) DEFAULT '',
  591. `term_id` varchar(20) DEFAULT '',
  592. `level_code` varchar(10) DEFAULT '',
  593. `course_id` int(11) DEFAULT 0,
  594. PRIMARY KEY (`id`) ,
  595. KEY `student_id` (`student_id`) ,
  596. KEY `course_id` (`course_id`) ,
  597. KEY `level_code` (`level_code`)
  598. ); ";
  599. db_query($q);
  600. $q = "
  601. CREATE TABLE `student_degrees` (
  602. `student_id` varchar(30) NOT NULL DEFAULT '',
  603. `major_code` varchar(100) NOT NULL DEFAULT '',
  604. `is_editable` tinyint DEFAULT '0',
  605. `delete_flag` tinyint DEFAULT '0',
  606. `extra_data` varchar(255) DEFAULT NULL,
  607. PRIMARY KEY (`student_id`,`major_code`),
  608. KEY `extra_data` (`extra_data`(250)),
  609. KEY `major_code` (`major_code`),
  610. KEY `delete_flag` (`delete_flag`)
  611. ); ";
  612. db_query($q);
  613. $q = "
  614. CREATE TABLE `student_developmentals` (
  615. `student_id` varchar(30) NOT NULL,
  616. `requirement` varchar(15) NOT NULL DEFAULT '',
  617. PRIMARY KEY (`student_id`,`requirement`),
  618. KEY `requirement` (`requirement`)
  619. ); ";
  620. db_query($q);
  621. $q = "
  622. CREATE TABLE `student_settings` (
  623. `student_id` varchar(30) NOT NULL,
  624. `settings` longtext DEFAULT NULL,
  625. `posted` int(10) unsigned DEFAULT 0,
  626. PRIMARY KEY (`student_id`)
  627. ) ; ";
  628. db_query($q);
  629. $q = "
  630. CREATE TABLE `student_substitutions` (
  631. `id` int(11) NOT NULL AUTO_INCREMENT,
  632. `student_id` varchar(30) DEFAULT '',
  633. `faculty_id` varchar(30) DEFAULT '',
  634. `required_course_id` int(11) DEFAULT 0,
  635. `required_entry_value` varchar(20) DEFAULT '',
  636. `required_group_id` varchar(50) DEFAULT '',
  637. `required_degree_id` int(11) unsigned DEFAULT 0,
  638. `required_semester_num` int(11) DEFAULT 0,
  639. `sub_course_id` int(11) DEFAULT 0,
  640. `sub_entry_value` varchar(20) DEFAULT '',
  641. `sub_term_id` varchar(20) DEFAULT '',
  642. `sub_transfer_flag` tinyint(4) DEFAULT 0,
  643. `sub_hours` decimal(8,4) DEFAULT 0.0000,
  644. `sub_remarks` longtext DEFAULT NULL,
  645. `posted` int(10) unsigned DEFAULT 0,
  646. `delete_flag` tinyint(4) DEFAULT 0,
  647. PRIMARY KEY (`id`),
  648. KEY `student_id` (`student_id`),
  649. KEY `rev` (`required_entry_value`),
  650. KEY `sev` (`sub_entry_value`)
  651. ); ";
  652. db_query($q);
  653. $q = "
  654. CREATE TABLE `student_tests` (
  655. `id` int(11) NOT NULL AUTO_INCREMENT,
  656. `student_id` varchar(30) DEFAULT '',
  657. `test_id` varchar(20) DEFAULT '',
  658. `category_id` varchar(20) DEFAULT '',
  659. `score` varchar(10) DEFAULT '',
  660. `date_taken` datetime DEFAULT '1970-01-01 00:00:01',
  661. `school_id` int(11) NOT NULL DEFAULT 0,
  662. PRIMARY KEY (`id`),
  663. KEY `student_id` (`student_id`),
  664. KEY `school_id` (`school_id`)
  665. ); ";
  666. db_query($q);
  667. $q = "
  668. CREATE TABLE `student_transfer_courses` (
  669. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  670. `student_id` varchar(30) DEFAULT '',
  671. `transfer_course_id` int(11) DEFAULT 0,
  672. `student_specific_course_title` varchar(255) DEFAULT '',
  673. `term_id` varchar(20) DEFAULT '',
  674. `grade` varchar(5) DEFAULT '',
  675. `hours_awarded` decimal(8,4) DEFAULT 0.0000,
  676. `level_code` varchar(10) DEFAULT '',
  677. PRIMARY KEY (`id`) ,
  678. KEY `student_id` (`student_id`) ,
  679. KEY `transfer_id` (`transfer_course_id`) ,
  680. KEY `term_id` (`term_id`) ,
  681. KEY `grade` (`grade`) ,
  682. KEY `level_code` (`level_code`) ,
  683. KEY `hrs` (`hours_awarded`)
  684. ); ";
  685. db_query($q);
  686. $q = "
  687. CREATE TABLE `student_unassign_group` (
  688. `id` int(11) NOT NULL AUTO_INCREMENT,
  689. `student_id` varchar(30) DEFAULT '',
  690. `faculty_id` varchar(30) DEFAULT '',
  691. `course_id` int(11) DEFAULT 0,
  692. `term_id` varchar(20) DEFAULT '',
  693. `transfer_flag` tinyint(4) DEFAULT 0,
  694. `group_id` varchar(50) DEFAULT '',
  695. `degree_id` int(11) DEFAULT 0,
  696. `delete_flag` tinyint(4) DEFAULT 0,
  697. `posted` int(10) unsigned DEFAULT 0,
  698. PRIMARY KEY (`id`),
  699. KEY `student_id` (`student_id`),
  700. KEY `faculty_id` (`faculty_id`),
  701. KEY `delete_flag` (`delete_flag`)
  702. ); ";
  703. db_query($q);
  704. $q = "
  705. CREATE TABLE `student_unassign_transfer_eqv` (
  706. `id` int(11) NOT NULL AUTO_INCREMENT,
  707. `student_id` varchar(30) DEFAULT '',
  708. `faculty_id` varchar(30) DEFAULT '',
  709. `transfer_course_id` int(11) DEFAULT 0,
  710. `delete_flag` tinyint(4) DEFAULT 0,
  711. `posted` int(10) unsigned DEFAULT 0,
  712. `school_id` int(11) NOT NULL DEFAULT 0,
  713. PRIMARY KEY (`id`),
  714. KEY `student_id` (`student_id`),
  715. KEY `faculty_id` (`faculty_id`),
  716. KEY `transfer_course_id` (`transfer_course_id`),
  717. KEY `delete_flag` (`delete_flag`),
  718. KEY `school_id` (`school_id`)
  719. ); ";
  720. db_query($q);
  721. $q = "
  722. CREATE TABLE `students` (
  723. `cwid` varchar(30) NOT NULL DEFAULT '',
  724. `cumulative_hours` varchar(8) DEFAULT '',
  725. `gpa` varchar(5) DEFAULT '',
  726. `rank_code` varchar(5) DEFAULT '',
  727. `catalog_year` int(11) DEFAULT 2006,
  728. `is_active` tinyint(11) DEFAULT 0,
  729. PRIMARY KEY (`cwid`),
  730. KEY `rank_code` (`rank_code`),
  731. KEY `is_active` (`is_active`)
  732. ); ";
  733. db_query($q);
  734. $q = "
  735. CREATE TABLE `subjects` (
  736. `subject_id` varchar(10) NOT NULL,
  737. `college` varchar(10) DEFAULT NULL,
  738. `title` varchar(255) DEFAULT NULL,
  739. `school_id` int(11) NOT NULL DEFAULT 0,
  740. PRIMARY KEY (`subject_id`,`school_id`),
  741. KEY `school_id` (`school_id`)
  742. ); ";
  743. db_query($q);
  744. $q = "
  745. CREATE TABLE `transfer_courses` (
  746. `transfer_course_id` int(11) NOT NULL AUTO_INCREMENT,
  747. `institution_id` varchar(100) DEFAULT '',
  748. `subject_id` varchar(10) DEFAULT '',
  749. `course_num` varchar(10) DEFAULT '',
  750. `title` varchar(100) DEFAULT '',
  751. `description` longtext DEFAULT NULL,
  752. `min_hours` decimal(8,4) DEFAULT 0.0000,
  753. `max_hours` decimal(8,4) DEFAULT 0.0000,
  754. `school_id` int(11) NOT NULL DEFAULT 0,
  755. PRIMARY KEY (`transfer_course_id`) ,
  756. KEY `ic` (`institution_id`) ,
  757. KEY `si` (`subject_id`) ,
  758. KEY `cn` (`course_num`) ,
  759. KEY `school_id` (`school_id`)
  760. ); ";
  761. db_query($q);
  762. $q = "
  763. CREATE TABLE `transfer_eqv_per_student` (
  764. `id` int(11) NOT NULL AUTO_INCREMENT,
  765. `student_id` varchar(30) DEFAULT '',
  766. `transfer_course_id` int(11) DEFAULT 0,
  767. `local_course_id` int(11) DEFAULT 0,
  768. `valid_term_id` varchar(20) DEFAULT '',
  769. `broken_id` int(11) DEFAULT 0,
  770. PRIMARY KEY (`id`) ,
  771. KEY `student_id` (`student_id`) ,
  772. KEY `transfer_course_id` (`transfer_course_id`) ,
  773. KEY `local_course_id` (`local_course_id`) ,
  774. KEY `broken_id` (`broken_id`)
  775. ); ";
  776. db_query($q);
  777. $q = "
  778. CREATE TABLE `transfer_institutions` (
  779. `institution_id` varchar(100) NOT NULL DEFAULT '',
  780. `name` varchar(200) DEFAULT '',
  781. `state` varchar(10) DEFAULT '',
  782. `school_id` int(11) NOT NULL DEFAULT 0,
  783. PRIMARY KEY (`institution_id`) ,
  784. KEY `state` (`state`) ,
  785. KEY `name` (`name`) ,
  786. KEY `school_id` (`school_id`)
  787. ); ";
  788. db_query($q);
  789. $q = "
  790. CREATE TABLE `user_roles` (
  791. `user_id` int(11) ,
  792. `rid` int(11) DEFAULT '0',
  793. PRIMARY KEY (`user_id`,`rid`),
  794. KEY (`rid`)
  795. ); ";
  796. db_query($q);
  797. $q = "
  798. CREATE TABLE `user_settings` (
  799. `user_id` int(11) NOT NULL,
  800. `name` varchar(255) NOT NULL,
  801. `value` longtext DEFAULT NULL,
  802. `updated` int(10) unsigned DEFAULT NULL,
  803. PRIMARY KEY (`user_id`,`name`),
  804. KEY `value` (`value`(768)),
  805. KEY `user_id` (`user_id`),
  806. KEY `name` (`name`),
  807. KEY `updated` (`updated`)
  808. );";
  809. db_query($q);
  810. $q = "
  811. CREATE TABLE `users` (
  812. `user_id` int(11) NOT NULL AUTO_INCREMENT,
  813. `user_name` varchar(50) DEFAULT '',
  814. `password` varchar(255) DEFAULT '',
  815. `is_student` tinyint(4) DEFAULT 0,
  816. `is_faculty` tinyint(4) DEFAULT 0,
  817. `email` varchar(255) DEFAULT '',
  818. `cwid` varchar(30) DEFAULT '',
  819. `f_name` varchar(100) DEFAULT '',
  820. `l_name` varchar(100) DEFAULT '',
  821. `is_disabled` tinyint(4) DEFAULT 0,
  822. `last_login` int(10) unsigned DEFAULT 0,
  823. `school_id` int(11) NOT NULL DEFAULT 0,
  824. PRIMARY KEY (`user_id`) ,
  825. KEY `cwid` (`cwid`) ,
  826. KEY `user_name` (`user_name`) ,
  827. KEY `is_disabled` (`is_disabled`) ,
  828. KEY `is_faculty` (`is_faculty`) ,
  829. KEY `is_student` (`is_student`) ,
  830. KEY `school_id` (`school_id`)
  831. ); ";
  832. db_query($q);
  833. $q = "
  834. CREATE TABLE `variables` (
  835. `name` varchar(255) ,
  836. `value` longtext,
  837. PRIMARY KEY (`name`)
  838. ); ";
  839. db_query($q);
  840. $q = "
  841. CREATE TABLE `student_priority` (
  842. `student_id` varchar(30) NOT NULL,
  843. `priority_value` decimal(8,4) DEFAULT NULL,
  844. `results` longtext DEFAULT NULL,
  845. `updated` int(10) unsigned DEFAULT NULL,
  846. PRIMARY KEY (`student_id`) ,
  847. KEY `priority_value` (`priority_value`),
  848. KEY `updated` (`updated`)
  849. ); ";
  850. db_query($q);
  851. $q = "
  852. CREATE TABLE `user_attributes` (
  853. `user_id` int(11) NOT NULL,
  854. `name` varchar(255) NOT NULL,
  855. `value` longtext DEFAULT NULL,
  856. `updated` int(10) unsigned DEFAULT NULL,
  857. PRIMARY KEY (`user_id`,`name`),
  858. KEY `value` (`value`(768)),
  859. KEY `user_id` (`user_id`),
  860. KEY `name` (`name`),
  861. KEY `updated` (`updated`)
  862. ); ";
  863. db_query($q);
  864. $q = "
  865. CREATE TABLE `watchdog` (
  866. `wid` int(11) unsigned NOT NULL AUTO_INCREMENT,
  867. `user_id` int(11) unsigned DEFAULT 0,
  868. `user_name` varchar(50) DEFAULT '',
  869. `cwid` varchar(30) DEFAULT '',
  870. `type` varchar(100) DEFAULT '',
  871. `message` longtext DEFAULT NULL,
  872. `variables` longtext DEFAULT NULL,
  873. `severity` tinyint(3) unsigned DEFAULT 0,
  874. `extra_data` varchar(255) DEFAULT '',
  875. `location` longtext DEFAULT NULL,
  876. `referer` longtext DEFAULT NULL,
  877. `ip` varchar(64) DEFAULT '',
  878. `is_mobile` tinyint(4) DEFAULT 0,
  879. `is_student` tinyint(4) DEFAULT 0,
  880. `is_faculty` tinyint(4) DEFAULT 0,
  881. `timestamp` int(11) unsigned DEFAULT 0,
  882. `school_id` int(11) NOT NULL DEFAULT 0,
  883. PRIMARY KEY (`wid`) USING BTREE,
  884. KEY `type` (`type`) USING BTREE,
  885. KEY `uid` (`user_id`) USING BTREE,
  886. KEY `uname` (`user_name`) USING BTREE,
  887. KEY `severity` (`severity`) USING BTREE,
  888. KEY `cwid` (`cwid`) USING BTREE,
  889. KEY `school_id` (`school_id`) USING BTREE,
  890. KEY `timestamp` (`timestamp`) USING BTREE,
  891. KEY `is_student` (`is_student`) USING BTREE,
  892. KEY `is_faculty` (`is_faculty`) USING BTREE,
  893. KEY `idx_combo1` (`user_id`,`ip`,`type`,`timestamp`) USING BTREE
  894. );
  895. ";
  896. db_query($q);
  897. }

Functions

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