Author: namit Date: Fri Feb 8 11:43:09 2013 New Revision: 1443952 URL: http://svn.apache.org/r1443952 Log: HIVE-3999 Mysql metastore upgrade script will end up with different schema than the full schema load (Jarek and Mark via namit)
Modified: hive/trunk/metastore/scripts/upgrade/mysql/011-HIVE-3649.mysql.sql Modified: hive/trunk/metastore/scripts/upgrade/mysql/011-HIVE-3649.mysql.sql URL: http://svn.apache.org/viewvc/hive/trunk/metastore/scripts/upgrade/mysql/011-HIVE-3649.mysql.sql?rev=1443952&r1=1443951&r2=1443952&view=diff ============================================================================== --- hive/trunk/metastore/scripts/upgrade/mysql/011-HIVE-3649.mysql.sql (original) +++ hive/trunk/metastore/scripts/upgrade/mysql/011-HIVE-3649.mysql.sql Fri Feb 8 11:43:09 2013 @@ -1,2 +1,11 @@ SELECT '< HIVE-3649: Support stored as directories >' AS ' '; -ALTER TABLE `SDS` ADD `IS_STOREDASSUBDIRECTORIES` bit(1) ; +-- Add new not null column into SDS table in three steps + +-- Step 1: Add the column allowing null +ALTER TABLE `SDS` ADD `IS_STOREDASSUBDIRECTORIES` bit(1); + + -- Step 2: Replace the null with default value (false) +UPDATE `SDS` SET `IS_STOREDASSUBDIRECTORIES` = false; + +-- Step 3: Alter the column to disallow null values +ALTER TABLE `SDS` MODIFY COLUMN `IS_STOREDASSUBDIRECTORIES` bit(1) NOT NULL;