diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-06-15 19:30:20 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-06-15 19:30:20 +0000 |
commit | e039f7bcb86c6117a0724c24f33d50aaa67479b1 (patch) | |
tree | c0efc8babde0a5cde06014daf2965384dc3c4438 | |
parent | 9ba878a6038b70da5be891baf4d68dbb393e7be2 (diff) | |
download | puppet-e039f7bcb86c6117a0724c24f33d50aaa67479b1.tar.gz puppet-e039f7bcb86c6117a0724c24f33d50aaa67479b1.tar.xz puppet-e039f7bcb86c6117a0724c24f33d50aaa67479b1.zip |
Fixing the type/title index for mysql
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2590 980ebf18-57e1-0310-9a29-db15c13687c0
-rw-r--r-- | lib/puppet/rails/database/schema.rb | 9 |
1 files changed, 8 insertions, 1 deletions
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 |