summaryrefslogtreecommitdiffstats
path: root/lib/puppet/rails/database
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-12-17 00:05:46 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-12-17 00:05:46 +0000
commit9df9e4bbff1f4490a2107ff2930da035e11406cf (patch)
tree6c6118e60fa6121ecd297559e98575b745154192 /lib/puppet/rails/database
parent02cfc44af55f719235a58ca9cc23f7d29e49cd3c (diff)
downloadpuppet-9df9e4bbff1f4490a2107ff2930da035e11406cf.tar.gz
puppet-9df9e4bbff1f4490a2107ff2930da035e11406cf.tar.xz
puppet-9df9e4bbff1f4490a2107ff2930da035e11406cf.zip
Getting rid of the db init stdout and reindenting
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1944 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/rails/database')
-rw-r--r--lib/puppet/rails/database/schema.rb113
1 files changed, 61 insertions, 52 deletions
diff --git a/lib/puppet/rails/database/schema.rb b/lib/puppet/rails/database/schema.rb
index 609d6abdd..546ad73fb 100644
--- a/lib/puppet/rails/database/schema.rb
+++ b/lib/puppet/rails/database/schema.rb
@@ -1,64 +1,73 @@
class Puppet::Rails::Schema
+ def self.init
+ oldout = nil
+ Puppet::Util.benchmark(:notice, "Initialized database") do
+ # We want to rewrite stdout, so we don't get migration messages.
+ oldout = $stdout
+ $stdout = File.open("/dev/null", "w")
+ ActiveRecord::Schema.define do
+ create_table :resources do |t|
+ t.column :title, :string, :null => false
+ t.column :restype, :string
+ t.column :host_id, :integer
+ t.column :source_file_id, :integer
+ t.column :exported, :boolean
+ end
-def self.init
- ActiveRecord::Schema.define do
- create_table :resources do |t|
- t.column :title, :string, :null => false
- t.column :restype, :string
- t.column :host_id, :integer
- t.column :source_file_id, :integer
- t.column :exported, :boolean
- end
+ create_table :source_files do |t|
+ t.column :filename, :string
+ t.column :path, :string
+ end
- create_table :source_files do |t|
- t.column :filename, :string
- t.column :path, :string
- end
+ create_table :puppet_classes do |t|
+ t.column :name, :string
+ t.column :host_id, :integer
+ t.column :source_file_id, :integer
+ end
- create_table :puppet_classes do |t|
- t.column :name, :string
- t.column :host_id, :integer
- t.column :source_file_id, :integer
- end
-
- create_table :hosts do |t|
- t.column :name, :string, :null => false
- t.column :ip, :string
- t.column :connect, :date
- #Use updated_at to automatically add timestamp on save.
- t.column :updated_at, :date
- t.column :source_file_id, :integer
- end
+ create_table :hosts do |t|
+ t.column :name, :string, :null => false
+ t.column :ip, :string
+ t.column :connect, :date
+ #Use updated_at to automatically add timestamp on save.
+ t.column :updated_at, :date
+ t.column :source_file_id, :integer
+ end
- create_table :fact_names do |t|
- t.column :name, :string, :null => false
- t.column :host_id, :integer, :null => false
- end
+ create_table :fact_names do |t|
+ t.column :name, :string, :null => false
+ t.column :host_id, :integer, :null => false
+ end
- create_table :fact_values do |t|
- t.column :value, :string, :null => false
- t.column :fact_name_id, :integer, :null => false
- end
+ create_table :fact_values do |t|
+ t.column :value, :string, :null => false
+ t.column :fact_name_id, :integer, :null => false
+ end
- create_table :param_values do |t|
- t.column :value, :string, :null => false
- t.column :param_name_id, :integer, :null => false
- end
-
- create_table :param_names do |t|
- t.column :name, :string, :null => false
- t.column :resource_id, :integer
- end
+ create_table :param_values do |t|
+ t.column :value, :string, :null => false
+ t.column :param_name_id, :integer, :null => false
+ end
+
+ create_table :param_names do |t|
+ t.column :name, :string, :null => false
+ t.column :resource_id, :integer
+ end
- create_table :tags do |t|
- t.column :name, :string
- end
+ create_table :tags do |t|
+ t.column :name, :string
+ end
- create_table :taggings do |t|
- t.column :tag_id, :integer
- t.column :taggable_id, :integer
- t.column :taggable_type, :string
+ create_table :taggings do |t|
+ t.column :tag_id, :integer
+ t.column :taggable_id, :integer
+ t.column :taggable_type, :string
+ end
+ end
end
+ ensure
+ $stdout = oldout
end
end
-end
+
+# $Id$