Merge branch 'bzr/golem' of /Users/distler/Sites/code/instiki

This commit is contained in:
Jacques Distler 2009-10-21 00:53:26 -05:00
commit dc26bbdd36
3 changed files with 41 additions and 13 deletions

View file

@ -0,0 +1,11 @@
class ModifyTextTypes < ActiveRecord::Migration
def self.up
change_column :revisions, :content, :text, :limit => 16777215
change_column :pages, :name, :string, :limit => 255
change_column :webs, :additional_style, :text
end
def self.down
raise ActiveRecord::IrreversibleMigration
end
end

Binary file not shown.

View file

@ -1,7 +1,22 @@
task :upgrade_instiki => :environment do require 'rake'
RAILS_ENV = 'production' unless ENV['RAILS_ENV']
puts "Upgrading Instiki in #{RAILS_ENV} environment."
desc "This task will perform necessary upgrades to your Instiki installation"
task :upgrade_instiki => :environment do
ENV['RAILS_ENV'] ||= 'production'
puts "Upgrading Instiki in #{ENV['RAILS_ENV']} environment."
InstikiUpgrade.migrate_db
InstikiUpgrade.move_uploaded_files
end
class InstikiUpgrade
def self.migrate_db
ActiveRecord::Base.establish_connection ENV['RAILS_ENV']
Rake::Task["db:migrate"].invoke
end
def self.move_uploaded_files
Web.all.each do |web| Web.all.each do |web|
public_path = Rails.root.join("public", web.address) public_path = Rails.root.join("public", web.address)
if public_path.exist? if public_path.exist?
@ -14,4 +29,6 @@ task :upgrade_instiki => :environment do
end end
end end
end end
end
end end