roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r1613650 - in /roller/trunk/app/src/main/resources/sql: 500-to-510-migration.vm macros.vm
Date Sat, 26 Jul 2014 15:17:15 GMT
Author: snoopdave
Date: Sat Jul 26 15:17:14 2014
New Revision: 1613650

URL: http://svn.apache.org/r1613650
Log:
Added new dropForeignKey() macro because foreign keys use different drop syntax than indexes,
also comment out alter table statement that does not work on MySQL.

Modified:
    roller/trunk/app/src/main/resources/sql/500-to-510-migration.vm
    roller/trunk/app/src/main/resources/sql/macros.vm

Modified: roller/trunk/app/src/main/resources/sql/500-to-510-migration.vm
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/resources/sql/500-to-510-migration.vm?rev=1613650&r1=1613649&r2=1613650&view=diff
==============================================================================
--- roller/trunk/app/src/main/resources/sql/500-to-510-migration.vm (original)
+++ roller/trunk/app/src/main/resources/sql/500-to-510-migration.vm Sat Jul 26 15:17:14 2014
@@ -38,8 +38,9 @@ create table custom_template_rendition (
     #columnNotNullWithDefault('type' 'varchar(16)' 'STANDARD')
 );
 
-alter table custom_template_rendition add constraint ctr_templateid_fk
-    foreign key ( templateid ) references weblog_custom_template( id ) $!db.ADDL_FK_PARAMS
;
+-- following does not work on MySQL
+-- alter table custom_template_rendition add constraint ctr_templateid_fk
+--    foreign key ( templateid ) references weblog_custom_template( id ) $!db.ADDL_FK_PARAMS
;
 
 -- capitalizing column constants as these are now stored as enums in Java.
 update weblog_custom_template set templatelang = upper(templatelang);
@@ -73,7 +74,7 @@ delete from weblogcategory where name = 
 
 -- Removal of custom ping targets
 delete from pingtarget where websiteid is not null;
-#dropIndex("pingtarget" "pt_websiteid_fk")
+#dropForeignKey("pingtarget" "pt_websiteid_fk")
 #dropColumn("pingtarget" "websiteid")
 
 #dropIndex("bookmark_folder" "folder_namefolderid_uq")
@@ -92,7 +93,7 @@ update bookmark_folder set name = 'defau
 update roller_mediafiledir set name = #concat("name" "id") where name = 'default';
 update roller_mediafiledir set name = 'default' where name = 'root' and parentid is null;
 #dropColumn("roller_mediafiledir" "path")
-#dropIndex("roller_mediafiledir" "mf_parentid_fk")
+#dropForeignKey("roller_mediafiledir" "mf_parentid_fk")
 #dropColumn("roller_mediafiledir" "parentid")
 
 -- Adding blog-specific web analytics (e.g. Google Analytics) tracking code
@@ -100,5 +101,5 @@ update roller_mediafiledir set name = 'd
 
 -- Referer table no longer populated, retaining for older Roller instances in case
 -- legacy data is desired to keep; but removing its FK relationships to other tables
-#dropIndex("referer" "ref_entryid_fk")
-#dropIndex("referer" "ref_websiteid_fk")
+#dropForeignKey("referer" "ref_entryid_fk")
+#dropForeignKey("referer" "ref_websiteid_fk")

Modified: roller/trunk/app/src/main/resources/sql/macros.vm
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/resources/sql/macros.vm?rev=1613650&r1=1613649&r2=1613650&view=diff
==============================================================================
--- roller/trunk/app/src/main/resources/sql/macros.vm (original)
+++ roller/trunk/app/src/main/resources/sql/macros.vm Sat Jul 26 15:17:14 2014
@@ -102,7 +102,7 @@ Macro to account for lack of comparable 
 #macro(longtext $size) #if($db.DBTYPE == "MYSQL") text #else varchar($size) #end #end
 
 
-#macro(dropIndex $tableName $indexName)
+#macro(dropForeignKey $tableName $indexName)
 #if ($db.DBTYPE == 'POSTGRESQL')
 drop index $indexName;
 #elseif ($db.DBTYPE == "DERBY" || $db.DBTYPE == "MYSQL")
@@ -112,6 +112,16 @@ drop index $indexName on $tableName;
 #end
 #end
 
+#macro(dropIndex $tableName $indexName)
+#if ($db.DBTYPE == 'POSTGRESQL')
+drop index $indexName;
+#elseif ($db.DBTYPE == "DERBY" || $db.DBTYPE == "MYSQL")
+alter table $tableName drop index $indexName;
+#else
+drop index $indexName on $tableName;
+#end
+#end
+
 
 #macro(dropColumn $tableName $columnName)
 alter table $tableName drop column $columnName;



Mime
View raw message