Make upgrade_instiki Rake Task Database-Agnostic
Reported by James Herdman.
This commit is contained in:
parent
93ea19f567
commit
c05d69bcff
|
@ -1,9 +1,10 @@
|
|||
require 'sqlite3'
|
||||
require 'active_record'
|
||||
|
||||
task :upgrade_instiki do
|
||||
db = SQLite3::Database.new( "db/production.db.sqlite3" )
|
||||
db.execute( "select * from webs" ) do |row|
|
||||
if File.exists?('public/' + row[4])
|
||||
task :upgrade_instiki => :environment do
|
||||
ActiveRecord::Base.establish_connection(:production)
|
||||
webs = ActiveRecord::Base.connection.execute( "select * from webs" )
|
||||
webs.each do |row|
|
||||
if File.exists?('public/' + row[4])
|
||||
if File.exists?('webs/' + row[4])
|
||||
print "Warning! The directory webs/#{row[4]} already exists. Skipping.\n"
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue