From e039f7bcb86c6117a0724c24f33d50aaa67479b1 Mon Sep 17 00:00:00 2001 From: luke Date: Fri, 15 Jun 2007 19:30:20 +0000 Subject: Fixing the type/title index for mysql git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2590 980ebf18-57e1-0310-9a29-db15c13687c0 --- lib/puppet/rails/database/schema.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lib/puppet/rails') diff --git a/lib/puppet/rails/database/schema.rb b/lib/puppet/rails/database/schema.rb index 81a1cdbc3..c3f525679 100644 --- a/lib/puppet/rails/database/schema.rb +++ b/lib/puppet/rails/database/schema.rb @@ -18,7 +18,14 @@ class Puppet::Rails::Schema add_index :resources, :id, :integer => true add_index :resources, :host_id, :integer => true add_index :resources, :source_file_id, :integer => true - add_index :resources, [:title, :restype] + + # Thanks, mysql! MySQL requires a length on indexes in text fields. + # So, we provide them for mysql and handle everything else specially. + if Puppet[:dbadapter] == "mysql" + execute "CREATE INDEX typentitle ON resources (restype,title(50));" + else + add_index :resources, [:title, :restype] + end create_table :source_files do |t| t.column :filename, :string -- cgit