You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2017/12/19 06:41:46 UTC

[GitHub] rhtyd closed pull request #2247: CLOUDSTACK-10012: Load SQL schema scripts from JAR

rhtyd closed pull request #2247: CLOUDSTACK-10012: Load SQL schema scripts from JAR
URL: https://github.com/apache/cloudstack/pull/2247
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/client/pom.xml b/client/pom.xml
index 63980b9a1f2..a6e0383b48b 100644
--- a/client/pom.xml
+++ b/client/pom.xml
@@ -584,7 +584,7 @@
                 </copy>
                 <copy overwrite="true" todir="${basedir}/target/utilities/scripts/db">
                   <fileset dir="${basedir}/../setup/db">
-                    <include name="**/*"/>
+                    <include name="*"/>
                   </fileset>
                   <filterchain>
                     <filterreader classname="org.apache.tools.ant.filters.ReplaceTokens">
diff --git a/setup/db/db/create-default-role-api-mappings.sql b/engine/schema/resources/META-INF/db/create-default-role-api-mappings.sql
similarity index 100%
rename from setup/db/db/create-default-role-api-mappings.sql
rename to engine/schema/resources/META-INF/db/create-default-role-api-mappings.sql
diff --git a/setup/db/db/data-217to218.sql b/engine/schema/resources/META-INF/db/data-217to218.sql
similarity index 100%
rename from setup/db/db/data-217to218.sql
rename to engine/schema/resources/META-INF/db/data-217to218.sql
diff --git a/setup/db/db/schema-20to21.sql b/engine/schema/resources/META-INF/db/schema-20to21.sql
similarity index 100%
rename from setup/db/db/schema-20to21.sql
rename to engine/schema/resources/META-INF/db/schema-20to21.sql
diff --git a/setup/db/db/schema-217to218.sql b/engine/schema/resources/META-INF/db/schema-217to218.sql
similarity index 100%
rename from setup/db/db/schema-217to218.sql
rename to engine/schema/resources/META-INF/db/schema-217to218.sql
diff --git a/setup/db/db/schema-21to22-cleanup.sql b/engine/schema/resources/META-INF/db/schema-21to22-cleanup.sql
similarity index 100%
rename from setup/db/db/schema-21to22-cleanup.sql
rename to engine/schema/resources/META-INF/db/schema-21to22-cleanup.sql
diff --git a/setup/db/db/schema-21to22-premium.sql b/engine/schema/resources/META-INF/db/schema-21to22-premium.sql
similarity index 100%
rename from setup/db/db/schema-21to22-premium.sql
rename to engine/schema/resources/META-INF/db/schema-21to22-premium.sql
diff --git a/setup/db/db/schema-21to22.sql b/engine/schema/resources/META-INF/db/schema-21to22.sql
similarity index 100%
rename from setup/db/db/schema-21to22.sql
rename to engine/schema/resources/META-INF/db/schema-21to22.sql
diff --git a/setup/db/db/schema-2210to2211.sql b/engine/schema/resources/META-INF/db/schema-2210to2211.sql
similarity index 100%
rename from setup/db/db/schema-2210to2211.sql
rename to engine/schema/resources/META-INF/db/schema-2210to2211.sql
diff --git a/setup/db/db/schema-2211to2212-premium.sql b/engine/schema/resources/META-INF/db/schema-2211to2212-premium.sql
similarity index 100%
rename from setup/db/db/schema-2211to2212-premium.sql
rename to engine/schema/resources/META-INF/db/schema-2211to2212-premium.sql
diff --git a/setup/db/db/schema-2211to2212.sql b/engine/schema/resources/META-INF/db/schema-2211to2212.sql
similarity index 100%
rename from setup/db/db/schema-2211to2212.sql
rename to engine/schema/resources/META-INF/db/schema-2211to2212.sql
diff --git a/setup/db/db/schema-2212to2213.sql b/engine/schema/resources/META-INF/db/schema-2212to2213.sql
similarity index 100%
rename from setup/db/db/schema-2212to2213.sql
rename to engine/schema/resources/META-INF/db/schema-2212to2213.sql
diff --git a/setup/db/db/schema-2213to2214.sql b/engine/schema/resources/META-INF/db/schema-2213to2214.sql
similarity index 100%
rename from setup/db/db/schema-2213to2214.sql
rename to engine/schema/resources/META-INF/db/schema-2213to2214.sql
diff --git a/setup/db/db/schema-2214to30-cleanup.sql b/engine/schema/resources/META-INF/db/schema-2214to30-cleanup.sql
similarity index 100%
rename from setup/db/db/schema-2214to30-cleanup.sql
rename to engine/schema/resources/META-INF/db/schema-2214to30-cleanup.sql
diff --git a/setup/db/db/schema-2214to30.sql b/engine/schema/resources/META-INF/db/schema-2214to30.sql
similarity index 100%
rename from setup/db/db/schema-2214to30.sql
rename to engine/schema/resources/META-INF/db/schema-2214to30.sql
diff --git a/setup/db/db/schema-221to222-cleanup.sql b/engine/schema/resources/META-INF/db/schema-221to222-cleanup.sql
similarity index 100%
rename from setup/db/db/schema-221to222-cleanup.sql
rename to engine/schema/resources/META-INF/db/schema-221to222-cleanup.sql
diff --git a/setup/db/db/schema-221to222-premium.sql b/engine/schema/resources/META-INF/db/schema-221to222-premium.sql
similarity index 100%
rename from setup/db/db/schema-221to222-premium.sql
rename to engine/schema/resources/META-INF/db/schema-221to222-premium.sql
diff --git a/setup/db/db/schema-221to222.sql b/engine/schema/resources/META-INF/db/schema-221to222.sql
similarity index 100%
rename from setup/db/db/schema-221to222.sql
rename to engine/schema/resources/META-INF/db/schema-221to222.sql
diff --git a/setup/db/db/schema-222to224-cleanup.sql b/engine/schema/resources/META-INF/db/schema-222to224-cleanup.sql
similarity index 100%
rename from setup/db/db/schema-222to224-cleanup.sql
rename to engine/schema/resources/META-INF/db/schema-222to224-cleanup.sql
diff --git a/setup/db/db/schema-222to224-premium.sql b/engine/schema/resources/META-INF/db/schema-222to224-premium.sql
similarity index 100%
rename from setup/db/db/schema-222to224-premium.sql
rename to engine/schema/resources/META-INF/db/schema-222to224-premium.sql
diff --git a/setup/db/db/schema-222to224.sql b/engine/schema/resources/META-INF/db/schema-222to224.sql
similarity index 100%
rename from setup/db/db/schema-222to224.sql
rename to engine/schema/resources/META-INF/db/schema-222to224.sql
diff --git a/setup/db/db/schema-224to225-cleanup.sql b/engine/schema/resources/META-INF/db/schema-224to225-cleanup.sql
similarity index 100%
rename from setup/db/db/schema-224to225-cleanup.sql
rename to engine/schema/resources/META-INF/db/schema-224to225-cleanup.sql
diff --git a/setup/db/db/schema-224to225.sql b/engine/schema/resources/META-INF/db/schema-224to225.sql
similarity index 100%
rename from setup/db/db/schema-224to225.sql
rename to engine/schema/resources/META-INF/db/schema-224to225.sql
diff --git a/setup/db/db/schema-225to226.sql b/engine/schema/resources/META-INF/db/schema-225to226.sql
similarity index 100%
rename from setup/db/db/schema-225to226.sql
rename to engine/schema/resources/META-INF/db/schema-225to226.sql
diff --git a/setup/db/db/schema-227to228-premium.sql b/engine/schema/resources/META-INF/db/schema-227to228-premium.sql
similarity index 100%
rename from setup/db/db/schema-227to228-premium.sql
rename to engine/schema/resources/META-INF/db/schema-227to228-premium.sql
diff --git a/setup/db/db/schema-227to228.sql b/engine/schema/resources/META-INF/db/schema-227to228.sql
similarity index 100%
rename from setup/db/db/schema-227to228.sql
rename to engine/schema/resources/META-INF/db/schema-227to228.sql
diff --git a/setup/db/db/schema-228to229.sql b/engine/schema/resources/META-INF/db/schema-228to229.sql
similarity index 100%
rename from setup/db/db/schema-228to229.sql
rename to engine/schema/resources/META-INF/db/schema-228to229.sql
diff --git a/setup/db/db/schema-229to2210.sql b/engine/schema/resources/META-INF/db/schema-229to2210.sql
similarity index 100%
rename from setup/db/db/schema-229to2210.sql
rename to engine/schema/resources/META-INF/db/schema-229to2210.sql
diff --git a/setup/db/db/schema-22beta1to22beta2.sql b/engine/schema/resources/META-INF/db/schema-22beta1to22beta2.sql
similarity index 100%
rename from setup/db/db/schema-22beta1to22beta2.sql
rename to engine/schema/resources/META-INF/db/schema-22beta1to22beta2.sql
diff --git a/setup/db/db/schema-22beta3to22beta4.sql b/engine/schema/resources/META-INF/db/schema-22beta3to22beta4.sql
similarity index 100%
rename from setup/db/db/schema-22beta3to22beta4.sql
rename to engine/schema/resources/META-INF/db/schema-22beta3to22beta4.sql
diff --git a/setup/db/db/schema-301to302-cleanup.sql b/engine/schema/resources/META-INF/db/schema-301to302-cleanup.sql
similarity index 100%
rename from setup/db/db/schema-301to302-cleanup.sql
rename to engine/schema/resources/META-INF/db/schema-301to302-cleanup.sql
diff --git a/setup/db/db/schema-301to302.sql b/engine/schema/resources/META-INF/db/schema-301to302.sql
similarity index 100%
rename from setup/db/db/schema-301to302.sql
rename to engine/schema/resources/META-INF/db/schema-301to302.sql
diff --git a/setup/db/db/schema-302to303.sql b/engine/schema/resources/META-INF/db/schema-302to303.sql
similarity index 100%
rename from setup/db/db/schema-302to303.sql
rename to engine/schema/resources/META-INF/db/schema-302to303.sql
diff --git a/setup/db/db/schema-302to40-cleanup.sql b/engine/schema/resources/META-INF/db/schema-302to40-cleanup.sql
similarity index 100%
rename from setup/db/db/schema-302to40-cleanup.sql
rename to engine/schema/resources/META-INF/db/schema-302to40-cleanup.sql
diff --git a/setup/db/db/schema-302to40.sql b/engine/schema/resources/META-INF/db/schema-302to40.sql
similarity index 100%
rename from setup/db/db/schema-302to40.sql
rename to engine/schema/resources/META-INF/db/schema-302to40.sql
diff --git a/setup/db/db/schema-304to305-cleanup.sql b/engine/schema/resources/META-INF/db/schema-304to305-cleanup.sql
similarity index 100%
rename from setup/db/db/schema-304to305-cleanup.sql
rename to engine/schema/resources/META-INF/db/schema-304to305-cleanup.sql
diff --git a/setup/db/db/schema-304to305.sql b/engine/schema/resources/META-INF/db/schema-304to305.sql
similarity index 100%
rename from setup/db/db/schema-304to305.sql
rename to engine/schema/resources/META-INF/db/schema-304to305.sql
diff --git a/setup/db/db/schema-305to306-cleanup.sql b/engine/schema/resources/META-INF/db/schema-305to306-cleanup.sql
similarity index 100%
rename from setup/db/db/schema-305to306-cleanup.sql
rename to engine/schema/resources/META-INF/db/schema-305to306-cleanup.sql
diff --git a/setup/db/db/schema-305to306.sql b/engine/schema/resources/META-INF/db/schema-305to306.sql
similarity index 100%
rename from setup/db/db/schema-305to306.sql
rename to engine/schema/resources/META-INF/db/schema-305to306.sql
diff --git a/setup/db/db/schema-306to307.sql b/engine/schema/resources/META-INF/db/schema-306to307.sql
similarity index 100%
rename from setup/db/db/schema-306to307.sql
rename to engine/schema/resources/META-INF/db/schema-306to307.sql
diff --git a/setup/db/db/schema-307to410-cleanup.sql b/engine/schema/resources/META-INF/db/schema-307to410-cleanup.sql
similarity index 100%
rename from setup/db/db/schema-307to410-cleanup.sql
rename to engine/schema/resources/META-INF/db/schema-307to410-cleanup.sql
diff --git a/setup/db/db/schema-307to410.sql b/engine/schema/resources/META-INF/db/schema-307to410.sql
similarity index 100%
rename from setup/db/db/schema-307to410.sql
rename to engine/schema/resources/META-INF/db/schema-307to410.sql
diff --git a/setup/db/db/schema-30to301.sql b/engine/schema/resources/META-INF/db/schema-30to301.sql
similarity index 100%
rename from setup/db/db/schema-30to301.sql
rename to engine/schema/resources/META-INF/db/schema-30to301.sql
diff --git a/setup/db/db/schema-40to410-cleanup.sql b/engine/schema/resources/META-INF/db/schema-40to410-cleanup.sql
similarity index 100%
rename from setup/db/db/schema-40to410-cleanup.sql
rename to engine/schema/resources/META-INF/db/schema-40to410-cleanup.sql
diff --git a/setup/db/db/schema-40to410.sql b/engine/schema/resources/META-INF/db/schema-40to410.sql
similarity index 100%
rename from setup/db/db/schema-40to410.sql
rename to engine/schema/resources/META-INF/db/schema-40to410.sql
diff --git a/setup/db/db/schema-41000to41100-cleanup.sql b/engine/schema/resources/META-INF/db/schema-41000to41100-cleanup.sql
similarity index 100%
rename from setup/db/db/schema-41000to41100-cleanup.sql
rename to engine/schema/resources/META-INF/db/schema-41000to41100-cleanup.sql
diff --git a/setup/db/db/schema-41000to41100.sql b/engine/schema/resources/META-INF/db/schema-41000to41100.sql
similarity index 100%
rename from setup/db/db/schema-41000to41100.sql
rename to engine/schema/resources/META-INF/db/schema-41000to41100.sql
diff --git a/setup/db/db/schema-410to420-cleanup.sql b/engine/schema/resources/META-INF/db/schema-410to420-cleanup.sql
similarity index 100%
rename from setup/db/db/schema-410to420-cleanup.sql
rename to engine/schema/resources/META-INF/db/schema-410to420-cleanup.sql
diff --git a/setup/db/db/schema-410to420.sql b/engine/schema/resources/META-INF/db/schema-410to420.sql
similarity index 100%
rename from setup/db/db/schema-410to420.sql
rename to engine/schema/resources/META-INF/db/schema-410to420.sql
diff --git a/setup/db/db/schema-420to421.sql b/engine/schema/resources/META-INF/db/schema-420to421.sql
similarity index 100%
rename from setup/db/db/schema-420to421.sql
rename to engine/schema/resources/META-INF/db/schema-420to421.sql
diff --git a/setup/db/db/schema-421to430-cleanup.sql b/engine/schema/resources/META-INF/db/schema-421to430-cleanup.sql
similarity index 100%
rename from setup/db/db/schema-421to430-cleanup.sql
rename to engine/schema/resources/META-INF/db/schema-421to430-cleanup.sql
diff --git a/setup/db/db/schema-421to430.sql b/engine/schema/resources/META-INF/db/schema-421to430.sql
similarity index 100%
rename from setup/db/db/schema-421to430.sql
rename to engine/schema/resources/META-INF/db/schema-421to430.sql
diff --git a/setup/db/db/schema-430to440-cleanup.sql b/engine/schema/resources/META-INF/db/schema-430to440-cleanup.sql
similarity index 100%
rename from setup/db/db/schema-430to440-cleanup.sql
rename to engine/schema/resources/META-INF/db/schema-430to440-cleanup.sql
diff --git a/setup/db/db/schema-430to440.sql b/engine/schema/resources/META-INF/db/schema-430to440.sql
similarity index 100%
rename from setup/db/db/schema-430to440.sql
rename to engine/schema/resources/META-INF/db/schema-430to440.sql
diff --git a/setup/db/db/schema-440to441-cleanup.sql b/engine/schema/resources/META-INF/db/schema-440to441-cleanup.sql
similarity index 100%
rename from setup/db/db/schema-440to441-cleanup.sql
rename to engine/schema/resources/META-INF/db/schema-440to441-cleanup.sql
diff --git a/setup/db/db/schema-440to441.sql b/engine/schema/resources/META-INF/db/schema-440to441.sql
similarity index 100%
rename from setup/db/db/schema-440to441.sql
rename to engine/schema/resources/META-INF/db/schema-440to441.sql
diff --git a/setup/db/db/schema-441to442.sql b/engine/schema/resources/META-INF/db/schema-441to442.sql
similarity index 100%
rename from setup/db/db/schema-441to442.sql
rename to engine/schema/resources/META-INF/db/schema-441to442.sql
diff --git a/setup/db/db/schema-442to450-cleanup.sql b/engine/schema/resources/META-INF/db/schema-442to450-cleanup.sql
similarity index 100%
rename from setup/db/db/schema-442to450-cleanup.sql
rename to engine/schema/resources/META-INF/db/schema-442to450-cleanup.sql
diff --git a/setup/db/db/schema-442to450.sql b/engine/schema/resources/META-INF/db/schema-442to450.sql
similarity index 100%
rename from setup/db/db/schema-442to450.sql
rename to engine/schema/resources/META-INF/db/schema-442to450.sql
diff --git a/setup/db/db/schema-443to444.sql b/engine/schema/resources/META-INF/db/schema-443to444.sql
similarity index 100%
rename from setup/db/db/schema-443to444.sql
rename to engine/schema/resources/META-INF/db/schema-443to444.sql
diff --git a/setup/db/db/schema-450to451-cleanup.sql b/engine/schema/resources/META-INF/db/schema-450to451-cleanup.sql
similarity index 100%
rename from setup/db/db/schema-450to451-cleanup.sql
rename to engine/schema/resources/META-INF/db/schema-450to451-cleanup.sql
diff --git a/setup/db/db/schema-450to451.sql b/engine/schema/resources/META-INF/db/schema-450to451.sql
similarity index 100%
rename from setup/db/db/schema-450to451.sql
rename to engine/schema/resources/META-INF/db/schema-450to451.sql
diff --git a/setup/db/db/schema-451to452-cleanup.sql b/engine/schema/resources/META-INF/db/schema-451to452-cleanup.sql
similarity index 100%
rename from setup/db/db/schema-451to452-cleanup.sql
rename to engine/schema/resources/META-INF/db/schema-451to452-cleanup.sql
diff --git a/setup/db/db/schema-451to452.sql b/engine/schema/resources/META-INF/db/schema-451to452.sql
similarity index 100%
rename from setup/db/db/schema-451to452.sql
rename to engine/schema/resources/META-INF/db/schema-451to452.sql
diff --git a/setup/db/db/schema-452to453-cleanup.sql b/engine/schema/resources/META-INF/db/schema-452to453-cleanup.sql
similarity index 100%
rename from setup/db/db/schema-452to453-cleanup.sql
rename to engine/schema/resources/META-INF/db/schema-452to453-cleanup.sql
diff --git a/setup/db/db/schema-452to453.sql b/engine/schema/resources/META-INF/db/schema-452to453.sql
similarity index 100%
rename from setup/db/db/schema-452to453.sql
rename to engine/schema/resources/META-INF/db/schema-452to453.sql
diff --git a/setup/db/db/schema-452to460-cleanup.sql b/engine/schema/resources/META-INF/db/schema-452to460-cleanup.sql
similarity index 100%
rename from setup/db/db/schema-452to460-cleanup.sql
rename to engine/schema/resources/META-INF/db/schema-452to460-cleanup.sql
diff --git a/setup/db/db/schema-452to460.sql b/engine/schema/resources/META-INF/db/schema-452to460.sql
similarity index 100%
rename from setup/db/db/schema-452to460.sql
rename to engine/schema/resources/META-INF/db/schema-452to460.sql
diff --git a/setup/db/db/schema-460to461-cleanup.sql b/engine/schema/resources/META-INF/db/schema-460to461-cleanup.sql
similarity index 100%
rename from setup/db/db/schema-460to461-cleanup.sql
rename to engine/schema/resources/META-INF/db/schema-460to461-cleanup.sql
diff --git a/setup/db/db/schema-460to461.sql b/engine/schema/resources/META-INF/db/schema-460to461.sql
similarity index 100%
rename from setup/db/db/schema-460to461.sql
rename to engine/schema/resources/META-INF/db/schema-460to461.sql
diff --git a/setup/db/db/schema-461to470-cleanup.sql b/engine/schema/resources/META-INF/db/schema-461to470-cleanup.sql
similarity index 100%
rename from setup/db/db/schema-461to470-cleanup.sql
rename to engine/schema/resources/META-INF/db/schema-461to470-cleanup.sql
diff --git a/setup/db/db/schema-461to470.sql b/engine/schema/resources/META-INF/db/schema-461to470.sql
similarity index 100%
rename from setup/db/db/schema-461to470.sql
rename to engine/schema/resources/META-INF/db/schema-461to470.sql
diff --git a/setup/db/db/schema-470to471-cleanup.sql b/engine/schema/resources/META-INF/db/schema-470to471-cleanup.sql
similarity index 100%
rename from setup/db/db/schema-470to471-cleanup.sql
rename to engine/schema/resources/META-INF/db/schema-470to471-cleanup.sql
diff --git a/setup/db/db/schema-470to471.sql b/engine/schema/resources/META-INF/db/schema-470to471.sql
similarity index 100%
rename from setup/db/db/schema-470to471.sql
rename to engine/schema/resources/META-INF/db/schema-470to471.sql
diff --git a/setup/db/db/schema-471to480-cleanup.sql b/engine/schema/resources/META-INF/db/schema-471to480-cleanup.sql
similarity index 100%
rename from setup/db/db/schema-471to480-cleanup.sql
rename to engine/schema/resources/META-INF/db/schema-471to480-cleanup.sql
diff --git a/setup/db/db/schema-471to480.sql b/engine/schema/resources/META-INF/db/schema-471to480.sql
similarity index 100%
rename from setup/db/db/schema-471to480.sql
rename to engine/schema/resources/META-INF/db/schema-471to480.sql
diff --git a/setup/db/db/schema-480to481-cleanup.sql b/engine/schema/resources/META-INF/db/schema-480to481-cleanup.sql
similarity index 100%
rename from setup/db/db/schema-480to481-cleanup.sql
rename to engine/schema/resources/META-INF/db/schema-480to481-cleanup.sql
diff --git a/setup/db/db/schema-480to481.sql b/engine/schema/resources/META-INF/db/schema-480to481.sql
similarity index 100%
rename from setup/db/db/schema-480to481.sql
rename to engine/schema/resources/META-INF/db/schema-480to481.sql
diff --git a/setup/db/db/schema-481to490-cleanup.sql b/engine/schema/resources/META-INF/db/schema-481to490-cleanup.sql
similarity index 100%
rename from setup/db/db/schema-481to490-cleanup.sql
rename to engine/schema/resources/META-INF/db/schema-481to490-cleanup.sql
diff --git a/setup/db/db/schema-481to490.sql b/engine/schema/resources/META-INF/db/schema-481to490.sql
similarity index 100%
rename from setup/db/db/schema-481to490.sql
rename to engine/schema/resources/META-INF/db/schema-481to490.sql
diff --git a/setup/db/db/schema-490to4910-cleanup.sql b/engine/schema/resources/META-INF/db/schema-490to4910-cleanup.sql
similarity index 100%
rename from setup/db/db/schema-490to4910-cleanup.sql
rename to engine/schema/resources/META-INF/db/schema-490to4910-cleanup.sql
diff --git a/setup/db/db/schema-490to4910.sql b/engine/schema/resources/META-INF/db/schema-490to4910.sql
similarity index 100%
rename from setup/db/db/schema-490to4910.sql
rename to engine/schema/resources/META-INF/db/schema-490to4910.sql
diff --git a/setup/db/db/schema-4910to4920-cleanup.sql b/engine/schema/resources/META-INF/db/schema-4910to4920-cleanup.sql
similarity index 100%
rename from setup/db/db/schema-4910to4920-cleanup.sql
rename to engine/schema/resources/META-INF/db/schema-4910to4920-cleanup.sql
diff --git a/setup/db/db/schema-4910to4920.sql b/engine/schema/resources/META-INF/db/schema-4910to4920.sql
similarity index 100%
rename from setup/db/db/schema-4910to4920.sql
rename to engine/schema/resources/META-INF/db/schema-4910to4920.sql
diff --git a/setup/db/db/schema-4920to4930-cleanup.sql b/engine/schema/resources/META-INF/db/schema-4920to4930-cleanup.sql
similarity index 100%
rename from setup/db/db/schema-4920to4930-cleanup.sql
rename to engine/schema/resources/META-INF/db/schema-4920to4930-cleanup.sql
diff --git a/setup/db/db/schema-4920to4930.sql b/engine/schema/resources/META-INF/db/schema-4920to4930.sql
similarity index 100%
rename from setup/db/db/schema-4920to4930.sql
rename to engine/schema/resources/META-INF/db/schema-4920to4930.sql
diff --git a/setup/db/db/schema-4930to41000-cleanup.sql b/engine/schema/resources/META-INF/db/schema-4930to41000-cleanup.sql
similarity index 100%
rename from setup/db/db/schema-4930to41000-cleanup.sql
rename to engine/schema/resources/META-INF/db/schema-4930to41000-cleanup.sql
diff --git a/setup/db/db/schema-4930to41000.sql b/engine/schema/resources/META-INF/db/schema-4930to41000.sql
similarity index 100%
rename from setup/db/db/schema-4930to41000.sql
rename to engine/schema/resources/META-INF/db/schema-4930to41000.sql
diff --git a/setup/db/db/schema-level.sql b/engine/schema/resources/META-INF/db/schema-level.sql
similarity index 100%
rename from setup/db/db/schema-level.sql
rename to engine/schema/resources/META-INF/db/schema-level.sql
diff --git a/setup/db/db/schema-snapshot-217to224.sql b/engine/schema/resources/META-INF/db/schema-snapshot-217to224.sql
similarity index 100%
rename from setup/db/db/schema-snapshot-217to224.sql
rename to engine/schema/resources/META-INF/db/schema-snapshot-217to224.sql
diff --git a/setup/db/db/schema-snapshot-223to224.sql b/engine/schema/resources/META-INF/db/schema-snapshot-223to224.sql
similarity index 100%
rename from setup/db/db/schema-snapshot-223to224.sql
rename to engine/schema/resources/META-INF/db/schema-snapshot-223to224.sql
diff --git a/engine/schema/src/com/cloud/upgrade/DatabaseUpgradeChecker.java b/engine/schema/src/com/cloud/upgrade/DatabaseUpgradeChecker.java
index fe211154065..b2d924d3cf5 100644
--- a/engine/schema/src/com/cloud/upgrade/DatabaseUpgradeChecker.java
+++ b/engine/schema/src/com/cloud/upgrade/DatabaseUpgradeChecker.java
@@ -85,10 +85,9 @@
 import org.apache.log4j.Logger;
 
 import javax.inject.Inject;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
 import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
 import java.sql.Connection;
 import java.sql.SQLException;
 import java.util.Arrays;
@@ -453,20 +452,17 @@ public DatabaseUpgradeChecker() {
         availableVersions = ImmutableList.copyOf(sortedVersions);
     }
 
-    protected void runScript(Connection conn, File file) {
+    protected void runScript(Connection conn, InputStream file) {
 
-        try (FileReader reader = new FileReader(file);) {
+        try (InputStreamReader reader = new InputStreamReader(file)) {
             ScriptRunner runner = new ScriptRunner(conn, false, true);
             runner.runScript(reader);
-        } catch (FileNotFoundException e) {
-            s_logger.error("Unable to find upgrade script: " + file.getAbsolutePath(), e);
-            throw new CloudRuntimeException("Unable to find upgrade script: " + file.getAbsolutePath(), e);
         } catch (IOException e) {
-            s_logger.error("Unable to read upgrade script: " + file.getAbsolutePath(), e);
-            throw new CloudRuntimeException("Unable to read upgrade script: " + file.getAbsolutePath(), e);
+            s_logger.error("Unable to read upgrade script", e);
+            throw new CloudRuntimeException("Unable to read upgrade script", e);
         } catch (SQLException e) {
-            s_logger.error("Unable to execute upgrade script: " + file.getAbsolutePath(), e);
-            throw new CloudRuntimeException("Unable to execute upgrade script: " + file.getAbsolutePath(), e);
+            s_logger.error("Unable to execute upgrade script", e);
+            throw new CloudRuntimeException("Unable to execute upgrade script", e);
         }
 
     }
@@ -555,9 +551,9 @@ protected void upgrade(CloudStackVersion dbVersion, CloudStackVersion currentVer
                     s_logger.error(errorMessage, e);
                     throw new CloudRuntimeException(errorMessage, e);
                 }
-                File[] scripts = upgrade.getPrepareScripts();
+                InputStream[] scripts = upgrade.getPrepareScripts();
                 if (scripts != null) {
-                    for (File script : scripts) {
+                    for (InputStream script : scripts) {
                         runScript(conn, script);
                     }
                 }
@@ -591,11 +587,11 @@ protected void upgrade(CloudStackVersion dbVersion, CloudStackVersion currentVer
                     throw new CloudRuntimeException("Unable to cleanup the database", e);
                 }
 
-                File[] scripts = upgrade.getCleanupScripts();
+                InputStream[] scripts = upgrade.getCleanupScripts();
                 if (scripts != null) {
-                    for (File script : scripts) {
+                    for (InputStream script : scripts) {
                         runScript(conn, script);
-                        s_logger.debug("Cleanup script " + script.getAbsolutePath() + " is executed successfully");
+                        s_logger.debug("Cleanup script " + upgrade.getClass().getSimpleName() + " is executed successfully");
                     }
                 }
                 txn.commit();
@@ -681,8 +677,8 @@ public boolean supportsRollingUpgrade() {
         }
 
         @Override
-        public File[] getPrepareScripts() {
-            return new File[0];
+        public InputStream[] getPrepareScripts() {
+            return new InputStream[0];
         }
 
         @Override
@@ -691,8 +687,8 @@ public void performDataMigration(Connection conn) {
         }
 
         @Override
-        public File[] getCleanupScripts() {
-            return new File[0];
+        public InputStream[] getCleanupScripts() {
+            return new InputStream[0];
         }
 
     }
diff --git a/engine/schema/src/com/cloud/upgrade/dao/DbUpgrade.java b/engine/schema/src/com/cloud/upgrade/dao/DbUpgrade.java
index 090cd143196..02c401c8155 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/DbUpgrade.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/DbUpgrade.java
@@ -16,7 +16,7 @@
 // under the License.
 package com.cloud.upgrade.dao;
 
-import java.io.File;
+import java.io.InputStream;
 import java.sql.Connection;
 
 public interface DbUpgrade {
@@ -30,16 +30,12 @@
      * @return the script to prepare the database schema for the
      * data migration step.
      */
-    File[] getPrepareScripts();
+    InputStream[] getPrepareScripts();
 
     /**
      * Performs the actual data migration.
      */
     void performDataMigration(Connection conn);
 
-    /**
-     *
-     * @return
-     */
-    File[] getCleanupScripts();
+    InputStream[] getCleanupScripts();
 }
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade217to218.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade217to218.java
index 28b5c15e018..2ca4e794fb8 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade217to218.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade217to218.java
@@ -16,27 +16,27 @@
 // under the License.
 package com.cloud.upgrade.dao;
 
-import java.io.File;
+import java.io.InputStream;
 import java.sql.Connection;
 
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
 
 public class Upgrade217to218 implements DbUpgrade {
 
     @Override
-    public File[] getPrepareScripts() {
-        String schemaFile = Script.findScript("", "db/schema-217to218.sql");
-        if (schemaFile == null) {
-            throw new CloudRuntimeException("Unable to find the upgrade script, schema-217to218.sql");
+    public InputStream[] getPrepareScripts() {
+        final String scriptFile = "META-INF/db/schema-217to218.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
+        if (script == null) {
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
-
-        String dataFile = Script.findScript("", "db/data-217to218.sql");
-        if (dataFile == null) {
-            throw new CloudRuntimeException("Unable to find the upgrade script, data-217to218.sql");
+        final String dataFile = "META-INF/db/data-217to218.sql";
+        final InputStream data = Thread.currentThread().getContextClassLoader().getResourceAsStream(dataFile);
+        if (data == null) {
+            throw new CloudRuntimeException("Unable to find " + dataFile);
         }
 
-        return new File[] {new File(schemaFile), new File(dataFile)};
+        return new InputStream[] {script, data};
     }
 
     @Override
@@ -45,7 +45,7 @@ public void performDataMigration(Connection conn) {
     }
 
     @Override
-    public File[] getCleanupScripts() {
+    public InputStream[] getCleanupScripts() {
         return null;
     }
 
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade218to22.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade218to22.java
index dd9ff5e39af..ef2a3178336 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade218to22.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade218to22.java
@@ -16,8 +16,8 @@
 // under the License.
 package com.cloud.upgrade.dao;
 
-import java.io.File;
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.StringReader;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
@@ -44,20 +44,20 @@
 import com.cloud.utils.NumbersUtil;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.net.NetUtils;
-import com.cloud.utils.script.Script;
 
 public class Upgrade218to22 implements DbUpgrade {
     final static Logger s_logger = Logger.getLogger(Upgrade218to22.class);
     boolean _basicZone;
 
     @Override
-    public File[] getPrepareScripts() {
-        String file = Script.findScript("", "db/schema-21to22.sql");
-        if (file == null) {
-            throw new CloudRuntimeException("Unable to find the upgrade script, schema-21to22.sql");
+    public InputStream[] getPrepareScripts() {
+        final String scriptFile = "META-INF/db/schema-21to22.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
+        if (script == null) {
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(file)};
+        return new InputStream[] {script};
     }
 
     protected void upgradeStoragePools(Connection conn) {
@@ -768,10 +768,6 @@ protected void upgradeDataCenter(Connection conn) {
         }
     }
 
-    /**
-     * @param conn
-     * @throws SQLException
-     */
     private void updateDatacenterWithServices(Connection conn) throws SQLException {
         try (PreparedStatement updateDataCenter =
             conn.prepareStatement("UPDATE data_center SET networktype=?, dns_provider=?, gateway_provider=?, firewall_provider=?, dhcp_provider=?, lb_provider=?, vpn_provider=?, userdata_provider=?");) {
@@ -812,11 +808,6 @@ private void updateBasicZoneDataCenterWithVnetAndGuestCidr(Connection conn) thro
         }
     }
 
-    /**
-     * @param conn
-     * @return
-     * @throws SQLException
-     */
     private ArrayList<Object[]> retrieveDataCenters(Connection conn) throws SQLException {
         PreparedStatement selectDcData = conn.prepareStatement("SELECT id, guest_network_cidr, domain FROM data_center");
         ResultSet dcData = selectDcData.executeQuery();
@@ -833,11 +824,6 @@ private void updateBasicZoneDataCenterWithVnetAndGuestCidr(Connection conn) thro
         return dcs;
     }
 
-    /**
-     * @return
-     * @throws SQLException
-     * @throws CloudRuntimeException
-     */
     private long retrieveNetworkOfferingId(Connection conn, String type) throws SQLException, CloudRuntimeException {
         long networkOfferingId;
         try (
@@ -855,14 +841,6 @@ private long retrieveNetworkOfferingId(Connection conn, String type) throws SQLE
         }
     }
 
-    /**
-     * @param conn
-     * @param managementNetworkOfferingId
-     * @param controlNetworkOfferingId
-     * @param storageNetworkOfferingId
-     * @param dc
-     * @throws SQLException
-     */
     private void updateBasicNetworkingDataCenter(Connection conn, long managementNetworkOfferingId, long controlNetworkOfferingId, long storageNetworkOfferingId, Object[] dc)
             throws SQLException {
         Long dcId = (Long)dc[0];
@@ -892,13 +870,6 @@ private void updateBasicNetworkingDataCenter(Connection conn, long managementNet
         updateConsoleProxies(conn, dcId, mgmtNetworkId, controlNetworkId, basicDefaultDirectNetworkId, "Basic");
     }
 
-    /**
-     * @param conn
-     * @param dcId
-     * @param controlNetworkId
-     * @param basicDefaultDirectNetworkId
-     * @throws SQLException
-     */
     private void retrieveAndUpdateDomainRouters(Connection conn, Long dcId, long controlNetworkId, long basicDefaultDirectNetworkId) throws SQLException {
         try (PreparedStatement selectVmInstanceData =
             conn.prepareStatement("SELECT vm_instance.id, vm_instance.domain_id, vm_instance.account_id, domain_router.gateway, domain_router.guest_ip_address, domain_router.domain, domain_router.dns1, domain_router.dns2, domain_router.vnet FROM vm_instance INNER JOIN domain_router ON vm_instance.id=domain_router.id WHERE vm_instance.removed IS NULL AND vm_instance.type='DomainRouter' AND vm_instance.data_center_id=?");) {
@@ -917,12 +888,6 @@ private void retrieveAndUpdateDomainRouters(Connection conn, Long dcId, long con
         }
     }
 
-    /**
-     * @param conn
-     * @param dcId
-     * @param networkId
-     * @throws SQLException
-     */
     private void updateVlanWithNetworkForDataCenter(Connection conn, Long dcId, long networkId) throws SQLException {
         try (PreparedStatement selectVlanId = conn.prepareStatement("SELECT id FROM vlan WHERE vlan_type='DirectAttached' AND data_center_id=?");) {
             selectVlanId.setLong(1, dcId);
@@ -936,16 +901,6 @@ private void updateVlanWithNetworkForDataCenter(Connection conn, Long dcId, long
         }
     }
 
-    /**
-     * @param conn
-     * @param managementNetworkOfferingId
-     * @param publicNetworkOfferingId
-     * @param controlNetworkOfferingId
-     * @param storageNetworkOfferingId
-     * @param dc
-     * @throws SQLException
-     * @throws CloudRuntimeException
-     */
     private void updateAdvancedNetworkingDataCenter(Connection conn, long managementNetworkOfferingId, long publicNetworkOfferingId, long controlNetworkOfferingId,
             long storageNetworkOfferingId, Object[] dc) throws SQLException, CloudRuntimeException {
         Long dcId = (Long)dc[0];
@@ -984,11 +939,6 @@ private void updateAdvancedNetworkingDataCenter(Connection conn, long management
         updateConsoleProxies(conn, dcId, mgmtNetworkId, controlNetworkId, publicNetworkId, "Advanced");
     }
 
-    /**
-     * @param dcId
-     * @return
-     * @throws SQLException
-     */
     private ArrayList<Object[]> retrieveRouters(Connection conn, Long dcId) throws SQLException {
         ArrayList<Object[]> routers = new ArrayList<Object[]>();
         try (PreparedStatement selectRouterData =
@@ -1012,28 +962,12 @@ private void updateAdvancedNetworkingDataCenter(Connection conn, long management
         return routers;
     }
 
-    /**
-     * @param conn
-     * @param dc
-     * @param dcId
-     * @param controlNetworkId
-     * @param publicNetworkId
-     * @param routers
-     * @throws SQLException
-     */
     private void updateRouters(Connection conn, Object[] dc, Long dcId, long controlNetworkId, long publicNetworkId, ArrayList<Object[]> routers) throws SQLException {
         for (Object[] router : routers) {
             updateRouter(conn, dc, dcId, controlNetworkId, publicNetworkId, router);
         }
     }
-    /**
-     * @param conn
-     * @param dcId
-     * @param controlNetworkId
-     * @param basicDefaultDirectNetworkId
-     * @param routers
-     * @throws SQLException
-     */
+
     private void updateRouters(Connection conn, Long dcId, long controlNetworkId, long basicDefaultDirectNetworkId, ArrayList<Object[]> routers) throws SQLException {
         for (Object[] router : routers) {
             s_logger.debug("Updating domR with network id in basic zone id=" + dcId);
@@ -1043,16 +977,6 @@ private void updateRouters(Connection conn, Long dcId, long controlNetworkId, lo
         }
     }
 
-
-    /**
-     * @param conn
-     * @param dc
-     * @param dcId
-     * @param controlNetworkId
-     * @param publicNetworkId
-     * @param router
-     * @throws SQLException
-     */
     private void updateRouter(Connection conn, Object[] dc, Long dcId, long controlNetworkId, long publicNetworkId, Object[] router) throws SQLException {
         String vnet = (String)router[7];
         String reservationId = null;
@@ -1077,11 +1001,6 @@ private void updateRouter(Connection conn, Object[] dc, Long dcId, long controlN
         upgradeDomR(conn, dcId, (Long)router[0], publicNetworkId, virtualNetworkId, controlNetworkId, "Advanced", vnet);
     }
 
-    /**
-     * @param router
-     * @param virtualNetworkId
-     * @throws SQLException
-     */
     private void updateNetworkForRouter(Connection conn, Object[] router, long virtualNetworkId) throws SQLException {
         try (PreparedStatement updateDomainRouter = conn.prepareStatement("UPDATE domain_router SET network_id = ? WHERE id = ? ");) {
             updateDomainRouter.setLong(1, virtualNetworkId);
@@ -1091,12 +1010,6 @@ private void updateNetworkForRouter(Connection conn, Object[] router, long virtu
         s_logger.debug("Network inserted for " + router[0] + " id = " + virtualNetworkId);
     }
 
-    /**
-     * @param conn
-     * @param dc
-     * @param dcId
-     * @throws SQLException
-     */
     private void createDirectNetworks(Connection conn, Object[] dc, Long dcId) throws SQLException {
         // Create direct networks
         try (PreparedStatement selectVlanData = conn.prepareStatement("SELECT id, vlan_id, vlan_gateway, vlan_netmask FROM vlan WHERE vlan_type='DirectAttached' AND data_center_id=?");) {
@@ -1122,17 +1035,6 @@ private void createDirectNetworks(Connection conn, Object[] dc, Long dcId) throw
         }
     }
 
-    /**
-     * @param conn
-     * @param dc
-     * @param dcId
-     * @param vlanNetworkMap
-     * @param vlanId
-     * @param tag
-     * @param gateway
-     * @param cidr
-     * @throws SQLException
-     */
     private void retrieveAccountDataAndCreateNetwork(Connection conn, Object[] dc, Long dcId, HashMap<String, Long> vlanNetworkMap, long vlanId, String tag, String gateway,
             String cidr) throws SQLException {
         Long accountId = 1L;
@@ -1156,12 +1058,6 @@ private void retrieveAccountDataAndCreateNetwork(Connection conn, Object[] dc, L
         }
     }
 
-    /**
-     * @param accountId
-     * @param domainId
-     * @return
-     * @throws SQLException
-     */
     private Long retrieveDomainId(Connection conn,Long accountId) throws SQLException {
         try (PreparedStatement pstmt = conn.prepareStatement("SELECT domain_id FROM account WHERE id=?");) {
             pstmt.setLong(1, accountId);
@@ -1175,11 +1071,6 @@ private Long retrieveDomainId(Connection conn,Long accountId) throws SQLExceptio
         }
     }
 
-    /**
-     * @param basicDefaultDirectNetworkId
-     * @param vlanId
-     * @throws SQLException
-     */
     private void updateVlanNetworkForTag(Connection conn, long basicDefaultDirectNetworkId, long vlanId) throws SQLException {
         try (PreparedStatement pstmt = conn.prepareStatement("UPDATE vlan SET network_id=? WHERE id=?");) {
             pstmt.setLong(1, basicDefaultDirectNetworkId);
@@ -1188,22 +1079,10 @@ private void updateVlanNetworkForTag(Connection conn, long basicDefaultDirectNet
         }
     }
 
-    /**
-     * @param vlanNetworkMap
-     * @param vlanId
-     * @param tag
-     * @throws SQLException
-     */
     private void updateNetworkInVlanTableforTag(Connection conn, HashMap<String, Long> vlanNetworkMap, long vlanId, String tag) throws SQLException {
         updateVlanNetworkForTag(conn, vlanId, vlanNetworkMap.get(tag));
     }
 
-    /**
-     * @param conn
-     * @param dcId
-     * @return
-     * @throws SQLException
-     */
     private ArrayList<Object[]> retrieveDhcpServers(Connection conn, Long dcId) throws SQLException {
         // Create DHCP domRs - Direct networks
         try (PreparedStatement pstmt =
@@ -1222,15 +1101,6 @@ private void updateNetworkInVlanTableforTag(Connection conn, HashMap<String, Lon
         }
     }
 
-    /**
-     * @param conn
-     * @param dcId
-     * @param controlNetworkId
-     * @param routerId
-     * @param directIp
-     * @throws SQLException
-     * @throws CloudRuntimeException
-     */
     private void updateDhcpServerData(Connection conn, Long dcId, long controlNetworkId, Long routerId, String directIp) throws SQLException, CloudRuntimeException {
         try (
                 PreparedStatement pstmt =
@@ -1257,13 +1127,6 @@ private void updateDhcpServerData(Connection conn, Long dcId, long controlNetwor
         }
     }
 
-    /**
-     * @param conn
-     * @param directNetworkId
-     * @return
-     * @throws SQLException
-     * @throws CloudRuntimeException
-     */
     private String retrieveGateway(Connection conn, Long directNetworkId) throws SQLException, CloudRuntimeException {
         try (PreparedStatement selectGateway = conn.prepareStatement("SELECT gateway from networks where id=?");) {
             selectGateway.setLong(1, directNetworkId);
@@ -1277,11 +1140,6 @@ private String retrieveGateway(Connection conn, Long directNetworkId) throws SQL
         }
     }
 
-    /**
-     * @param routerId
-     * @param directNetworkId
-     * @throws SQLException
-     */
     private void updateDomainRouter(Connection conn, Long routerId, Long directNetworkId) throws SQLException {
         try (PreparedStatement updateDomainRouter = conn.prepareStatement("UPDATE domain_router SET network_id = ? WHERE id = ? ");) {
             updateDomainRouter.setLong(1, directNetworkId);
@@ -1290,14 +1148,6 @@ private void updateDomainRouter(Connection conn, Long routerId, Long directNetwo
         }
     }
 
-    /**
-     * @param conn
-     * @param dcId
-     * @param mgmtNetworkId
-     * @param controlNetworkId
-     * @param publicNetworkId
-     * @throws SQLException
-     */
     private void updateConsoleProxies(Connection conn, Long dcId, long mgmtNetworkId, long controlNetworkId, long publicNetworkId, String networkingType) throws SQLException {
         // Upgrade ConsoleProxy
         try (PreparedStatement selectInstanceIds = conn.prepareStatement("SELECT vm_instance.id FROM vm_instance WHERE removed IS NULL AND type='ConsoleProxy' AND data_center_id=?");) {
@@ -2299,13 +2149,14 @@ public void performDataMigration(Connection conn) {
     }
 
     @Override
-    public File[] getCleanupScripts() {
-        String file = Script.findScript("", "db/schema-21to22-cleanup.sql");
-        if (file == null) {
-            throw new CloudRuntimeException("Unable to find the upgrade script, schema-21to22-cleanup.sql");
+    public InputStream[] getCleanupScripts() {
+        final String scriptFile = "META-INF/db/schema-21to22-cleanup.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
+        if (script == null) {
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(file)};
+        return new InputStream[] {script};
     }
 
     @Override
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade218to224DomainVlans.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade218to224DomainVlans.java
index dfdd11da659..5f66728e6d9 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade218to224DomainVlans.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade218to224DomainVlans.java
@@ -16,7 +16,7 @@
 // under the License.
 package com.cloud.upgrade.dao;
 
-import java.io.File;
+import java.io.InputStream;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
@@ -31,7 +31,7 @@
     final static Logger s_logger = Logger.getLogger(Upgrade218to224DomainVlans.class);
 
     @Override
-    public File[] getPrepareScripts() {
+    public InputStream[] getPrepareScripts() {
         return null;
     }
 
@@ -93,7 +93,7 @@ public void performDataMigration(Connection conn) {
     }
 
     @Override
-    public File[] getCleanupScripts() {
+    public InputStream[] getCleanupScripts() {
         return null;
     }
 
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade218to22Premium.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade218to22Premium.java
index 10ae5b0b33b..d21d1ce4e66 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade218to22Premium.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade218to22Premium.java
@@ -16,26 +16,23 @@
 // under the License.
 package com.cloud.upgrade.dao;
 
-import java.io.File;
+import java.io.InputStream;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
 
 public class Upgrade218to22Premium extends Upgrade218to22 {
     @Override
-    public File[] getPrepareScripts() {
-        File[] scripts = super.getPrepareScripts();
-        File[] newScripts = new File[2];
-        newScripts[0] = scripts[0];
-
-        String file = Script.findScript("", "db/schema-21to22-premium.sql");
-        if (file == null) {
-            throw new CloudRuntimeException("Unable to find the upgrade script, schema-21to22-premium.sql");
+    public InputStream[] getPrepareScripts() {
+        InputStream[] newScripts = new InputStream[2];
+        newScripts[0] = super.getPrepareScripts()[0];
+        final String scriptFile = "META-INF/db/schema-21to22-premium.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
+        if (script == null) {
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
-
-        newScripts[1] = new File(file);
+        newScripts[1] = script;
 
         return newScripts;
     }
@@ -47,15 +44,6 @@ public void performDataMigration(Connection conn) {
         updateUsageIpAddress(conn);
     }
 
-    @Override
-    public File[] getCleanupScripts() {
-        File[] scripts = super.getCleanupScripts();
-        File[] newScripts = new File[1];
-        // Change the array to 2 when you add in the scripts for premium.
-        newScripts[0] = scripts[0];
-        return newScripts;
-    }
-
     private void updateUserStats(Connection conn) {
         try ( // update device_id information
             PreparedStatement pstmt = conn.prepareStatement(
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade2210to2211.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade2210to2211.java
index 221a25fea7d..db145227080 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade2210to2211.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade2210to2211.java
@@ -16,16 +16,12 @@
 // under the License.
 package com.cloud.upgrade.dao;
 
-import java.io.File;
+import java.io.InputStream;
 import java.sql.Connection;
 
-import org.apache.log4j.Logger;
-
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
 
 public class Upgrade2210to2211 implements DbUpgrade {
-    final static Logger s_logger = Logger.getLogger(Upgrade2210to2211.class);
 
     @Override
     public String[] getUpgradableVersionRange() {
@@ -43,13 +39,14 @@ public boolean supportsRollingUpgrade() {
     }
 
     @Override
-    public File[] getPrepareScripts() {
-        String script = Script.findScript("", "db/schema-2210to2211.sql");
+    public InputStream[] getPrepareScripts() {
+        final String scriptFile = "META-INF/db/schema-2210to2211.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-2210to2211.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(script)};
+        return new InputStream[] {script};
     }
 
     @Override
@@ -57,7 +54,7 @@ public void performDataMigration(Connection conn) {
     }
 
     @Override
-    public File[] getCleanupScripts() {
+    public InputStream[] getCleanupScripts() {
         return null;
     }
 
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade2211to2212.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade2211to2212.java
index 4a2ba17a2ac..f8175386df5 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade2211to2212.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade2211to2212.java
@@ -16,7 +16,7 @@
 // under the License.
 package com.cloud.upgrade.dao;
 
-import java.io.File;
+import java.io.InputStream;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
@@ -27,7 +27,6 @@
 import org.apache.log4j.Logger;
 
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
 
 public class Upgrade2211to2212 implements DbUpgrade {
     final static Logger s_logger = Logger.getLogger(Upgrade2211to2212.class);
@@ -48,13 +47,14 @@ public boolean supportsRollingUpgrade() {
     }
 
     @Override
-    public File[] getPrepareScripts() {
-        String script = Script.findScript("", "db/schema-2211to2212.sql");
+    public InputStream[] getPrepareScripts() {
+        final String scriptFile = "META-INF/db/schema-2211to2212.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-2211to2212.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(script)};
+        return new InputStream[] {script};
     }
 
     @Override
@@ -63,7 +63,7 @@ public void performDataMigration(Connection conn) {
     }
 
     @Override
-    public File[] getCleanupScripts() {
+    public InputStream[] getCleanupScripts() {
         return null;
     }
 
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade2211to2212Premium.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade2211to2212Premium.java
index 117fa63d008..37448381136 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade2211to2212Premium.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade2211to2212Premium.java
@@ -16,40 +16,26 @@
 // under the License.
 package com.cloud.upgrade.dao;
 
-import java.io.File;
-import java.sql.Connection;
+import java.io.InputStream;
 
 import org.apache.log4j.Logger;
 
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
 
 public class Upgrade2211to2212Premium extends Upgrade2211to2212 {
     final static Logger s_logger = Logger.getLogger(Upgrade2211to2212Premium.class);
 
     @Override
-    public File[] getPrepareScripts() {
-        File[] scripts = super.getPrepareScripts();
-        File[] newScripts = new File[2];
-        newScripts[0] = scripts[0];
-
-        String file = Script.findScript("", "db/schema-2211to2212-premium.sql");
-        if (file == null) {
-            throw new CloudRuntimeException("Unable to find the upgrade script, schema-2211to2212-premium.sql");
+    public InputStream[] getPrepareScripts() {
+        InputStream[] newScripts = new InputStream[2];
+        newScripts[0] = super.getPrepareScripts()[0];
+        final String scriptFile = "META-INF/db/schema-2211to2212-premium.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
+        if (script == null) {
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
-
-        newScripts[1] = new File(file);
+        newScripts[1] = script;
 
         return newScripts;
     }
-
-    @Override
-    public void performDataMigration(Connection conn) {
-        super.performDataMigration(conn);
-    }
-
-    @Override
-    public File[] getCleanupScripts() {
-        return null;
-    }
 }
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade2212to2213.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade2212to2213.java
index df93519371a..7debe2ec378 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade2212to2213.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade2212to2213.java
@@ -16,7 +16,7 @@
 // under the License.
 package com.cloud.upgrade.dao;
 
-import java.io.File;
+import java.io.InputStream;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.SQLException;
@@ -27,7 +27,6 @@
 import org.apache.log4j.Logger;
 
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
 
 public class Upgrade2212to2213 implements DbUpgrade {
     final static Logger s_logger = Logger.getLogger(Upgrade2212to2213.class);
@@ -48,13 +47,14 @@ public boolean supportsRollingUpgrade() {
     }
 
     @Override
-    public File[] getPrepareScripts() {
-        String script = Script.findScript("", "db/schema-2212to2213.sql");
+    public InputStream[] getPrepareScripts() {
+        final String scriptFile = "META-INF/db/schema-2212to2213.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-2212to2213.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(script)};
+        return new InputStream[] {script};
     }
 
     @Override
@@ -63,7 +63,7 @@ public void performDataMigration(Connection conn) {
     }
 
     @Override
-    public File[] getCleanupScripts() {
+    public InputStream[] getCleanupScripts() {
         return null;
     }
 
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade2213to2214.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade2213to2214.java
index a8bf80c45a9..f155d6fe91d 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade2213to2214.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade2213to2214.java
@@ -16,7 +16,7 @@
 // under the License.
 package com.cloud.upgrade.dao;
 
-import java.io.File;
+import java.io.InputStream;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.SQLException;
@@ -26,7 +26,6 @@
 import org.apache.log4j.Logger;
 
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
 
 public class Upgrade2213to2214 implements DbUpgrade {
     final static Logger s_logger = Logger.getLogger(Upgrade2213to2214.class);
@@ -47,24 +46,23 @@ public boolean supportsRollingUpgrade() {
     }
 
     @Override
-    public File[] getPrepareScripts() {
-        String script = Script.findScript("", "db/schema-2213to2214.sql");
+    public InputStream[] getPrepareScripts() {
+        final String scriptFile = "META-INF/db/schema-2213to2214.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-2213to2214.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(script)};
+        return new InputStream[] {script};
     }
 
     @Override
     public void performDataMigration(Connection conn) {
         fixIndexes(conn);
-        //Remove certificate upgrade since RHIP is being retired
-        //upgradeCerts(conn);
     }
 
     @Override
-    public File[] getCleanupScripts() {
+    public InputStream[] getCleanupScripts() {
         return null;
     }
 
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade2214to30.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade2214to30.java
index 272d25990d6..7de60bff8d4 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade2214to30.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade2214to30.java
@@ -16,7 +16,7 @@
 // under the License.
 package com.cloud.upgrade.dao;
 
-import java.io.File;
+import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
@@ -36,7 +36,6 @@
 import com.cloud.utils.crypt.EncryptionSecretKeyChecker;
 import com.cloud.utils.db.TransactionLegacy;
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
 
 public class Upgrade2214to30 extends Upgrade30xBase implements DbUpgrade {
     final static Logger s_logger = Logger.getLogger(Upgrade2214to30.class);
@@ -57,13 +56,14 @@ public boolean supportsRollingUpgrade() {
     }
 
     @Override
-    public File[] getPrepareScripts() {
-        String script = Script.findScript("", "db/schema-2214to30.sql");
+    public InputStream[] getPrepareScripts() {
+        final String scriptFile = "META-INF/db/schema-2214to30.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-2214to30.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(script)};
+        return new InputStream[] {script};
     }
 
     @Override
@@ -102,13 +102,14 @@ public void performDataMigration(Connection conn) {
     }
 
     @Override
-    public File[] getCleanupScripts() {
-        String script = Script.findScript("", "db/schema-2214to30-cleanup.sql");
+    public InputStream[] getCleanupScripts() {
+        final String scriptFile = "META-INF/db/schema-2214to30-cleanup.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-2214to30-cleanup.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(script)};
+        return new InputStream[] {script};
     }
 
     private void setupPhysicalNetworks(Connection conn) {
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade221to222.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade221to222.java
index e8e78b6a6f7..41198adb14b 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade221to222.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade221to222.java
@@ -16,22 +16,22 @@
 // under the License.
 package com.cloud.upgrade.dao;
 
-import java.io.File;
+import java.io.InputStream;
 import java.sql.Connection;
 
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
 
 public class Upgrade221to222 implements DbUpgrade {
 
     @Override
-    public File[] getPrepareScripts() {
-        String file = Script.findScript("", "db/schema-221to222.sql");
-        if (file == null) {
-            throw new CloudRuntimeException("Unable to find the upgrade script, schema-221to222.sql");
+    public InputStream[] getPrepareScripts() {
+        final String scriptFile = "META-INF/db/schema-221to222.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
+        if (script == null) {
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(file)};
+        return new InputStream[] {script};
     }
 
     @Override
@@ -40,13 +40,14 @@ public void performDataMigration(Connection conn) {
     }
 
     @Override
-    public File[] getCleanupScripts() {
-        String file = Script.findScript("", "db/schema-221to222-cleanup.sql");
-        if (file == null) {
-            throw new CloudRuntimeException("Unable to find the upgrade script, schema-221to222-cleanup.sql");
+    public InputStream[] getCleanupScripts() {
+        final String scriptFile = "META-INF/db/schema-221to222-cleanup.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
+        if (script == null) {
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(file)};
+        return new InputStream[] {script};
     }
 
     @Override
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade221to222Premium.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade221to222Premium.java
index f1e15685399..c208ff2f065 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade221to222Premium.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade221to222Premium.java
@@ -16,45 +16,23 @@
 // under the License.
 package com.cloud.upgrade.dao;
 
-import java.io.File;
-import java.sql.Connection;
-
-import org.apache.log4j.Logger;
+import java.io.InputStream;
 
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
 
 public class Upgrade221to222Premium extends Upgrade221to222 {
-    final static Logger s_logger = Logger.getLogger(Upgrade221to222Premium.class);
 
     @Override
-    public File[] getPrepareScripts() {
-        File[] scripts = super.getPrepareScripts();
-        File[] newScripts = new File[2];
-        newScripts[0] = scripts[0];
-
-        String file = Script.findScript("", "db/schema-221to222-premium.sql");
-        if (file == null) {
-            throw new CloudRuntimeException("Unable to find the upgrade script, schema-221to222-premium.sql");
+    public InputStream[] getPrepareScripts() {
+        InputStream[] newScripts = new InputStream[2];
+        newScripts[0] = super.getPrepareScripts()[0];
+        final String scriptFile = "META-INF/db/schema-221to222-premium.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
+        if (script == null) {
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
+        newScripts[1] = script;
 
-        newScripts[1] = new File(file);
-
-        return newScripts;
-    }
-
-    @Override
-    public void performDataMigration(Connection conn) {
-        super.performDataMigration(conn);
-        // perform permium data migration here.
-    }
-
-    @Override
-    public File[] getCleanupScripts() {
-        File[] scripts = super.getCleanupScripts();
-        File[] newScripts = new File[1];
-        // Change the array to 2 when you add in the scripts for premium.
-        newScripts[0] = scripts[0];
         return newScripts;
     }
 }
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade222to224.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade222to224.java
index 458f7eebf41..94bc4c78528 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade222to224.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade222to224.java
@@ -16,7 +16,7 @@
 // under the License.
 package com.cloud.upgrade.dao;
 
-import java.io.File;
+import java.io.InputStream;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
@@ -29,7 +29,6 @@
 
 import com.cloud.capacity.Capacity;
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
 
 public class Upgrade222to224 implements DbUpgrade {
     final static Logger s_logger = Logger.getLogger(Upgrade222to224.class);
@@ -50,13 +49,14 @@ public boolean supportsRollingUpgrade() {
     }
 
     @Override
-    public File[] getPrepareScripts() {
-        String script = Script.findScript("", "db/schema-222to224.sql");
+    public InputStream[] getPrepareScripts() {
+        final String scriptFile = "META-INF/db/schema-222to224.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-222to224.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(script)};
+        return new InputStream[] {script};
     }
 
     private void fixRelatedFkeyOnNetworksTable(Connection conn) throws SQLException {
@@ -96,13 +96,14 @@ public void performDataMigration(Connection conn) {
     }
 
     @Override
-    public File[] getCleanupScripts() {
-        String file = Script.findScript("", "db/schema-222to224-cleanup.sql");
-        if (file == null) {
-            throw new CloudRuntimeException("Unable to find the upgrade script, schema-222to224-cleanup.sql");
+    public InputStream[] getCleanupScripts() {
+        final String scriptFile = "META-INF/db/schema-222to224-cleanup.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
+        if (script == null) {
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(file)};
+        return new InputStream[] {script};
     }
 
     private void checkForDuplicatePublicNetworks(Connection conn) {
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade222to224Premium.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade222to224Premium.java
index 775c140efdc..ac7bd120c3d 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade222to224Premium.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade222to224Premium.java
@@ -16,30 +16,27 @@
 // under the License.
 package com.cloud.upgrade.dao;
 
-import java.io.File;
+import java.io.InputStream;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 
 import org.apache.log4j.Logger;
 
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
 
 public class Upgrade222to224Premium extends Upgrade222to224 {
     final static Logger s_logger = Logger.getLogger(Upgrade222to224Premium.class);
 
     @Override
-    public File[] getPrepareScripts() {
-        File[] scripts = super.getPrepareScripts();
-        File[] newScripts = new File[2];
-        newScripts[0] = scripts[0];
-
-        String file = Script.findScript("", "db/schema-222to224-premium.sql");
-        if (file == null) {
-            throw new CloudRuntimeException("Unable to find the upgrade script, schema-222to224-premium.sql");
+    public InputStream[] getPrepareScripts() {
+        InputStream[] newScripts = new InputStream[2];
+        newScripts[0] = super.getPrepareScripts()[0];
+        final String scriptFile = "META-INF/db/schema-222to224-premium.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
+        if (script == null) {
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
-
-        newScripts[1] = new File(file);
+        newScripts[1] = script;
 
         return newScripts;
     }
@@ -50,15 +47,6 @@ public void performDataMigration(Connection conn) {
         updateUserStats(conn);
     }
 
-    @Override
-    public File[] getCleanupScripts() {
-        File[] scripts = super.getCleanupScripts();
-        File[] newScripts = new File[1];
-        // Change the array to 2 when you add in the scripts for premium.
-        newScripts[0] = scripts[0];
-        return newScripts;
-    }
-
     private void updateUserStats(Connection conn) {
         try (   // update network_id information
                 PreparedStatement pstmt = conn.prepareStatement(
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade224to225.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade224to225.java
index 7b06d7f6b2b..1e23377c012 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade224to225.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade224to225.java
@@ -16,7 +16,7 @@
 // under the License.
 package com.cloud.upgrade.dao;
 
-import java.io.File;
+import java.io.InputStream;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
@@ -28,19 +28,19 @@
 import org.apache.log4j.Logger;
 
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
 
 public class Upgrade224to225 implements DbUpgrade {
     final static Logger s_logger = Logger.getLogger(Upgrade224to225.class);
 
     @Override
-    public File[] getPrepareScripts() {
-        String file = Script.findScript("", "db/schema-224to225.sql");
-        if (file == null) {
-            throw new CloudRuntimeException("Unable to find the upgrade script, schema-224to225.sql");
+    public InputStream[] getPrepareScripts() {
+        final String scriptFile = "META-INF/db/schema-224to225.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
+        if (script == null) {
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(file)};
+        return new InputStream[] {script};
     }
 
     @Override
@@ -54,13 +54,14 @@ public void performDataMigration(Connection conn) {
     }
 
     @Override
-    public File[] getCleanupScripts() {
-        String file = Script.findScript("", "db/schema-224to225-cleanup.sql");
-        if (file == null) {
-            throw new CloudRuntimeException("Unable to find the cleanup script, schema-224to225-cleanup.sql");
+    public InputStream[] getCleanupScripts() {
+        final String scriptFile = "META-INF/db/schema-224to225-cleanup.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
+        if (script == null) {
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(file)};
+        return new InputStream[] {script};
     }
 
     @Override
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade225to226.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade225to226.java
index ed185623e64..f606d6e756f 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade225to226.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade225to226.java
@@ -16,7 +16,7 @@
 // under the License.
 package com.cloud.upgrade.dao;
 
-import java.io.File;
+import java.io.InputStream;
 import java.sql.Connection;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -25,19 +25,19 @@
 import org.apache.log4j.Logger;
 
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
 
 public class Upgrade225to226 implements DbUpgrade {
     final static Logger s_logger = Logger.getLogger(Upgrade225to226.class);
 
     @Override
-    public File[] getPrepareScripts() {
-        String file = Script.findScript("", "db/schema-225to226.sql");
-        if (file == null) {
-            throw new CloudRuntimeException("Unable to find the upgrade script, schema-225to226.sql");
+    public InputStream[] getPrepareScripts() {
+        final String scriptFile = "META-INF/db/schema-225to226.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
+        if (script == null) {
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(file)};
+        return new InputStream[] {script};
     }
 
     @Override
@@ -47,7 +47,7 @@ public void performDataMigration(Connection conn) {
     }
 
     @Override
-    public File[] getCleanupScripts() {
+    public InputStream[] getCleanupScripts() {
         return null;
     }
 
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade227to228.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade227to228.java
index fd75857aade..7d665718db4 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade227to228.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade227to228.java
@@ -16,7 +16,7 @@
 // under the License.
 package com.cloud.upgrade.dao;
 
-import java.io.File;
+import java.io.InputStream;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
@@ -26,7 +26,6 @@
 import org.apache.log4j.Logger;
 
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
 
 public class Upgrade227to228 implements DbUpgrade {
     final static Logger s_logger = Logger.getLogger(Upgrade227to228.class);
@@ -47,13 +46,14 @@ public boolean supportsRollingUpgrade() {
     }
 
     @Override
-    public File[] getPrepareScripts() {
-        String script = Script.findScript("", "db/schema-227to228.sql");
+    public InputStream[] getPrepareScripts() {
+        final String scriptFile = "META-INF/db/schema-227to228.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-227to228.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(script)};
+        return new InputStream[] {script};
     }
 
     @Override
@@ -88,7 +88,7 @@ public void performDataMigration(Connection conn) {
     }
 
     @Override
-    public File[] getCleanupScripts() {
+    public InputStream[] getCleanupScripts() {
         return null;
     }
 
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade227to228Premium.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade227to228Premium.java
index 5ed055125a8..032fb58da86 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade227to228Premium.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade227to228Premium.java
@@ -16,7 +16,7 @@
 // under the License.
 package com.cloud.upgrade.dao;
 
-import java.io.File;
+import java.io.InputStream;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
@@ -25,23 +25,20 @@
 import org.apache.log4j.Logger;
 
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
 
 public class Upgrade227to228Premium extends Upgrade227to228 {
     final static Logger s_logger = Logger.getLogger(Upgrade227to228Premium.class);
 
     @Override
-    public File[] getPrepareScripts() {
-        File[] scripts = super.getPrepareScripts();
-        File[] newScripts = new File[2];
-        newScripts[0] = scripts[0];
-
-        String file = Script.findScript("", "db/schema-227to228-premium.sql");
-        if (file == null) {
-            throw new CloudRuntimeException("Unable to find the upgrade script, schema-227to228-premium.sql");
+    public InputStream[] getPrepareScripts() {
+        InputStream[] newScripts = new InputStream[2];
+        newScripts[0] = super.getPrepareScripts()[0];
+        final String scriptFile = "META-INF/db/schema-227to228-premium.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
+        if (script == null) {
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
-
-        newScripts[1] = new File(file);
+        newScripts[1] = script;
 
         return newScripts;
     }
@@ -53,11 +50,6 @@ public void performDataMigration(Connection conn) {
         super.performDataMigration(conn);
     }
 
-    @Override
-    public File[] getCleanupScripts() {
-        return null;
-    }
-
     private void addSourceIdColumn(Connection conn) {
         boolean insertField = false;
         try {
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade228to229.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade228to229.java
index a7757c1981a..c556cd90089 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade228to229.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade228to229.java
@@ -16,7 +16,7 @@
 // under the License.
 package com.cloud.upgrade.dao;
 
-import java.io.File;
+import java.io.InputStream;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.SQLException;
@@ -27,7 +27,6 @@
 import org.apache.log4j.Logger;
 
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
 
 public class Upgrade228to229 implements DbUpgrade {
     final static Logger s_logger = Logger.getLogger(Upgrade228to229.class);
@@ -48,12 +47,14 @@ public boolean supportsRollingUpgrade() {
     }
 
     @Override
-    public File[] getPrepareScripts() {
-        String script = Script.findScript("", "db/schema-228to229.sql");
+    public InputStream[] getPrepareScripts() {
+        final String scriptFile = "META-INF/db/schema-228to229.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-228to229.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
-        return new File[] {new File(script)};
+
+        return new InputStream[] {script};
     }
 
     @Override
@@ -81,7 +82,7 @@ public void performDataMigration(Connection conn) {
     }
 
     @Override
-    public File[] getCleanupScripts() {
+    public InputStream[] getCleanupScripts() {
         return null;
     }
 
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade229to2210.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade229to2210.java
index dbeb31e6b45..1ad7e6d2b4c 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade229to2210.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade229to2210.java
@@ -16,7 +16,7 @@
 // under the License.
 package com.cloud.upgrade.dao;
 
-import java.io.File;
+import java.io.InputStream;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
@@ -26,7 +26,6 @@
 import org.apache.log4j.Logger;
 
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
 
 public class Upgrade229to2210 implements DbUpgrade {
     final static Logger s_logger = Logger.getLogger(Upgrade229to2210.class);
@@ -47,13 +46,14 @@ public boolean supportsRollingUpgrade() {
     }
 
     @Override
-    public File[] getPrepareScripts() {
-        String script = Script.findScript("", "db/schema-229to2210.sql");
+    public InputStream[] getPrepareScripts() {
+        final String scriptFile = "META-INF/db/schema-229to2210.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-229to2210.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(script)};
+        return new InputStream[] {script};
     }
 
     @Override
@@ -63,7 +63,7 @@ public void performDataMigration(Connection conn) {
     }
 
     @Override
-    public File[] getCleanupScripts() {
+    public InputStream[] getCleanupScripts() {
         return null;
     }
 
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade301to302.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade301to302.java
index 0e9b479c947..cafd025982a 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade301to302.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade301to302.java
@@ -17,7 +17,7 @@
 
 package com.cloud.upgrade.dao;
 
-import java.io.File;
+import java.io.InputStream;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
@@ -29,7 +29,6 @@
 import org.apache.log4j.Logger;
 
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
 
 public class Upgrade301to302 extends LegacyDbUpgrade {
     final static Logger s_logger = Logger.getLogger(Upgrade301to302.class);
@@ -50,13 +49,14 @@ public boolean supportsRollingUpgrade() {
     }
 
     @Override
-    public File[] getPrepareScripts() {
-        String script = Script.findScript("", "db/schema-301to302.sql");
+    public InputStream[] getPrepareScripts() {
+        final String scriptFile = "META-INF/db/schema-301to302.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-301to302.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(script)};
+        return new InputStream[] {script};
     }
 
     private void dropKeysIfExists(Connection conn) {
@@ -81,13 +81,14 @@ public void performDataMigration(Connection conn) {
     }
 
     @Override
-    public File[] getCleanupScripts() {
-        String script = Script.findScript("", "db/schema-301to302-cleanup.sql");
+    public InputStream[] getCleanupScripts() {
+        final String scriptFile = "META-INF/db/schema-301to302-cleanup.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-301to302-cleanup.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(script)};
+        return new InputStream[] {script};
     }
 
     protected void updateSharedNetworks(Connection conn) {
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade302to303.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade302to303.java
index abd0c347df3..e07c98dd448 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade302to303.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade302to303.java
@@ -20,7 +20,7 @@
 /**
  * @author Alena Prokharchyk
  */
-import java.io.File;
+import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
@@ -30,11 +30,9 @@
 
 import org.apache.log4j.Logger;
 
-//
 import com.cloud.dc.DataCenter.NetworkType;
 import com.cloud.utils.crypt.DBEncryptionUtil;
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
 
 public class Upgrade302to303 extends LegacyDbUpgrade {
     final static Logger s_logger = Logger.getLogger(Upgrade302to303.class);
@@ -55,13 +53,14 @@ public boolean supportsRollingUpgrade() {
     }
 
     @Override
-    public File[] getPrepareScripts() {
-        String script = Script.findScript("", "db/schema-302to303.sql");
+    public InputStream[] getPrepareScripts() {
+        final String scriptFile = "META-INF/db/schema-302to303.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-302to303.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(script)};
+        return new InputStream[] {script};
     }
 
     @Override
@@ -273,7 +272,7 @@ private void encryptConfig(Connection conn) {
     }
 
     @Override
-    public File[] getCleanupScripts() {
+    public InputStream[] getCleanupScripts() {
         return null;
     }
 }
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade302to40.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade302to40.java
index 829e99852ba..eb0492cd288 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade302to40.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade302to40.java
@@ -17,7 +17,7 @@
 
 package com.cloud.upgrade.dao;
 
-import java.io.File;
+import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
@@ -32,7 +32,6 @@
 import com.cloud.dc.DataCenter.NetworkType;
 import com.cloud.utils.crypt.DBEncryptionUtil;
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
 
 public class Upgrade302to40 extends Upgrade30xBase {
     final static Logger s_logger = Logger.getLogger(Upgrade302to40.class);
@@ -53,13 +52,14 @@ public boolean supportsRollingUpgrade() {
     }
 
     @Override
-    public File[] getPrepareScripts() {
-        String script = Script.findScript("", "db/schema-302to40.sql");
+    public InputStream[] getPrepareScripts() {
+        final String scriptFile = "META-INF/db/schema-302to40.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-302to40.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(script)};
+        return new InputStream[] {script};
     }
 
     @Override
@@ -78,13 +78,14 @@ public void performDataMigration(Connection conn) {
     }
 
     @Override
-    public File[] getCleanupScripts() {
-        String script = Script.findScript("", "db/schema-302to40-cleanup.sql");
+    public InputStream[] getCleanupScripts() {
+        final String scriptFile = "META-INF/db/schema-302to40-cleanup.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-302to40-cleanup.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(script)};
+        return new InputStream[] {script};
     }
 
     private void correctVRProviders(Connection conn) {
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade303to304.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade303to304.java
index 96793d45857..03f69ddefc9 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade303to304.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade303to304.java
@@ -17,7 +17,7 @@
 
 package com.cloud.upgrade.dao;
 
-import java.io.File;
+import java.io.InputStream;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
@@ -48,7 +48,7 @@ public boolean supportsRollingUpgrade() {
     }
 
     @Override
-    public File[] getPrepareScripts() {
+    public InputStream[] getPrepareScripts() {
         return null;
     }
 
@@ -389,7 +389,7 @@ private void cloneOfferingAndAddTag(Connection conn, long networkOfferingId, lon
     }
 
     @Override
-    public File[] getCleanupScripts() {
+    public InputStream[] getCleanupScripts() {
         return null;
     }
 }
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade304to305.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade304to305.java
index 3f1268845c0..dbb7187507f 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade304to305.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade304to305.java
@@ -17,7 +17,7 @@
 
 package com.cloud.upgrade.dao;
 
-import java.io.File;
+import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
@@ -31,7 +31,6 @@
 
 import com.cloud.utils.crypt.DBEncryptionUtil;
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
 
 public class Upgrade304to305 extends Upgrade30xBase {
     final static Logger s_logger = Logger.getLogger(Upgrade304to305.class);
@@ -52,13 +51,14 @@ public boolean supportsRollingUpgrade() {
     }
 
     @Override
-    public File[] getPrepareScripts() {
-        String script = Script.findScript("", "db/schema-304to305.sql");
+    public InputStream[] getPrepareScripts() {
+        final String scriptFile = "META-INF/db/schema-304to305.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-304to305.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(script)};
+        return new InputStream[] {script};
     }
 
     @Override
@@ -73,13 +73,14 @@ public void performDataMigration(Connection conn) {
     }
 
     @Override
-    public File[] getCleanupScripts() {
-        String script = Script.findScript("", "db/schema-304to305-cleanup.sql");
+    public InputStream[] getCleanupScripts() {
+        final String scriptFile = "META-INF/db/schema-304to305-cleanup.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-304to305-cleanup.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(script)};
+        return new InputStream[] {script};
     }
 
     private void updateSystemVms(Connection conn) {
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade305to306.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade305to306.java
index c31ce659a00..79e69e0ad54 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade305to306.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade305to306.java
@@ -18,6 +18,7 @@
 package com.cloud.upgrade.dao;
 
 import java.io.File;
+import java.io.InputStream;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
@@ -29,7 +30,6 @@
 import org.apache.log4j.Logger;
 
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
 
 public class Upgrade305to306 extends Upgrade30xBase {
     final static Logger s_logger = Logger.getLogger(Upgrade305to306.class);
@@ -50,13 +50,14 @@ public boolean supportsRollingUpgrade() {
     }
 
     @Override
-    public File[] getPrepareScripts() {
-        String script = Script.findScript("", "db/schema-305to306.sql");
+    public InputStream[] getPrepareScripts() {
+        final String scriptFile = "META-INF/db/schema-305to306.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-305to306.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(script)};
+        return new InputStream[] {script};
     }
 
     @Override
@@ -248,13 +249,14 @@ private void fix22xKVMSnapshots(Connection conn) {
     }
 
     @Override
-    public File[] getCleanupScripts() {
-        String script = Script.findScript("", "db/schema-305to306-cleanup.sql");
+    public InputStream[] getCleanupScripts() {
+        final String scriptFile = "META-INF/db/schema-305to306-cleanup.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-305to306-cleanup.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(script)};
+        return new InputStream[] {script};
     }
 
 }
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade306to307.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade306to307.java
index a911882fa69..4eb39af51d7 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade306to307.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade306to307.java
@@ -17,7 +17,7 @@
 
 package com.cloud.upgrade.dao;
 
-import java.io.File;
+import java.io.InputStream;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
@@ -26,7 +26,6 @@
 import org.apache.log4j.Logger;
 
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
 
 public class Upgrade306to307 extends Upgrade30xBase {
     final static Logger s_logger = Logger.getLogger(Upgrade306to307.class);
@@ -47,13 +46,14 @@ public boolean supportsRollingUpgrade() {
     }
 
     @Override
-    public File[] getPrepareScripts() {
-        String script = Script.findScript("", "db/schema-306to307.sql");
+    public InputStream[] getPrepareScripts() {
+        final String scriptFile = "META-INF/db/schema-306to307.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-306to307.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(script)};
+        return new InputStream[] {script};
     }
 
     @Override
@@ -62,8 +62,7 @@ public void performDataMigration(Connection conn) {
     }
 
     @Override
-    public File[] getCleanupScripts() {
-
+    public InputStream[] getCleanupScripts() {
         return null;
     }
 
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade307to410.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade307to410.java
index 4319481fe93..1554ff04f70 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade307to410.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade307to410.java
@@ -17,7 +17,7 @@
 
 package com.cloud.upgrade.dao;
 
-import java.io.File;
+import java.io.InputStream;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.SQLException;
@@ -27,7 +27,6 @@
 
 import com.cloud.utils.db.DbProperties;
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
 
 public class Upgrade307to410 implements DbUpgrade {
     final static Logger s_logger = Logger.getLogger(Upgrade307to410.class);
@@ -48,13 +47,14 @@ public boolean supportsRollingUpgrade() {
     }
 
     @Override
-    public File[] getPrepareScripts() {
-        String script = Script.findScript("", "db/schema-307to410.sql");
+    public InputStream[] getPrepareScripts() {
+        final String scriptFile = "META-INF/db/schema-307to410.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-307to410.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(script)};
+        return new InputStream[] {script};
     }
 
     @Override
@@ -81,12 +81,13 @@ private void updateRegionEntries(Connection conn) {
     }
 
     @Override
-    public File[] getCleanupScripts() {
-        String script = Script.findScript("", "db/schema-307to410-cleanup.sql");
+    public InputStream[] getCleanupScripts() {
+        final String scriptFile = "META-INF/db/schema-307to410-cleanup.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-307to410-cleanup.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(script)};
+        return new InputStream[] {script};
     }
 }
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade30to301.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade30to301.java
index fafec269c51..806cabb12eb 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade30to301.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade30to301.java
@@ -16,7 +16,7 @@
 // under the License.
 package com.cloud.upgrade.dao;
 
-import java.io.File;
+import java.io.InputStream;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
@@ -26,7 +26,6 @@
 
 import com.cloud.configuration.Resource.ResourceType;
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
 
 public class Upgrade30to301 extends LegacyDbUpgrade {
     final static Logger s_logger = Logger.getLogger(Upgrade30to301.class);
@@ -47,13 +46,14 @@ public boolean supportsRollingUpgrade() {
     }
 
     @Override
-    public File[] getPrepareScripts() {
-        String script = Script.findScript("", "db/schema-30to301.sql");
+    public InputStream[] getPrepareScripts() {
+        final String scriptFile = "META-INF/db/schema-30to301.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-30to301.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(script)};
+        return new InputStream[] {script};
     }
 
     @Override
@@ -65,7 +65,7 @@ public void performDataMigration(Connection conn) {
     }
 
     @Override
-    public File[] getCleanupScripts() {
+    public InputStream[] getCleanupScripts() {
         return null;
     }
 
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade40to41.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade40to41.java
index ab683fcb4f3..5864e2410d0 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade40to41.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade40to41.java
@@ -17,7 +17,7 @@
 
 package com.cloud.upgrade.dao;
 
-import java.io.File;
+import java.io.InputStream;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
@@ -29,7 +29,6 @@
 
 import com.cloud.utils.db.DbProperties;
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
 
 public class Upgrade40to41 implements DbUpgrade {
     final static Logger s_logger = Logger.getLogger(Upgrade40to41.class);
@@ -50,13 +49,14 @@ public boolean supportsRollingUpgrade() {
     }
 
     @Override
-    public File[] getPrepareScripts() {
-        String script = Script.findScript("", "db/schema-40to410.sql");
+    public InputStream[] getPrepareScripts() {
+        final String scriptFile = "META-INF/db/schema-40to410.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-40to410.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(script)};
+        return new InputStream[] {script};
     }
 
     @Override
@@ -66,13 +66,14 @@ public void performDataMigration(Connection conn) {
     }
 
     @Override
-    public File[] getCleanupScripts() {
-        String script = Script.findScript("", "db/schema-40to410-cleanup.sql");
+    public InputStream[] getCleanupScripts() {
+        final String scriptFile = "META-INF/db/schema-40to410-cleanup.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-40to410-cleanup.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(script)};
+        return new InputStream[] {script};
     }
 
     private void updateRegionEntries(Connection conn) {
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade41000to41100.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade41000to41100.java
index 0189ce8c627..c59ead9d01f 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade41000to41100.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade41000to41100.java
@@ -18,14 +18,11 @@
 package com.cloud.upgrade.dao;
 
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
-import org.apache.log4j.Logger;
 
-import java.io.File;
+import java.io.InputStream;
 import java.sql.Connection;
 
 public class Upgrade41000to41100 implements DbUpgrade {
-    final static Logger LOG = Logger.getLogger(Upgrade41000to41100.class);
 
     @Override
     public String[] getUpgradableVersionRange() {
@@ -43,12 +40,14 @@ public boolean supportsRollingUpgrade() {
     }
 
     @Override
-    public File[] getPrepareScripts() {
-        String script = Script.findScript("", "db/schema-41000to41100.sql");
+    public InputStream[] getPrepareScripts() {
+        final String scriptFile = "META-INF/db/schema-41000to41100.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-41000to41100.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
-        return new File[] {new File(script)};
+
+        return new InputStream[] {script};
     }
 
     @Override
@@ -56,11 +55,13 @@ public void performDataMigration(Connection conn) {
     }
 
     @Override
-    public File[] getCleanupScripts() {
-        String script = Script.findScript("", "db/schema-41000to41100-cleanup.sql");
+    public InputStream[] getCleanupScripts() {
+        final String scriptFile = "META-INF/db/schema-41000to41100-cleanup.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-41000to41100-cleanup.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
-        return new File[] {new File(script)};
+
+        return new InputStream[] {script};
     }
 }
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
index 7fa2e0cd9e6..9551a504192 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
@@ -18,6 +18,7 @@
 package com.cloud.upgrade.dao;
 
 import java.io.File;
+import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
 import java.sql.Connection;
 import java.sql.Date;
@@ -42,7 +43,6 @@
 import com.cloud.utils.Pair;
 import com.cloud.utils.crypt.DBEncryptionUtil;
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
 
 public class Upgrade410to420 implements DbUpgrade {
     final static Logger s_logger = Logger.getLogger(Upgrade410to420.class);
@@ -63,13 +63,14 @@ public boolean supportsRollingUpgrade() {
     }
 
     @Override
-    public File[] getPrepareScripts() {
-        String script = Script.findScript("", "db/schema-410to420.sql");
+    public InputStream[] getPrepareScripts() {
+        final String scriptFile = "META-INF/db/schema-410to420.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-410to420.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(script)};
+        return new InputStream[] {script};
     }
 
     @Override
@@ -607,13 +608,14 @@ private void updateOverCommitRatioClusterDetails(Connection conn) {
     }
 
     @Override
-    public File[] getCleanupScripts() {
-        String script = Script.findScript("", "db/schema-410to420-cleanup.sql");
+    public InputStream[] getCleanupScripts() {
+        final String scriptFile = "META-INF/db/schema-410to420-cleanup.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-410to420-cleanup.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(script)};
+        return new InputStream[] {script};
     }
 
     private String getNewLabel(ResultSet rs, String oldParamValue) {
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade420to421.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade420to421.java
index d8d0b32bd06..d7ba2ed20da 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade420to421.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade420to421.java
@@ -17,7 +17,7 @@
 
 package com.cloud.upgrade.dao;
 
-import java.io.File;
+import java.io.InputStream;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
@@ -27,7 +27,6 @@
 
 import com.cloud.hypervisor.Hypervisor;
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
 
 public class Upgrade420to421 implements DbUpgrade {
     final static Logger s_logger = Logger.getLogger(Upgrade420to421.class);
@@ -48,17 +47,18 @@ public boolean supportsRollingUpgrade() {
     }
 
     @Override
-    public File[] getPrepareScripts() {
-        String script = Script.findScript("", "db/schema-420to421.sql");
+    public InputStream[] getPrepareScripts() {
+        final String scriptFile = "META-INF/db/schema-420to421.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-420to421.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(script)};
+        return new InputStream[] {script};
     }
 
     @Override
-    public File[] getCleanupScripts() {
+    public InputStream[] getCleanupScripts() {
         return null;
     }
 
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade421to430.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade421to430.java
index e8123640225..cc4dda210ff 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade421to430.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade421to430.java
@@ -17,7 +17,7 @@
 
 package com.cloud.upgrade.dao;
 
-import java.io.File;
+import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
@@ -30,7 +30,6 @@
 
 import com.cloud.utils.crypt.DBEncryptionUtil;
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
 
 public class Upgrade421to430 implements DbUpgrade {
     final static Logger s_logger = Logger.getLogger(Upgrade421to430.class);
@@ -51,13 +50,14 @@ public boolean supportsRollingUpgrade() {
     }
 
     @Override
-    public File[] getPrepareScripts() {
-        String script = Script.findScript("", "db/schema-421to430.sql");
+    public InputStream[] getPrepareScripts() {
+        final String scriptFile = "META-INF/db/schema-421to430.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-421to430.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(script)};
+        return new InputStream[] {script};
     }
 
     @Override
@@ -193,13 +193,14 @@ private void encryptImageStoreDetails(Connection conn) {
     }
 
     @Override
-    public File[] getCleanupScripts() {
-        String script = Script.findScript("", "db/schema-421to430-cleanup.sql");
+    public InputStream[] getCleanupScripts() {
+        final String scriptFile = "META-INF/db/schema-421to430-cleanup.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-421to430-cleanup.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(script)};
+        return new InputStream[] {script};
     }
 
 }
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade430to440.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade430to440.java
index 51494e7aff6..77070ae8f49 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade430to440.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade430to440.java
@@ -17,7 +17,7 @@
 
 package com.cloud.upgrade.dao;
 
-import java.io.File;
+import java.io.InputStream;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
@@ -28,7 +28,6 @@
 import com.cloud.network.Network;
 import com.cloud.network.Networks.BroadcastDomainType;
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
 
 public class Upgrade430to440 implements DbUpgrade {
     final static Logger s_logger = Logger.getLogger(Upgrade430to440.class);
@@ -49,13 +48,14 @@ public boolean supportsRollingUpgrade() {
     }
 
     @Override
-    public File[] getPrepareScripts() {
-        String script = Script.findScript("", "db/schema-430to440.sql");
+    public InputStream[] getPrepareScripts() {
+        final String scriptFile = "META-INF/db/schema-430to440.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-4310to440.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(script)};
+        return new InputStream[] {script};
     }
 
     @Override
@@ -228,12 +228,13 @@ private void updateVlanUris(Connection conn) {
     }
 
     @Override
-    public File[] getCleanupScripts() {
-        String script = Script.findScript("", "db/schema-430to440-cleanup.sql");
+    public InputStream[] getCleanupScripts() {
+        final String scriptFile = "META-INF/db/schema-430to440-cleanup.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-430to440-cleanup.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(script)};
+        return new InputStream[] {script};
     }
 }
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade440to441.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade440to441.java
index 497da8d08d8..a51f464a797 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade440to441.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade440to441.java
@@ -17,16 +17,12 @@
 
 package com.cloud.upgrade.dao;
 
-import java.io.File;
+import java.io.InputStream;
 import java.sql.Connection;
 
-import org.apache.log4j.Logger;
-
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
 
 public class Upgrade440to441 implements DbUpgrade {
-    final static Logger s_logger = Logger.getLogger(Upgrade440to441.class);
 
     @Override
     public String[] getUpgradableVersionRange() {
@@ -44,13 +40,14 @@ public boolean supportsRollingUpgrade() {
     }
 
     @Override
-    public File[] getPrepareScripts() {
-        String script = Script.findScript("", "db/schema-440to441.sql");
+    public InputStream[] getPrepareScripts() {
+        final String scriptFile = "META-INF/db/schema-440to441.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-440to441.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(script)};
+        return new InputStream[] {script};
     }
 
     @Override
@@ -58,12 +55,13 @@ public void performDataMigration(Connection conn) {
     }
 
     @Override
-    public File[] getCleanupScripts() {
-        String script = Script.findScript("", "db/schema-440to441-cleanup.sql");
+    public InputStream[] getCleanupScripts() {
+        final String scriptFile = "META-INF/db/schema-440to441-cleanup.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-440to441-cleanup.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(script)};
+        return new InputStream[] {script};
     }
 }
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade441to442.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade441to442.java
index bd50dfb0a30..4234428f72b 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade441to442.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade441to442.java
@@ -17,16 +17,13 @@
 
 package com.cloud.upgrade.dao;
 
-import java.io.File;
+import java.io.InputStream;
 import java.sql.Connection;
 
-import org.apache.log4j.Logger;
 
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
 
 public class Upgrade441to442 implements DbUpgrade {
-    final static Logger s_logger = Logger.getLogger(Upgrade441to442.class);
 
     @Override
     public String[] getUpgradableVersionRange() {
@@ -44,13 +41,14 @@ public boolean supportsRollingUpgrade() {
     }
 
     @Override
-    public File[] getPrepareScripts() {
-        String script = Script.findScript("", "db/schema-441to442.sql");
+    public InputStream[] getPrepareScripts() {
+        final String scriptFile = "META-INF/db/schema-441to442.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-441to442.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(script)};
+        return new InputStream[] {script};
     }
 
     @Override
@@ -58,7 +56,7 @@ public void performDataMigration(Connection conn) {
     }
 
     @Override
-    public File[] getCleanupScripts() {
+    public InputStream[] getCleanupScripts() {
         return null;
     }
 }
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade442to450.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade442to450.java
index a9fb08905be..54e8da5f6e9 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade442to450.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade442to450.java
@@ -17,7 +17,7 @@
 
 package com.cloud.upgrade.dao;
 
-import java.io.File;
+import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
@@ -32,7 +32,6 @@
 
 import com.cloud.utils.crypt.DBEncryptionUtil;
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
 
 public class Upgrade442to450 implements DbUpgrade {
     final static Logger s_logger = Logger.getLogger(Upgrade442to450.class);
@@ -53,13 +52,14 @@ public boolean supportsRollingUpgrade() {
     }
 
     @Override
-    public File[] getPrepareScripts() {
-        String script = Script.findScript("", "db/schema-442to450.sql");
+    public InputStream[] getPrepareScripts() {
+        final String scriptFile = "META-INF/db/schema-442to450.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-442to450.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(script)};
+        return new InputStream[] {script};
     }
 
     @Override
@@ -138,13 +138,14 @@ private void upgradeMemoryOfInternalLoadBalancervmOffering(Connection conn) {
     }
 
     @Override
-    public File[] getCleanupScripts() {
-        String script = Script.findScript("", "db/schema-442to450-cleanup.sql");
+    public InputStream[] getCleanupScripts() {
+        final String scriptFile = "META-INF/db/schema-442to450-cleanup.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-442to450-cleanup.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(script)};
+        return new InputStream[] {script};
     }
 
     private void dropInvalidKeyFromStoragePoolTable(Connection conn) {
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade443to444.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade443to444.java
index ded67d6495f..b8110546a13 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade443to444.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade443to444.java
@@ -17,16 +17,12 @@
 
 package com.cloud.upgrade.dao;
 
-import java.io.File;
+import java.io.InputStream;
 import java.sql.Connection;
 
-import org.apache.log4j.Logger;
-
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
 
 public class Upgrade443to444 implements DbUpgrade {
-    final static Logger s_logger = Logger.getLogger(Upgrade443to444.class);
 
     @Override
     public String[] getUpgradableVersionRange() {
@@ -44,13 +40,14 @@ public boolean supportsRollingUpgrade() {
     }
 
     @Override
-    public File[] getPrepareScripts() {
-        String script = Script.findScript("", "db/schema-443to444.sql");
+    public InputStream[] getPrepareScripts() {
+        final String scriptFile = "META-INF/db/schema-443to444.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-empty.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(script)};
+        return new InputStream[] {script};
     }
 
     @Override
@@ -58,7 +55,7 @@ public void performDataMigration(Connection conn) {
     }
 
     @Override
-    public File[] getCleanupScripts() {
+    public InputStream[] getCleanupScripts() {
         return null;
     }
 }
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade443to450.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade443to450.java
index 983494894b9..80b2c14e00c 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade443to450.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade443to450.java
@@ -17,12 +17,8 @@
 
 package com.cloud.upgrade.dao;
 
-import org.apache.log4j.Logger;
-
 public class Upgrade443to450 extends Upgrade442to450 implements DbUpgrade {
 
-    final static Logger s_logger = Logger.getLogger(Upgrade443to450.class);
-
     @Override
     public String[] getUpgradableVersionRange() {
         return new String[] {"4.4.3", "4.5.0"};
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade444to450.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade444to450.java
index d872e528bff..52fc7299810 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade444to450.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade444to450.java
@@ -17,12 +17,8 @@
 
 package com.cloud.upgrade.dao;
 
-import org.apache.log4j.Logger;
-
 public class Upgrade444to450 extends Upgrade442to450 implements DbUpgrade {
 
-    final static Logger s_logger = Logger.getLogger(Upgrade444to450.class);
-
     @Override
     public String[] getUpgradableVersionRange() {
         return new String[] {"4.4.4", "4.5.0"};
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade450to451.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade450to451.java
index b49939fc7c7..71476e7dd63 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade450to451.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade450to451.java
@@ -17,7 +17,7 @@
 
 package com.cloud.upgrade.dao;
 
-import java.io.File;
+import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
@@ -31,7 +31,6 @@
 
 import com.cloud.utils.crypt.DBEncryptionUtil;
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
 
 public class Upgrade450to451 implements DbUpgrade {
         final static Logger s_logger = Logger.getLogger(Upgrade450to451.class);
@@ -52,22 +51,25 @@ public boolean supportsRollingUpgrade() {
     }
 
     @Override
-    public File[] getPrepareScripts() {
-        String script = Script.findScript("", "db/schema-450to451.sql");
+    public InputStream[] getPrepareScripts() {
+        final String scriptFile = "META-INF/db/schema-450to451.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-450to451.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
-        return new File[] {new File(script)};
+
+        return new InputStream[] {script};
     }
 
     @Override
-    public File[] getCleanupScripts() {
-        String script = Script.findScript("", "db/schema-450to451-cleanup.sql");
+    public InputStream[] getCleanupScripts() {
+        final String scriptFile = "META-INF/db/schema-450to451-cleanup.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-450to451-cleanup.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(script)};
+        return new InputStream[] {script};
     }
 
     @Override
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade451to452.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade451to452.java
index 870e534fb7f..788b6f28ef1 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade451to452.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade451to452.java
@@ -18,14 +18,11 @@
 package com.cloud.upgrade.dao;
 
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
-import org.apache.log4j.Logger;
 
-import java.io.File;
+import java.io.InputStream;
 import java.sql.Connection;
 
 public class Upgrade451to452 implements DbUpgrade {
-    final static Logger s_logger = Logger.getLogger(Upgrade451to452.class);
 
     @Override
     public String[] getUpgradableVersionRange() {
@@ -43,12 +40,14 @@ public boolean supportsRollingUpgrade() {
     }
 
     @Override
-    public File[] getPrepareScripts() {
-        String script = Script.findScript("", "db/schema-451to452.sql");
+    public InputStream[] getPrepareScripts() {
+        final String scriptFile = "META-INF/db/schema-451to452.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-451to452.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
-        return new File[] {new File(script)};
+
+        return new InputStream[] {script};
     }
 
     @Override
@@ -56,12 +55,13 @@ public void performDataMigration(Connection conn) {
     }
 
     @Override
-    public File[] getCleanupScripts() {
-        String script = Script.findScript("", "db/schema-451to452-cleanup.sql");
+    public InputStream[] getCleanupScripts() {
+        final String scriptFile = "META-INF/db/schema-451to452-cleanup.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-451to452-cleanup.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(script)};
+        return new InputStream[] {script};
     }
 }
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade452to453.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade452to453.java
index d1c4661607e..3bc39ebc68f 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade452to453.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade452to453.java
@@ -18,14 +18,11 @@
 package com.cloud.upgrade.dao;
 
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
-import org.apache.log4j.Logger;
 
-import java.io.File;
+import java.io.InputStream;
 import java.sql.Connection;
 
 public class Upgrade452to453 implements DbUpgrade {
-    final static Logger s_logger = Logger.getLogger(Upgrade452to453.class);
 
     @Override
     public String[] getUpgradableVersionRange() {
@@ -43,12 +40,14 @@ public boolean supportsRollingUpgrade() {
     }
 
     @Override
-    public File[] getPrepareScripts() {
-        String script = Script.findScript("", "db/schema-452to453.sql");
+    public InputStream[] getPrepareScripts() {
+        final String scriptFile = "META-INF/db/schema-452to453.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-452to453.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
-        return new File[] {new File(script)};
+
+        return new InputStream[] {script};
     }
 
     @Override
@@ -56,12 +55,13 @@ public void performDataMigration(Connection conn) {
     }
 
     @Override
-    public File[] getCleanupScripts() {
-        String script = Script.findScript("", "db/schema-452to453-cleanup.sql");
+    public InputStream[] getCleanupScripts() {
+        final String scriptFile = "META-INF/db/schema-452to453-cleanup.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-452to453-cleanup.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(script)};
+        return new InputStream[] {script};
     }
 }
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade452to460.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade452to460.java
index f6999776797..91fe345f4a1 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade452to460.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade452to460.java
@@ -17,7 +17,7 @@
 
 package com.cloud.upgrade.dao;
 
-import java.io.File;
+import java.io.InputStream;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
@@ -28,7 +28,6 @@
 import org.apache.log4j.Logger;
 
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
 
 public class Upgrade452to460 implements DbUpgrade {
     final static Logger s_logger = Logger.getLogger(Upgrade452to460.class);
@@ -49,13 +48,14 @@ public boolean supportsRollingUpgrade() {
     }
 
     @Override
-    public File[] getPrepareScripts() {
-        final String script = Script.findScript("", "db/schema-452to460.sql");
+    public InputStream[] getPrepareScripts() {
+        final String scriptFile = "META-INF/db/schema-452to460.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-452to460.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] { new File(script) };
+        return new InputStream[] {script};
     }
 
     @Override
@@ -156,12 +156,13 @@ private void addIndexForVMInstance(final Connection conn) {
     }
 
     @Override
-    public File[] getCleanupScripts() {
-        final String script = Script.findScript("", "db/schema-452to460-cleanup.sql");
+    public InputStream[] getCleanupScripts() {
+        final String scriptFile = "META-INF/db/schema-452to460-cleanup.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-452to460-cleanup.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] { new File(script) };
+        return new InputStream[] {script};
     }
 }
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade453to460.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade453to460.java
index 504cc7336c2..2dd4b0aad27 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade453to460.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade453to460.java
@@ -17,10 +17,7 @@
 
 package com.cloud.upgrade.dao;
 
-import org.apache.log4j.Logger;
-
 public class Upgrade453to460 extends Upgrade452to460 implements DbUpgrade {
-    final static Logger s_logger = Logger.getLogger(Upgrade453to460.class);
 
     @Override
     public String[] getUpgradableVersionRange() {
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade460to461.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade460to461.java
index 9011c2ed10d..88bda4616c8 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade460to461.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade460to461.java
@@ -18,14 +18,11 @@
 package com.cloud.upgrade.dao;
 
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
-import org.apache.log4j.Logger;
 
-import java.io.File;
+import java.io.InputStream;
 import java.sql.Connection;
 
 public class Upgrade460to461 implements DbUpgrade {
-    final static Logger s_logger = Logger.getLogger(Upgrade460to461.class);
 
     @Override
     public String[] getUpgradableVersionRange() {
@@ -43,12 +40,14 @@ public boolean supportsRollingUpgrade() {
     }
 
     @Override
-    public File[] getPrepareScripts() {
-        String script = Script.findScript("", "db/schema-460to461.sql");
+    public InputStream[] getPrepareScripts() {
+        final String scriptFile = "META-INF/db/schema-460to461.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-460to461.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
-        return new File[] {new File(script)};
+
+        return new InputStream[] {script};
     }
 
     @Override
@@ -56,12 +55,13 @@ public void performDataMigration(Connection conn) {
     }
 
     @Override
-    public File[] getCleanupScripts() {
-        String script = Script.findScript("", "db/schema-460to461-cleanup.sql");
+    public InputStream[] getCleanupScripts() {
+        final String scriptFile = "META-INF/db/schema-460to461-cleanup.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-460to461-cleanup.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(script)};
+        return new InputStream[] {script};
     }
 }
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade461to470.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade461to470.java
index 8dbbdb2e9ec..e7922cebf0a 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade461to470.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade461to470.java
@@ -18,10 +18,9 @@
 package com.cloud.upgrade.dao;
 
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
 import org.apache.log4j.Logger;
 
-import java.io.File;
+import java.io.InputStream;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.SQLException;
@@ -45,12 +44,14 @@ public boolean supportsRollingUpgrade() {
     }
 
     @Override
-    public File[] getPrepareScripts() {
-        String script = Script.findScript("", "db/schema-461to470.sql");
+    public InputStream[] getPrepareScripts() {
+        final String scriptFile = "META-INF/db/schema-461to470.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-461to470.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
-        return new File[] {new File(script)};
+
+        return new InputStream[] {script};
     }
 
     public void alterAddColumnToCloudUsage(final Connection conn) {
@@ -73,12 +74,13 @@ public void performDataMigration(Connection conn) {
     }
 
     @Override
-    public File[] getCleanupScripts() {
-        String script = Script.findScript("", "db/schema-461to470-cleanup.sql");
+    public InputStream[] getCleanupScripts() {
+        final String scriptFile = "META-INF/db/schema-461to470-cleanup.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-461to470-cleanup.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(script)};
+        return new InputStream[] {script};
     }
 }
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade470to471.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade470to471.java
index d2a2e202a41..08cdfdd53f5 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade470to471.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade470to471.java
@@ -18,14 +18,11 @@
 package com.cloud.upgrade.dao;
 
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
-import org.apache.log4j.Logger;
 
-import java.io.File;
+import java.io.InputStream;
 import java.sql.Connection;
 
 public class Upgrade470to471 implements DbUpgrade {
-    final static Logger s_logger = Logger.getLogger(Upgrade470to471.class);
 
     @Override
     public String[] getUpgradableVersionRange() {
@@ -43,12 +40,14 @@ public boolean supportsRollingUpgrade() {
     }
 
     @Override
-    public File[] getPrepareScripts() {
-        String script = Script.findScript("", "db/schema-470to471.sql");
+    public InputStream[] getPrepareScripts() {
+        final String scriptFile = "META-INF/db/schema-470to471.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-470to471.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
-        return new File[] {new File(script)};
+
+        return new InputStream[] {script};
     }
 
     @Override
@@ -56,12 +55,13 @@ public void performDataMigration(Connection conn) {
     }
 
     @Override
-    public File[] getCleanupScripts() {
-        String script = Script.findScript("", "db/schema-470to471-cleanup.sql");
+    public InputStream[] getCleanupScripts() {
+        final String scriptFile = "META-INF/db/schema-470to471-cleanup.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-470to471-cleanup.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(script)};
+        return new InputStream[] {script};
     }
 }
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade471to480.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade471to480.java
index bde4c0ff24e..3b3a0bba03e 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade471to480.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade471to480.java
@@ -18,14 +18,11 @@
 package com.cloud.upgrade.dao;
 
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
-import org.apache.log4j.Logger;
 
-import java.io.File;
+import java.io.InputStream;
 import java.sql.Connection;
 
 public class Upgrade471to480 implements DbUpgrade {
-    final static Logger s_logger = Logger.getLogger(Upgrade471to480.class);
 
     @Override
     public String[] getUpgradableVersionRange() {
@@ -43,12 +40,14 @@ public boolean supportsRollingUpgrade() {
     }
 
     @Override
-    public File[] getPrepareScripts() {
-        String script = Script.findScript("", "db/schema-471to480.sql");
+    public InputStream[] getPrepareScripts() {
+        final String scriptFile = "META-INF/db/schema-471to480.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-471to480.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
-        return new File[] {new File(script)};
+
+        return new InputStream[] {script};
     }
 
     @Override
@@ -56,12 +55,13 @@ public void performDataMigration(Connection conn) {
     }
 
     @Override
-    public File[] getCleanupScripts() {
-        String script = Script.findScript("", "db/schema-471to480-cleanup.sql");
+    public InputStream[] getCleanupScripts() {
+        final String scriptFile = "META-INF/db/schema-471to480-cleanup.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-471to480-cleanup.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(script)};
+        return new InputStream[] {script};
     }
 }
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade480to481.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade480to481.java
index 26e7d125ec8..be33709dd92 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade480to481.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade480to481.java
@@ -18,14 +18,11 @@
 package com.cloud.upgrade.dao;
 
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
-import org.apache.log4j.Logger;
 
-import java.io.File;
+import java.io.InputStream;
 import java.sql.Connection;
 
 public class Upgrade480to481 implements DbUpgrade {
-    final static Logger s_logger = Logger.getLogger(Upgrade480to481.class);
 
     @Override
     public String[] getUpgradableVersionRange() {
@@ -43,12 +40,14 @@ public boolean supportsRollingUpgrade() {
     }
 
     @Override
-    public File[] getPrepareScripts() {
-        String script = Script.findScript("", "db/schema-480to481.sql");
+    public InputStream[] getPrepareScripts() {
+        final String scriptFile = "META-INF/db/schema-480to481.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-480to481.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
-        return new File[] {new File(script)};
+
+        return new InputStream[] {script};
     }
 
     @Override
@@ -56,12 +55,13 @@ public void performDataMigration(Connection conn) {
     }
 
     @Override
-    public File[] getCleanupScripts() {
-        String script = Script.findScript("", "db/schema-480to481-cleanup.sql");
+    public InputStream[] getCleanupScripts() {
+        final String scriptFile = "META-INF/db/schema-480to481-cleanup.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-480to481-cleanup.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(script)};
+        return new InputStream[] {script};
     }
 }
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade481to490.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade481to490.java
index 29e6534105b..1f9fb2f3f9f 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade481to490.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade481to490.java
@@ -17,9 +17,9 @@
 
 package com.cloud.upgrade.dao;
 
-import java.io.File;
-import java.io.FileReader;
 import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
@@ -30,7 +30,6 @@
 
 import com.cloud.utils.db.ScriptRunner;
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
 
 public class Upgrade481to490 implements DbUpgrade {
     final static Logger s_logger = Logger.getLogger(Upgrade481to490.class);
@@ -51,12 +50,14 @@ public boolean supportsRollingUpgrade() {
     }
 
     @Override
-    public File[] getPrepareScripts() {
-        String script = Script.findScript("", "db/schema-481to490.sql");
+    public InputStream[] getPrepareScripts() {
+        final String scriptFile = "META-INF/db/schema-481to490.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-481to490.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
-        return new File[] {new File(script)};
+
+        return new InputStream[] {script};
     }
 
     @Override
@@ -117,12 +118,13 @@ private void setupRolesAndPermissionsForDynamicChecker(final Connection conn) {
         if (s_logger.isDebugEnabled()) {
             s_logger.debug("Configuring default role-api mappings, use migrate-dynamicroles.py instead if you want to migrate rules from an existing commands.properties file");
         }
-        String script = Script.findScript("", "db/create-default-role-api-mappings.sql");
+        final String scriptFile = "META-INF/db/create-default-role-api-mappings.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
             s_logger.error("Unable to find default role-api mapping sql file, please configure api per role manually");
             return;
         }
-        try(final FileReader reader = new FileReader(new File(script))) {
+        try(final InputStreamReader reader = new InputStreamReader(script)) {
             ScriptRunner runner = new ScriptRunner(conn, false, true);
             runner.runScript(reader);
         } catch (SQLException | IOException e) {
@@ -131,11 +133,13 @@ private void setupRolesAndPermissionsForDynamicChecker(final Connection conn) {
     }
 
     @Override
-    public File[] getCleanupScripts() {
-        String script = Script.findScript("", "db/schema-481to490-cleanup.sql");
+    public InputStream[] getCleanupScripts() {
+        final String scriptFile = "META-INF/db/schema-481to490-cleanup.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-481to490-cleanup.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
-        return new File[] {new File(script)};
+
+        return new InputStream[] {script};
     }
 }
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade490to4910.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade490to4910.java
index 01e4b13d432..8757d7fa539 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade490to4910.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade490to4910.java
@@ -18,9 +18,8 @@
 package com.cloud.upgrade.dao;
 
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
 
-import java.io.File;
+import java.io.InputStream;
 import java.sql.Connection;
 
 public class Upgrade490to4910 implements DbUpgrade {
@@ -41,12 +40,14 @@ public boolean supportsRollingUpgrade() {
     }
 
     @Override
-    public File[] getPrepareScripts() {
-        String script = Script.findScript("", "db/schema-490to4910.sql");
+    public InputStream[] getPrepareScripts() {
+        final String scriptFile = "META-INF/db/schema-490to4910.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-490to4910.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
-        return new File[] {new File(script)};
+
+        return new InputStream[] {script};
     }
 
     @Override
@@ -54,11 +55,13 @@ public void performDataMigration(Connection conn) {
     }
 
     @Override
-    public File[] getCleanupScripts() {
-        String script = Script.findScript("", "db/schema-490to4910-cleanup.sql");
+    public InputStream[] getCleanupScripts() {
+        final String scriptFile = "META-INF/db/schema-490to4910-cleanup.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-490to4910-cleanup.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
-        return new File[] {new File(script)};
+
+        return new InputStream[] {script};
     }
 }
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade4910to4920.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade4910to4920.java
index 46584539e1e..1950c8f28b8 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade4910to4920.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade4910to4920.java
@@ -18,9 +18,8 @@
 package com.cloud.upgrade.dao;
 
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
 
-import java.io.File;
+import java.io.InputStream;
 import java.sql.Connection;
 
 public class Upgrade4910to4920 implements DbUpgrade {
@@ -41,12 +40,14 @@ public boolean supportsRollingUpgrade() {
     }
 
     @Override
-    public File[] getPrepareScripts() {
-        String script = Script.findScript("", "db/schema-4910to4920.sql");
+    public InputStream[] getPrepareScripts() {
+        final String scriptFile = "META-INF/db/schema-4910to4920.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-4910to4920.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
-        return new File[] {new File(script)};
+
+        return new InputStream[] {script};
     }
 
     @Override
@@ -54,11 +55,13 @@ public void performDataMigration(Connection conn) {
     }
 
     @Override
-    public File[] getCleanupScripts() {
-        String script = Script.findScript("", "db/schema-4910to4920-cleanup.sql");
+    public InputStream[] getCleanupScripts() {
+        final String scriptFile = "META-INF/db/schema-4910to4920-cleanup.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-4910to4920-cleanup.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
-        return new File[] {new File(script)};
+
+        return new InputStream[] {script};
     }
 }
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade4920to4930.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade4920to4930.java
index 3c82254e338..bc02c95064c 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade4920to4930.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade4920to4930.java
@@ -18,9 +18,8 @@
 package com.cloud.upgrade.dao;
 
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
 
-import java.io.File;
+import java.io.InputStream;
 import java.sql.Connection;
 
 public class Upgrade4920to4930 implements DbUpgrade {
@@ -41,12 +40,14 @@ public boolean supportsRollingUpgrade() {
     }
 
     @Override
-    public File[] getPrepareScripts() {
-        String script = Script.findScript("", "db/schema-4920to4930.sql");
+    public InputStream[] getPrepareScripts() {
+        final String scriptFile = "META-INF/db/schema-4920to4930.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-4920to4930.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
-        return new File[] {new File(script)};
+
+        return new InputStream[] {script};
     }
 
     @Override
@@ -54,11 +55,13 @@ public void performDataMigration(Connection conn) {
     }
 
     @Override
-    public File[] getCleanupScripts() {
-        String script = Script.findScript("", "db/schema-4920to4930-cleanup.sql");
+    public InputStream[] getCleanupScripts() {
+        final String scriptFile = "META-INF/db/schema-4920to4930-cleanup.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-4920to4930-cleanup.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
-        return new File[] {new File(script)};
+
+        return new InputStream[] {script};
     }
 }
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade4930to41000.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade4930to41000.java
index 53a910eb449..3500428df7f 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade4930to41000.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade4930to41000.java
@@ -19,10 +19,9 @@
 
 import com.cloud.hypervisor.Hypervisor;
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
 import org.apache.log4j.Logger;
 
-import java.io.File;
+import java.io.InputStream;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
@@ -33,7 +32,7 @@
 import java.util.Set;
 
 public class Upgrade4930to41000 implements DbUpgrade {
-    final static Logger LOG = Logger.getLogger(Upgrade4930to41000.class);
+    final static Logger s_logger = Logger.getLogger(Upgrade4930to41000.class);
 
     public static class MemoryValues {
         long max;
@@ -69,12 +68,14 @@ public boolean supportsRollingUpgrade() {
     }
 
     @Override
-    public File[] getPrepareScripts() {
-        String script = Script.findScript("", "db/schema-4930to41000.sql");
+    public InputStream[] getPrepareScripts() {
+        final String scriptFile = "META-INF/db/schema-4930to41000.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-4930to41000.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
-        return new File[] {new File(script)};
+
+        return new InputStream[] {script};
     }
 
     @Override
@@ -86,7 +87,7 @@ public void performDataMigration(Connection conn) {
 
     @SuppressWarnings("serial")
     private void updateSystemVmTemplates(final Connection conn) {
-        LOG.debug("Updating System Vm template IDs");
+        s_logger.debug("Updating System Vm template IDs");
         // Get all hypervisors in use
         final Set<Hypervisor.HypervisorType> hypervisorsListInUse = new HashSet<Hypervisor.HypervisorType>();
         try (PreparedStatement pstmt = conn.prepareStatement("select distinct(hypervisor_type) from `cloud`.`cluster` where removed is null"); ResultSet rs = pstmt.executeQuery()) {
@@ -116,7 +117,7 @@ private void updateSystemVmTemplates(final Connection conn) {
                 }
             }
         } catch (final SQLException e) {
-            LOG.error("updateSystemVmTemplates:Exception while getting hypervisor types from clusters: " + e.getMessage());
+            s_logger.error("updateSystemVmTemplates:Exception while getting hypervisor types from clusters: " + e.getMessage());
             throw new CloudRuntimeException("updateSystemVmTemplates:Exception while getting hypervisor types from clusters", e);
         }
 
@@ -165,7 +166,7 @@ private void updateSystemVmTemplates(final Connection conn) {
         };
 
         for (final Map.Entry<Hypervisor.HypervisorType, String> hypervisorAndTemplateName : NewTemplateNameList.entrySet()) {
-            LOG.debug("Updating " + hypervisorAndTemplateName.getKey() + " System Vms");
+            s_logger.debug("Updating " + hypervisorAndTemplateName.getKey() + " System Vms");
             try (PreparedStatement pstmt = conn.prepareStatement("select id from `cloud`.`vm_template` where name = ? and removed is null order by id desc limit 1")) {
                 // Get 4.10.0 system Vm template Id for corresponding hypervisor
                 long templateId = -1;
@@ -175,7 +176,7 @@ private void updateSystemVmTemplates(final Connection conn) {
                         templateId = rs.getLong(1);
                     }
                 } catch (final SQLException e) {
-                    LOG.error("updateSystemVmTemplates:Exception while getting ids of templates: " + e.getMessage());
+                    s_logger.error("updateSystemVmTemplates:Exception while getting ids of templates: " + e.getMessage());
                     throw new CloudRuntimeException("updateSystemVmTemplates:Exception while getting ids of templates", e);
                 }
 
@@ -185,7 +186,7 @@ private void updateSystemVmTemplates(final Connection conn) {
                         templ_type_pstmt.setLong(1, templateId);
                         templ_type_pstmt.executeUpdate();
                     } catch (final SQLException e) {
-                        LOG.error("updateSystemVmTemplates:Exception while updating template with id " + templateId + " to be marked as 'system': " + e.getMessage());
+                        s_logger.error("updateSystemVmTemplates:Exception while updating template with id " + templateId + " to be marked as 'system': " + e.getMessage());
                         throw new CloudRuntimeException("updateSystemVmTemplates:Exception while updating template with id " + templateId + " to be marked as 'system'", e);
                     }
                     // update template ID of system Vms
@@ -195,7 +196,7 @@ private void updateSystemVmTemplates(final Connection conn) {
                         update_templ_id_pstmt.setString(2, hypervisorAndTemplateName.getKey().toString());
                         update_templ_id_pstmt.executeUpdate();
                     } catch (final Exception e) {
-                        LOG.error("updateSystemVmTemplates:Exception while setting template for " + hypervisorAndTemplateName.getKey().toString() + " to " + templateId
+                        s_logger.error("updateSystemVmTemplates:Exception while setting template for " + hypervisorAndTemplateName.getKey().toString() + " to " + templateId
                                 + ": " + e.getMessage());
                         throw new CloudRuntimeException("updateSystemVmTemplates:Exception while setting template for " + hypervisorAndTemplateName.getKey().toString() + " to "
                                 + templateId, e);
@@ -208,7 +209,7 @@ private void updateSystemVmTemplates(final Connection conn) {
                         update_pstmt.setString(2, routerTemplateConfigurationNames.get(hypervisorAndTemplateName.getKey()));
                         update_pstmt.executeUpdate();
                     } catch (final SQLException e) {
-                        LOG.error("updateSystemVmTemplates:Exception while setting " + routerTemplateConfigurationNames.get(hypervisorAndTemplateName.getKey()) + " to "
+                        s_logger.error("updateSystemVmTemplates:Exception while setting " + routerTemplateConfigurationNames.get(hypervisorAndTemplateName.getKey()) + " to "
                                 + hypervisorAndTemplateName.getValue() + ": " + e.getMessage());
                         throw new CloudRuntimeException("updateSystemVmTemplates:Exception while setting "
                                 + routerTemplateConfigurationNames.get(hypervisorAndTemplateName.getKey()) + " to " + hypervisorAndTemplateName.getValue(), e);
@@ -221,14 +222,14 @@ private void updateSystemVmTemplates(final Connection conn) {
                         update_pstmt.setString(2, "minreq.sysvmtemplate.version");
                         update_pstmt.executeUpdate();
                     } catch (final SQLException e) {
-                        LOG.error("updateSystemVmTemplates:Exception while setting 'minreq.sysvmtemplate.version' to 4.10.0: " + e.getMessage());
+                        s_logger.error("updateSystemVmTemplates:Exception while setting 'minreq.sysvmtemplate.version' to 4.10.0: " + e.getMessage());
                         throw new CloudRuntimeException("updateSystemVmTemplates:Exception while setting 'minreq.sysvmtemplate.version' to 4.10.0", e);
                     }
                 } else {
                     if (hypervisorsListInUse.contains(hypervisorAndTemplateName.getKey())) {
                         throw new CloudRuntimeException(getUpgradedVersion() + hypervisorAndTemplateName.getKey() + " SystemVm template not found. Cannot upgrade system Vms");
                     } else {
-                        LOG.warn(getUpgradedVersion() + hypervisorAndTemplateName.getKey() + " SystemVm template not found. " + hypervisorAndTemplateName.getKey()
+                        s_logger.warn(getUpgradedVersion() + hypervisorAndTemplateName.getKey() + " SystemVm template not found. " + hypervisorAndTemplateName.getKey()
                                 + " hypervisor is not used, so not failing upgrade");
                         // Update the latest template URLs for corresponding
                         // hypervisor
@@ -239,7 +240,7 @@ private void updateSystemVmTemplates(final Connection conn) {
                             update_templ_url_pstmt.setString(3, hypervisorAndTemplateName.getKey().toString());
                             update_templ_url_pstmt.executeUpdate();
                         } catch (final SQLException e) {
-                            LOG.error("updateSystemVmTemplates:Exception while updating 'url' and 'checksum' for hypervisor type "
+                            s_logger.error("updateSystemVmTemplates:Exception while updating 'url' and 'checksum' for hypervisor type "
                                     + hypervisorAndTemplateName.getKey().toString() + ": " + e.getMessage());
                             throw new CloudRuntimeException("updateSystemVmTemplates:Exception while updating 'url' and 'checksum' for hypervisor type "
                                     + hypervisorAndTemplateName.getKey().toString(), e);
@@ -247,21 +248,23 @@ private void updateSystemVmTemplates(final Connection conn) {
                     }
                 }
             } catch (final SQLException e) {
-                LOG.error("updateSystemVmTemplates:Exception while getting ids of templates: " + e.getMessage());
+                s_logger.error("updateSystemVmTemplates:Exception while getting ids of templates: " + e.getMessage());
                 throw new CloudRuntimeException("updateSystemVmTemplates:Exception while getting ids of templates", e);
             }
         }
-        LOG.debug("Updating System Vm Template IDs Complete");
+        s_logger.debug("Updating System Vm Template IDs Complete");
     }
 
 
     @Override
-    public File[] getCleanupScripts() {
-        String script = Script.findScript("", "db/schema-4930to41000-cleanup.sql");
+    public InputStream[] getCleanupScripts() {
+        final String scriptFile = "META-INF/db/schema-4930to41000-cleanup.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
         if (script == null) {
-            throw new CloudRuntimeException("Unable to find db/schema-4930to41000-cleanup.sql");
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
-        return new File[] {new File(script)};
+
+        return new InputStream[] {script};
     }
 
     private void populateGuestOsDetails(Connection conn){
diff --git a/engine/schema/src/com/cloud/upgrade/dao/UpgradeSnapshot217to224.java b/engine/schema/src/com/cloud/upgrade/dao/UpgradeSnapshot217to224.java
index 802521c42d5..3e39f81f761 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/UpgradeSnapshot217to224.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/UpgradeSnapshot217to224.java
@@ -16,22 +16,22 @@
 // under the License.
 package com.cloud.upgrade.dao;
 
-import java.io.File;
+import java.io.InputStream;
 import java.sql.Connection;
 
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
 
 public class UpgradeSnapshot217to224 implements DbUpgrade {
 
     @Override
-    public File[] getPrepareScripts() {
-        String file = Script.findScript("", "db/schema-snapshot-217to224.sql");
-        if (file == null) {
-            throw new CloudRuntimeException("Unable to find the upgrade script, schema-snapshot-217to224.sql");
+    public InputStream[] getPrepareScripts() {
+        final String scriptFile = "META-INF/db/schema-snapshot-217to224.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
+        if (script == null) {
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(file)};
+        return new InputStream[] {script};
     }
 
     @Override
@@ -39,7 +39,7 @@ public void performDataMigration(Connection conn) {
     }
 
     @Override
-    public File[] getCleanupScripts() {
+    public InputStream[] getCleanupScripts() {
         return null;
     }
 
diff --git a/engine/schema/src/com/cloud/upgrade/dao/UpgradeSnapshot223to224.java b/engine/schema/src/com/cloud/upgrade/dao/UpgradeSnapshot223to224.java
index 85f845b489a..8e546e7dd4d 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/UpgradeSnapshot223to224.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/UpgradeSnapshot223to224.java
@@ -16,22 +16,22 @@
 // under the License.
 package com.cloud.upgrade.dao;
 
-import java.io.File;
+import java.io.InputStream;
 import java.sql.Connection;
 
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
 
 public class UpgradeSnapshot223to224 implements DbUpgrade {
 
     @Override
-    public File[] getPrepareScripts() {
-        String file = Script.findScript("", "db/schema-snapshot-223to224.sql");
-        if (file == null) {
-            throw new CloudRuntimeException("Unable to find the upgrade script, schema-snapshot-223to224.sql");
+    public InputStream[] getPrepareScripts() {
+        final String scriptFile = "META-INF/db/schema-snapshot-223to224.sql";
+        final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
+        if (script == null) {
+            throw new CloudRuntimeException("Unable to find " + scriptFile);
         }
 
-        return new File[] {new File(file)};
+        return new InputStream[] {script};
     }
 
     @Override
@@ -39,7 +39,7 @@ public void performDataMigration(Connection conn) {
     }
 
     @Override
-    public File[] getCleanupScripts() {
+    public InputStream[] getCleanupScripts() {
         return null;
     }
 
diff --git a/packaging/centos63/cloud.spec b/packaging/centos63/cloud.spec
index 1a11a15cb8f..898118fa96d 100644
--- a/packaging/centos63/cloud.spec
+++ b/packaging/centos63/cloud.spec
@@ -553,7 +553,6 @@ pip install --upgrade /usr/share/cloudstack-marvin/Marvin-*.tar.gz
 %attr(0755,root,root) %{_bindir}/%{name}-sysvmadm
 %attr(0755,root,root) %{_bindir}/%{name}-setup-encryption
 %{_datadir}/%{name}-management/setup/*.sql
-%{_datadir}/%{name}-management/setup/db/*.sql
 %{_datadir}/%{name}-management/setup/*.sh
 %{_datadir}/%{name}-management/setup/server-setup.xml
 %{_datadir}/%{name}-management/webapp/*
diff --git a/packaging/centos7/cloud.spec b/packaging/centos7/cloud.spec
index 10b9c3ed908..219b8b6edf1 100644
--- a/packaging/centos7/cloud.spec
+++ b/packaging/centos7/cloud.spec
@@ -500,7 +500,6 @@ pip install --upgrade /usr/share/cloudstack-marvin/Marvin-*.tar.gz
 %attr(0755,root,root) %{_bindir}/%{name}-sysvmadm
 %attr(0755,root,root) %{_bindir}/%{name}-setup-encryption
 %{_datadir}/%{name}-management/setup/*.sql
-%{_datadir}/%{name}-management/setup/db/*.sql
 %{_datadir}/%{name}-management/setup/*.sh
 %{_datadir}/%{name}-management/setup/server-setup.xml
 %{_datadir}/%{name}-management/webapp/*


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services