diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-10-17 06:03:14 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-10-17 06:03:14 +0000 |
commit | 29ff4f3963b78939ed67ee5b526393ae14e744a0 (patch) | |
tree | aee2b9c235137fbe44d11887983e579c7f7e0b33 /lib | |
parent | b4ebe76e6aa14efee6c5c56a61c4ee7f5784997e (diff) | |
download | puppet-29ff4f3963b78939ed67ee5b526393ae14e744a0.tar.gz puppet-29ff4f3963b78939ed67ee5b526393ae14e744a0.tar.xz puppet-29ff4f3963b78939ed67ee5b526393ae14e744a0.zip |
Switching from calling "up" on the migration directly to using the "migrate" method. It is still not checking versions or allowing external forcing of migration, but it is a start.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1795 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/rails.rb | 16 | ||||
-rw-r--r-- | lib/puppet/rails/database/01_puppet_initialize.rb (renamed from lib/puppet/rails/database.rb) | 2 |
2 files changed, 15 insertions, 3 deletions
diff --git a/lib/puppet/rails.rb b/lib/puppet/rails.rb index a547fff5f..01f3312be 100644 --- a/lib/puppet/rails.rb +++ b/lib/puppet/rails.rb @@ -94,9 +94,21 @@ module Puppet::Rails end if Puppet[:dbadapter] == "sqlite3" and ! FileTest.exists?(Puppet[:dblocation]) - require 'puppet/rails/database' + + dbdir = nil + $:.each { |d| + tmp = File.join(d, "puppet/rails/database") + if FileTest.directory?(tmp) + dbdir = tmp + end + } + + unless dbdir + raise Puppet::Error, "Could not find Puppet::Rails database dir" + end + begin - Puppet::Rails::Database.up + ActiveRecord::Migrator.migrate(dbdir) rescue => detail if Puppet[:trace] puts detail.backtrace diff --git a/lib/puppet/rails/database.rb b/lib/puppet/rails/database/01_puppet_initialize.rb index 8be05bd88..485634004 100644 --- a/lib/puppet/rails/database.rb +++ b/lib/puppet/rails/database/01_puppet_initialize.rb @@ -1,4 +1,4 @@ -class Puppet::Rails::Database < ActiveRecord::Migration +class PuppetInitialize < ActiveRecord::Migration require 'sqlite3' def self.up |