/*Aswin 02-05-18*/
alter table admission_student_details add column fatherName varchar(45),add column isManagement int default 0;
alter table admission_student_details_pg add column fatherName varchar(45),add column isManagement int default 0;
alter table admission_student_details drop foreign key admission_student_details_ibfk_1;
alter table admission_student_details drop foreign key admission_student_details_ibfk_2;
alter table admission_student_details add constraint admission_student_details_ibfk_1 foreign key (religion) references religion (religionID);
alter table admission_student_details add constraint admission_student_details_ibfk_2 foreign key (caste) references student_caste (casteID);

/*Aswin 03-05-18*/
insert into pg_admission_appln_user_query (table_name,user_query) values ('secondLanguage','where showforadmission=1'),('admission_weightage_quotas','where isPG=1'),('admission_quotas','where quotaID not in (select coalesce(admission_quotas_id,0) as admission_quotas_id from admission_hide_fee_reservation) order by quotaName ASC'),('student_reservation','where reservID not in (select reservID from admission_hide_reservation)');
alter table autonomous_feature_settings modify column value varchar(45) default '0';
insert into autonomous_feature_settings (name,value,type,created_by,updated_by) values ('ADMISSION_CERTIFICATE_TEMPLATE','template1','ADMISSION','1','1');
alter table pg_admission_previous_university add column student_specify tinyint(1) default 0;
alter table admission_student_details_pg add column otherUniversity varchar(100);


/*Kishan 03 may 2018*/
CREATE TABLE `admission_print_appln_above_barcode` (
  `id` INT(11) NOT NULL AUTO_INCREMENT,
  `code` VARCHAR(45) NULL,
  `courseType` VARCHAR(45) NULL,
  PRIMARY KEY (`id`),
  UNIQUE INDEX `id_UNIQUE` (`id` ASC));
  
 /*for stthomas*/
  insert into admission_print_appln_above_barcode (code,courseType) values ('STCT Online ID','PG');
  
  CREATE TABLE `pg_admission_description_msg_below_eligible_courses` (
  `id` INT NOT NULL AUTO_INCREMENT,
  `message` VARCHAR(600) NULL,
  PRIMARY KEY (`id`),
  UNIQUE INDEX `id_UNIQUE` (`id` ASC));
  /*for stthomas*/
  insert into pg_admission_description_msg_below_eligible_courses (message) values ('There will be a separate entrance test for the candidates applied for Master of Social Work (MSW), Master of Visual Communication (MVC), M Sc Computer Science and MA English (except for BA English Candidates)in the college. Candidates applied for MSW, GD and interview will be conducted on the same day.');
  
  
  /*for vimala*/
  insert into pg_admission_description_msg_below_eligible_courses (message) values ('There will be a separate entrance test for the candidates applied for Master of Social Work (MSW) and MA English in the college.');

  
  CREATE TABLE `admission_pg_course_open` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `patterncourseID` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `patterncourseID` (`patterncourseID`)
) ENGINE=InnoDB;

/*Aswin 06-05-18*/
alter table admission_student_details_pg add column taluk varchar(45),add column state varchar(45);
alter table admission_student_details add column taluk varchar(45),add column state varchar(45);
insert into autonomous_feature_settings (name,value,type,created_by,updated_by) values ('ADMISSION_IMAGE_COMPRESSION','1','ADMISSION','1','1');

CREATE TABLE `admissionPrintTemplates` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `templatePrintUrl` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB



/*Kishan 07-05-2018*/

ALTER TABLE `db_stthomas`.`admission_appln_forms_fields` 
CHANGE COLUMN `description` `description` VARCHAR(300) NULL DEFAULT NULL ;



/*Kishan 08 may 2018*/

ALTER TABLE `student_caste` 
DROP FOREIGN KEY `student_caste_ibfk_1`;
ALTER TABLE `student_caste` 
ADD INDEX `student_caste_ibfk_1_idx` (`religionID` ASC),
DROP INDEX `religionID` ;
ALTER TABLE `student_caste` 
ADD CONSTRAINT `student_caste_ibfk_1`
  FOREIGN KEY (`religionID`)
  REFERENCES `religion` (`religionID`)
  ON DELETE RESTRICT
  ON UPDATE CASCADE;


/*Aswin 08-05-2018*/
create table admission_indian_states (id int primary key auto_increment,state_name varchar(45));

CREATE TABLE `districts` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `admission_indian_states_id` INT DEFAULT NULL,
  `districtName` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB;

CREATE TABLE `taluks` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `admission_indian_states_id` INT DEFAULT NULL,
  `districts_id` INT DEFAULT NULL,
  `talukName` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB;

CREATE TABLE `nationality` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `nationalityName` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB;

/*Kishan 09 May 2018*/
ALTER TABLE `admission_online_payment` 
ADD COLUMN `gateway` VARCHAR(45) NULL AFTER `transactionDate`;





/*Aswin 09-05-2018*/
create table admission_campus_type (id int primary key auto_increment,name varchar(45),patterncourseID int);



/*Kishan may 10 2018*/

ALTER TABLE `reservation_students` 
ADD COLUMN `hide_admission` TINYINT NULL DEFAULT 0 AFTER `reservationCode`;



alter table reservation_students add column hide_admission tinyint(1) default 0;
insert into admission_appln_user_query (table_name,user_query) values ('reservation_students',' where hide_admission<>1');

