<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff></diff>
      <filename>db/production.db.sqlite3</filename>
    </modified>
    <modified>
      <diff>@@ -1,17 +1,34 @@
+require 'rake'
+
+desc &quot;This task will perform necessary upgrades to your Instiki installation&quot;
 task :upgrade_instiki =&gt; :environment do
-  RAILS_ENV = 'production' unless ENV['RAILS_ENV']
-  puts &quot;Upgrading Instiki in #{RAILS_ENV} environment.&quot;
+  ENV['RAILS_ENV'] ||= 'production'
+  puts &quot;Upgrading Instiki in #{ENV['RAILS_ENV']} environment.&quot;
+
+  InstikiUpgrade.migrate_db
+  InstikiUpgrade.move_uploaded_files
+end
+
+class InstikiUpgrade
 
-  Web.all.each do |web|
-    public_path = Rails.root.join(&quot;public&quot;, web.address)
-    if public_path.exist?
-      webs_path = Rails.root.join(&quot;webs&quot;, web.address)
-      if webs_path.exist?
-        puts &quot;Warning! The directory #{webs_path} already exists. Skipping.&quot;
-      else
-        public_path.rename(webs_path)
-        puts &quot;Moved #{public_path} to #{webs_path}&quot;
+  def self.migrate_db
+    ActiveRecord::Base.establish_connection ENV['RAILS_ENV']
+    Rake::Task[&quot;db:migrate&quot;].invoke
+  end
+
+  def self.move_uploaded_files
+    Web.all.each do |web|
+      public_path = Rails.root.join(&quot;public&quot;, web.address)
+      if public_path.exist?
+        webs_path = Rails.root.join(&quot;webs&quot;, web.address)
+        if webs_path.exist?
+          puts &quot;Warning! The directory #{webs_path} already exists. Skipping.&quot;
+        else
+          public_path.rename(webs_path)
+          puts &quot;Moved #{public_path} to #{webs_path}&quot;
+        end
       end
     end
   end
-end
+
+end
\ No newline at end of file</diff>
      <filename>lib/tasks/upgrade_instiki.rake</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>097ce16e8be0d72ef9ecc24349ea57825db4013c</id>
    </parent>
    <parent>
      <id>97a35e280b4e27e5508d79dae93ae1a94c8183be</id>
    </parent>
  </parents>
  <author>
    <name>Jacques Distler</name>
    <email>distler@golem.ph.utexas.edu</email>
  </author>
  <url>http://github.com/parasew/instiki/commit/dc26bbdd363dc62000053d2289054c2c22ef2973</url>
  <id>dc26bbdd363dc62000053d2289054c2c22ef2973</id>
  <committed-date>2009-10-20T22:53:26-07:00</committed-date>
  <authored-date>2009-10-20T22:53:26-07:00</authored-date>
  <message>Merge branch 'bzr/golem' of /Users/distler/Sites/code/instiki</message>
  <tree>8fe5a420987e9b2931ee3c22e21d889f89f9d524</tree>
  <committer>
    <name>Jacques Distler</name>
    <email>distler@golem.ph.utexas.edu</email>
  </committer>
</commit>
