course_search.install
Search API
- 7.x modules/course_search/course_search.install
- 6.x modules/course_search/course_search.install
- 4.x modules/course_search/course_search.install
- 5.x modules/course_search/course_search.install
File
modules/course_search/course_search.installView source
- <?php
-
-
- /**
- * Implementation of hook_install
- */
- function course_search_install() {
- if (!db_table_exists("course_rotation_schedule")) {
- $query = "
- CREATE TABLE `course_rotation_schedule` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `faculty_id` varchar(30) NOT NULL DEFAULT '',
- `course_id` int(11) NOT NULL DEFAULT 0,
- `term_id` varchar(20) NOT NULL DEFAULT '',
- `entry_value` varchar(20) NOT NULL DEFAULT '',
- `posted` int(10) unsigned NOT NULL DEFAULT 0,
- `capacity` int(11) DEFAULT NULL,
- PRIMARY KEY (`id`),
- KEY `capacity` (`capacity`),
- KEY `course_id` (`course_id`),
- KEY `term_id` (`term_id`),
- KEY `posted` (`posted`)
- ); ";
-
- db_query($query);
- }
-
-
- if (!db_table_exists("course_syllabi")) {
- $query = "
- CREATE TABLE `course_syllabi` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `course_id` int(11) NOT NULL DEFAULT 0,
- `course_perm_id` varchar(20) NOT NULL DEFAULT '',
- `filename` varchar(255) NOT NULL DEFAULT '',
- `posted` int(10) unsigned NOT NULL DEFAULT 0,
- PRIMARY KEY (`id`),
- KEY `course_id` (`course_id`),
- KEY `perm` (`course_perm_id`)
- ); ";
-
- db_query($query);
- }
-
- } // hook_install
-
-
-
- /**
- * Implements hook_update
- */
- function course_search_update($old_schema, $new_schema) {
-
- if ($old_schema < 2) {
- // Add new column to course_rotation_schedule to keep up with seat capacity.
- db_query("ALTER TABLE course_rotation_schedule ADD COLUMN `capacity` int(11) ");
- db_query("ALTER TABLE course_rotation_schedule ADD INDEX (`capacity`) ");
-
- // Also add extra indexes for better searching
- db_query("ALTER TABLE course_rotation_schedule ADD INDEX (`course_id`) ");
- db_query("ALTER TABLE course_rotation_schedule ADD INDEX (`term_id`) ");
- db_query("ALTER TABLE course_rotation_schedule ADD INDEX (`posted`) ");
-
- }
-
-
- } // hook_update
Functions
Name | Description |
---|---|
course_search_install | Implementation of hook_install |
course_search_update | Implements hook_update |