 BEGIN
 	IF (SELECT REPLACE(property_value, '.', '0') < REPLACE(new_db_version, '.', '0') FROM global_property WHERE property = 'database_version') THEN
 
-		select 'Updating concept_word table' AS '*** Step: ***', new_db_version from dual;
-
-		ALTER TABLE `concept_name` DROP COLUMN `concept_name_id`;
+		select 'Dropping concept_name_id from obs table (this may fail, which is ok)' AS '*** Step: ***', new_db_version from dual;
+
+		ALTER TABLE `obs` DROP COLUMN `concept_name_id`;
 		
-		ALTER TABLE `concept_name` DROP FOREIGN KEY `concept_name_id`;
+		ALTER TABLE `obs` DROP FOREIGN KEY `concept_name_id`;
 
 		select '***' AS '...done' from dual;
 


		select 'Updating obs' AS '*** Step: ***', new_db_version from dual;

		ALTER TABLE `obs` ADD COLUMN `concept_name_id` int(11) AFTER `concept_id`;
		ALTER TABLE `obs` ADD COLUMN `value_coded_name_id` int(11) AFTER `value_coded`;

		select '***' AS '...done' from dual;


		select 'Constraining obs' AS '*** Step: ***', new_db_version from dual;
		
		ALTER TABLE `obs` ADD CONSTRAINT `obs_name_of_coded_value` FOREIGN KEY (`value_coded_name_id`) 
			REFERENCES `concept_name` (`concept_name_id`);

