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

Functions

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