function system_install
Search API
7.x system.install | system_install() |
6.x system.install | system_install() |
4.x system.install | system_install() |
5.x system.install | system_install() |
Implementation of hook_install.
This will create all of our tables.
1 call to system_install()
- install_perform_install in ./
install.php - Actually performs the installation of FlightPath
File
- modules/
system/ system.install, line 149 - The install file for the System module
Code
function system_install() {
// Since this will ONLY be called during initial install, we do not
// need to first check for existing tables; it is assumed that the database
// is empty.
// Therefore, let's place all of our create table statements in one query, for
// simplicity.
$q = "
CREATE TABLE `advised_courses` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`advising_session_id` int(11) NOT NULL,
`course_id` int(11) NOT NULL,
`entry_value` varchar(20) NOT NULL,
`semester_num` int(11) NOT NULL,
`group_id` int(11) NOT NULL,
`var_hours` decimal(8,4) NOT NULL DEFAULT '0',
`term_id` varchar(20) NOT NULL,
PRIMARY KEY (`id`),
KEY `advid` (`advising_session_id`),
KEY `course_id` (`course_id`),
KEY `ev` (`entry_value`)
); ";
db_query($q);
$q = "
CREATE TABLE `advising_comments` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`student_id` int(11) NOT NULL,
`faculty_id` int(11) NOT NULL,
`term_id` varchar(20) NOT NULL,
`comment` text NOT NULL,
`posted` int(10) unsigned NOT NULL,
`access_type` varchar(20) NOT NULL,
`delete_flag` tinyint(4) NOT NULL,
PRIMARY KEY (`id`),
KEY `student_id` (`student_id`),
KEY `delete_flag` (`delete_flag`),
KEY `access_type` (`access_type`)
);
";
db_query($q);
$q = "
CREATE TABLE `advising_sessions` (
`advising_session_id` int(11) NOT NULL AUTO_INCREMENT,
`student_id` int(11) NOT NULL,
`faculty_id` int(11) NOT NULL,
`term_id` varchar(20) NOT NULL,
`degree_id` int(11) NOT NULL,
`major_code` varchar(20) NOT NULL,
`track_code` varchar(20) NOT NULL,
`catalog_year` int(11) NOT NULL,
`posted` int(10) unsigned NOT NULL,
`is_whatif` tinyint(4) NOT NULL DEFAULT '0',
`is_draft` tinyint(4) NOT NULL DEFAULT '0',
`is_empty` tinyint(4) NOT NULL,
PRIMARY KEY (`advising_session_id`),
KEY `sid` (`student_id`),
KEY `termid` (`term_id`)
); ";
db_query($q);
$q = "
CREATE TABLE `advisor_student` (
`faculty_id` int(10) unsigned NOT NULL,
`student_id` int(10) unsigned NOT NULL,
PRIMARY KEY (`faculty_id`,`student_id`)
); ";
db_query($q);
$q = "
CREATE TABLE `blocks` (
`bid` int(10) unsigned NOT NULL AUTO_INCREMENT,
`section` varchar(255) NOT NULL,
`region` varchar(255) NOT NULL,
`module` varchar(255) NOT NULL,
`delta` varchar(255) NOT NULL,
`weight` int(11) NOT NULL,
PRIMARY KEY (`bid`)
); ";
db_query($q);
$q = "
CREATE TABLE `courses` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`course_id` int(11) NOT NULL,
`subject_id` varchar(10) NOT NULL,
`course_num` varchar(10) NOT NULL,
`catalog_year` int(11) NOT NULL DEFAULT '2006',
`title` text NOT NULL,
`description` text NOT NULL,
`min_hours` decimal(8,4) NOT NULL,
`max_hours` decimal(8,4) NOT NULL,
`repeat_hours` decimal(8,4) NOT NULL,
`exclude` tinyint(4) NOT NULL DEFAULT '0',
`data_entry_comment` text NOT NULL,
`delete_flag` tinyint(4) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `course_id` (`course_id`),
KEY `subject_id` (`subject_id`),
KEY `course_num` (`course_num`),
KEY `catalog_year` (`catalog_year`)
); ";
db_query($q);
db_query("CREATE TABLE `colleges` (
`college_code` varchar(10) NOT NULL,
`title` varchar(255) NOT NULL,
PRIMARY KEY (`college_code`)
) ");
db_query("CREATE TABLE `degree_college` (
`major_code` varchar(20) NOT NULL,
`college_code` varchar(10) NOT NULL,
PRIMARY KEY (`major_code`),
KEY `college_code` (`college_code`)
) ");
$q = "
CREATE TABLE `degree_requirements` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`degree_id` int(11) NOT NULL,
`semester_num` int(11) NOT NULL,
`group_id` int(11) NOT NULL,
`group_requirement_type` varchar(10) NOT NULL,
`group_hours_required` decimal(8,4) NOT NULL,
`group_min_grade` varchar(10) NOT NULL,
`course_id` int(11) NOT NULL,
`course_min_grade` varchar(10) NOT NULL,
`course_requirement_type` varchar(10) NOT NULL,
`data_entry_value` varchar(50) NOT NULL,
PRIMARY KEY (`id`),
KEY `degree_id` (`degree_id`),
KEY `group_id` (`group_id`),
KEY `dev` (`data_entry_value`)
); ";
db_query($q);
$q = "
CREATE TABLE `degree_tracks` (
`track_id` int(11) NOT NULL AUTO_INCREMENT,
`catalog_year` int(11) NOT NULL DEFAULT '2006',
`major_code` varchar(10) NOT NULL,
`track_code` varchar(10) NOT NULL,
`track_title` varchar(100) NOT NULL,
`track_short_title` varchar(50) NOT NULL,
`track_description` text NOT NULL,
PRIMARY KEY (`track_id`)
); ";
db_query($q);
$q = "
CREATE TABLE `degrees` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`degree_id` int(11) NOT NULL,
`major_code` varchar(20) NOT NULL,
`degree_type` varchar(20) NOT NULL,
`degree_class` varchar(5) NOT NULL,
`title` varchar(200) NOT NULL,
`public_note` text NOT NULL,
`semester_titles_csv` text NOT NULL,
`catalog_year` int(11) NOT NULL DEFAULT '2006',
`exclude` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `degree_id` (`degree_id`)
); ";
db_query($q);
$q = "
CREATE TABLE `draft_courses` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`course_id` int(11) NOT NULL,
`subject_id` varchar(10) NOT NULL,
`course_num` varchar(10) NOT NULL,
`catalog_year` int(11) NOT NULL DEFAULT '2006',
`title` text NOT NULL,
`description` text NOT NULL,
`min_hours` decimal(8,4) NOT NULL,
`max_hours` decimal(8,4) NOT NULL,
`repeat_hours` decimal(8,4) NOT NULL,
`exclude` tinyint(4) NOT NULL DEFAULT '0',
`data_entry_comment` text NOT NULL,
`delete_flag` tinyint(4) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `course_id` (`course_id`),
KEY `subject_id` (`subject_id`),
KEY `course_num` (`course_num`),
KEY `catalog_year` (`catalog_year`)
); ";
db_query($q);
$q = "
CREATE TABLE `draft_degree_requirements` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`degree_id` int(11) NOT NULL,
`semester_num` int(11) NOT NULL,
`group_id` int(11) NOT NULL,
`group_requirement_type` varchar(10) NOT NULL,
`group_hours_required` decimal(8,4) NOT NULL,
`group_min_grade` varchar(10) NOT NULL,
`course_id` int(11) NOT NULL,
`course_min_grade` varchar(10) NOT NULL,
`course_requirement_type` varchar(10) NOT NULL,
`data_entry_value` varchar(50) NOT NULL,
PRIMARY KEY (`id`),
KEY `degree_id` (`degree_id`),
KEY `group_id` (`group_id`),
KEY `dev` (`data_entry_value`)
);";
db_query($q);
$q = "
CREATE TABLE `draft_degree_tracks` (
`track_id` int(11) NOT NULL AUTO_INCREMENT,
`catalog_year` int(11) NOT NULL DEFAULT '2006',
`major_code` varchar(10) NOT NULL,
`track_code` varchar(10) NOT NULL,
`track_title` varchar(100) NOT NULL,
`track_short_title` varchar(50) NOT NULL,
`track_description` text NOT NULL,
PRIMARY KEY (`track_id`)
); ";
db_query($q);
$q = "
CREATE TABLE `draft_degrees` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`degree_id` int(11) NOT NULL,
`major_code` varchar(20) NOT NULL,
`degree_type` varchar(20) NOT NULL,
`degree_class` varchar(5) NOT NULL,
`title` varchar(200) NOT NULL,
`public_note` text NOT NULL,
`semester_titles_csv` text NOT NULL,
`catalog_year` int(11) NOT NULL DEFAULT '2006',
`exclude` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `degree_id` (`degree_id`)
);";
db_query($q);
$q = "
CREATE TABLE `draft_group_requirements` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`group_id` int(11) NOT NULL,
`course_id` int(11) NOT NULL,
`course_min_grade` varchar(10) NOT NULL,
`course_repeats` int(11) NOT NULL DEFAULT '0',
`child_group_id` int(11) NOT NULL,
`data_entry_value` varchar(50) NOT NULL,
PRIMARY KEY (`id`),
KEY `group_id` (`group_id`),
KEY `dev` (`data_entry_value`)
); ";
db_query($q);
$q = "
CREATE TABLE `draft_groups` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`group_id` int(11) NOT NULL,
`group_name` varchar(200) NOT NULL,
`title` varchar(255) NOT NULL,
`definition` text NOT NULL,
`icon_filename` text NOT NULL,
`catalog_year` int(11) NOT NULL,
`priority` int(11) NOT NULL DEFAULT '50',
`delete_flag` tinyint(4) NOT NULL DEFAULT '0',
`data_entry_comment` text NOT NULL,
PRIMARY KEY (`id`),
KEY `group_id` (`group_id`),
KEY `group_name` (`group_name`),
KEY `catalog_year` (`catalog_year`),
KEY `title` (`title`)
); ";
db_query($q);
$q = "
CREATE TABLE `draft_instructions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`instruction` text NOT NULL,
PRIMARY KEY (`id`)
);";
db_query($q);
$q = "
CREATE TABLE `faculty` (
`cwid` int(10) unsigned NOT NULL,
`college` varchar(100) NOT NULL,
`department_code` varchar(10) NOT NULL,
`department` varchar(100) NOT NULL,
`major_code` varchar(10) NOT NULL,
PRIMARY KEY (`cwid`),
KEY `major_code` (`major_code`),
KEY `dept` (`department`),
KEY `department_code` (`department_code`),
KEY `college` (`college`)
); ";
db_query($q);
$q = "
CREATE TABLE `group_requirements` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`group_id` int(11) NOT NULL,
`course_id` int(11) NOT NULL,
`course_min_grade` varchar(10) NOT NULL,
`course_repeats` int(11) NOT NULL DEFAULT '0',
`child_group_id` int(11) NOT NULL,
`data_entry_value` varchar(50) NOT NULL,
PRIMARY KEY (`id`),
KEY `group_id` (`group_id`),
KEY `dev` (`data_entry_value`)
); ";
db_query($q);
$q = "
CREATE TABLE `groups` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`group_id` int(11) NOT NULL,
`group_name` varchar(200) NOT NULL,
`title` varchar(255) NOT NULL,
`definition` text NOT NULL,
`icon_filename` text NOT NULL,
`catalog_year` int(11) NOT NULL,
`priority` int(11) NOT NULL DEFAULT '50',
`delete_flag` tinyint(4) NOT NULL DEFAULT '0',
`data_entry_comment` text NOT NULL,
PRIMARY KEY (`id`),
KEY `group_id` (`group_id`),
KEY `group_name` (`group_name`),
KEY `catalog_year` (`catalog_year`),
KEY `title` (`title`)
); ";
db_query($q);
$q = "
CREATE TABLE `menu_router` (
`path` varchar(255) NOT NULL,
`access_callback` varchar(255) NOT NULL,
`access_arguments` text NOT NULL,
`page_callback` varchar(255) NOT NULL,
`page_arguments` text NOT NULL,
`title` varchar(255) NOT NULL,
`description` text NOT NULL,
`type` tinyint(3) unsigned NOT NULL,
`tab_family` varchar(255) NOT NULL,
`tab_parent` varchar(255) NOT NULL,
`weight` int(11) NOT NULL,
`icon` varchar(255) NOT NULL,
`page_settings` text NOT NULL,
`file` varchar(255) NOT NULL,
PRIMARY KEY (`path`),
KEY `type` (`type`),
KEY `tab_family` (`tab_family`)
); ";
db_query($q);
$q = "
CREATE TABLE `modules` (
`path` varchar(255) NOT NULL,
`name` varchar(100) NOT NULL,
`version` varchar(20) NOT NULL,
`requires` text NOT NULL,
`enabled` int(11) NOT NULL,
`weight` int(11) NOT NULL,
`type` varchar(20) NOT NULL,
`schema` int(11) NOT NULL,
`info` text NOT NULL,
PRIMARY KEY (`path`)
); ";
db_query($q);
$q = "
CREATE TABLE `role_permissions` (
`pid` int(10) unsigned NOT NULL AUTO_INCREMENT,
`rid` int(10) unsigned NOT NULL,
`perm` varchar(255) NOT NULL,
PRIMARY KEY (`pid`),
KEY `perm` (`perm`),
KEY `rid` (`rid`)
); ";
db_query($q);
$q = "
CREATE TABLE `roles` (
`rid` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
PRIMARY KEY (`rid`)
); ";
db_query($q);
$q = "
CREATE TABLE `standardized_tests` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`test_id` varchar(20) NOT NULL,
`category_id` varchar(20) NOT NULL,
`position` int(11) NOT NULL,
`test_description` varchar(200) NOT NULL,
`category_description` varchar(200) NOT NULL,
PRIMARY KEY (`id`)
); ";
db_query($q);
$q = "
CREATE TABLE `student_courses` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`student_id` int(11) NOT NULL,
`subject_id` varchar(10) NOT NULL,
`course_num` varchar(10) NOT NULL,
`hours_awarded` decimal(8,4) NOT NULL,
`grade` varchar(5) NOT NULL,
`term_id` varchar(20) NOT NULL,
PRIMARY KEY (`id`),
KEY `student_id` (`student_id`)
); ";
db_query($q);
$q = "
CREATE TABLE `student_developmentals` (
`student_id` int(11) NOT NULL,
`requirement` varchar(15) NOT NULL,
PRIMARY KEY (`student_id`,`requirement`)
); ";
db_query($q);
$q = "
CREATE TABLE `student_settings` (
`student_id` int(11) NOT NULL,
`settings` text NOT NULL,
`posted` int(10) unsigned NOT NULL,
PRIMARY KEY (`student_id`)
); ";
db_query($q);
$q = "
CREATE TABLE `student_substitutions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`student_id` int(11) NOT NULL,
`faculty_id` int(11) NOT NULL,
`required_course_id` int(11) NOT NULL,
`required_entry_value` varchar(20) NOT NULL,
`required_group_id` int(11) NOT NULL,
`required_semester_num` int(11) NOT NULL,
`sub_course_id` int(11) NOT NULL,
`sub_entry_value` varchar(20) NOT NULL,
`sub_term_id` varchar(20) NOT NULL,
`sub_transfer_flag` tinyint(4) NOT NULL,
`sub_hours` decimal(8,4) NOT NULL,
`sub_remarks` text NOT NULL,
`posted` int(10) unsigned NOT NULL,
`delete_flag` tinyint(4) NOT NULL,
PRIMARY KEY (`id`),
KEY `student_id` (`student_id`),
KEY `rev` (`required_entry_value`),
KEY `sev` (`sub_entry_value`)
); ";
db_query($q);
$q = "
CREATE TABLE `student_tests` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`student_id` int(11) NOT NULL,
`test_id` varchar(20) NOT NULL,
`category_id` varchar(20) NOT NULL,
`score` varchar(10) NOT NULL,
`date_taken` datetime NOT NULL,
PRIMARY KEY (`id`),
KEY `student_id` (`student_id`)
); ";
db_query($q);
$q = "
CREATE TABLE `student_transfer_courses` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`student_id` int(11) NOT NULL,
`transfer_course_id` int(11) NOT NULL,
`student_specific_course_title` varchar(255) NOT NULL,
`term_id` varchar(20) NOT NULL,
`grade` varchar(5) NOT NULL,
`hours_awarded` decimal(8,4) NOT NULL,
PRIMARY KEY (`id`),
KEY `student_id` (`student_id`),
KEY `transfer_id` (`transfer_course_id`),
KEY `term_id` (`term_id`),
KEY `grade` (`grade`),
KEY `hrs` (`hours_awarded`)
) ; ";
db_query($q);
$q = "
CREATE TABLE `student_unassign_group` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`student_id` int(11) NOT NULL,
`faculty_id` int(11) NOT NULL,
`course_id` int(11) NOT NULL,
`term_id` varchar(20) NOT NULL,
`transfer_flag` tinyint(4) NOT NULL DEFAULT '0',
`group_id` int(11) NOT NULL,
`delete_flag` tinyint(4) NOT NULL DEFAULT '0',
`posted` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`)
); ";
db_query($q);
$q = "
CREATE TABLE `student_unassign_transfer_eqv` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`student_id` int(11) NOT NULL,
`faculty_id` int(11) NOT NULL,
`transfer_course_id` int(11) NOT NULL,
`delete_flag` tinyint(4) NOT NULL DEFAULT '0',
`posted` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`)
); ";
db_query($q);
$q = "
CREATE TABLE `students` (
`cwid` int(11) unsigned NOT NULL,
`cumulative_hours` varchar(5) NOT NULL,
`gpa` varchar(5) NOT NULL,
`rank_code` varchar(5) NOT NULL,
`major_code` varchar(20) NOT NULL,
`catalog_year` int(11) NOT NULL,
`is_active` tinyint(11) NOT NULL,
PRIMARY KEY (`cwid`),
KEY `rank_code` (`rank_code`),
KEY `major_code` (`major_code`),
KEY `is_active` (`is_active`)
); ";
db_query($q);
$q = "
CREATE TABLE `subjects` (
`subject_id` varchar(10) NOT NULL,
`college` varchar(10) NOT NULL,
`title` varchar(255) NOT NULL,
PRIMARY KEY (`subject_id`)
); ";
db_query($q);
$q = "
CREATE TABLE `transfer_courses` (
`transfer_course_id` int(11) NOT NULL AUTO_INCREMENT,
`institution_id` varchar(10) NOT NULL,
`subject_id` varchar(10) NOT NULL,
`course_num` varchar(10) NOT NULL,
`title` varchar(100) NOT NULL,
`description` text NOT NULL,
`min_hours` decimal(8,4) NOT NULL,
`max_hours` decimal(8,4) NOT NULL,
PRIMARY KEY (`transfer_course_id`),
KEY `ic` (`institution_id`),
KEY `si` (`subject_id`),
KEY `cn` (`course_num`)
); ";
db_query($q);
$q = "
CREATE TABLE `transfer_eqv_per_student` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`student_id` int(11) NOT NULL,
`transfer_course_id` int(11) NOT NULL,
`local_course_id` int(11) NOT NULL,
`valid_term_id` varchar(20) NOT NULL,
`broken_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `student_id` (`student_id`),
KEY `transfer_course_id` (`transfer_course_id`),
KEY `local_course_id` (`local_course_id`),
KEY `broken_id` (`broken_id`)
); ";
db_query($q);
$q = "
CREATE TABLE `transfer_institutions` (
`institution_id` varchar(10) NOT NULL,
`name` varchar(200) NOT NULL,
`state` varchar(10) NOT NULL,
PRIMARY KEY (`institution_id`),
KEY `state` (`state`)
); ";
db_query($q);
$q = "
CREATE TABLE `user_roles` (
`user_id` int(11) NOT NULL,
`rid` int(11) NOT NULL,
PRIMARY KEY (`user_id`,`rid`)
); ";
db_query($q);
$q = "
CREATE TABLE `user_settings` (
`user_id` int(11) NOT NULL,
`settings` text NOT NULL,
`posted` int(10) unsigned NOT NULL,
PRIMARY KEY (`user_id`)
); ";
db_query($q);
$q = "
CREATE TABLE `users` (
`user_id` int(11) NOT NULL AUTO_INCREMENT,
`user_name` varchar(50) NOT NULL,
`password` varchar(32) NOT NULL,
`is_student` tinyint(4) NOT NULL,
`is_faculty` tinyint(4) NOT NULL,
`email` varchar(255) NOT NULL,
`cwid` int(11) NOT NULL,
`f_name` varchar(100) NOT NULL,
`l_name` varchar(100) NOT NULL,
`is_disabled` tinyint(4) NOT NULL,
PRIMARY KEY (`user_id`),
KEY `cwid` (`cwid`),
KEY `user_name` (`user_name`)
); ";
db_query($q);
$q = "
CREATE TABLE `variables` (
`name` varchar(255) NOT NULL,
`value` text NOT NULL,
PRIMARY KEY (`name`)
); ";
db_query($q);
$q = "
CREATE TABLE `watchdog` (
`wid` int(11) unsigned NOT NULL AUTO_INCREMENT,
`user_id` int(11) unsigned NOT NULL DEFAULT '0',
`user_name` varchar(50) NOT NULL,
`cwid` int(11) NOT NULL,
`type` varchar(100) NOT NULL DEFAULT '',
`message` text NOT NULL,
`variables` text NOT NULL,
`severity` tinyint(3) unsigned NOT NULL DEFAULT '0',
`extra_data` varchar(255) NOT NULL DEFAULT '',
`location` text NOT NULL,
`referer` text NOT NULL,
`ip` varchar(64) NOT NULL DEFAULT '',
`is_mobile` tinyint(4) NOT NULL,
`is_student` tinyint(4) NOT NULL,
`is_faculty` tinyint(4) NOT NULL,
`timestamp` int(11) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`wid`),
KEY `type` (`type`),
KEY `uid` (`user_id`),
KEY `uname` (`user_name`),
KEY `severity` (`severity`),
KEY `cwid` (`cwid`)
); ";
db_query($q);
}