Skip to content

Commit

Permalink
Added obvious SQL indices, fixed mod_expires.
Browse files Browse the repository at this point in the history
  • Loading branch information
gaspard committed Sep 29, 2010
1 parent 2e5d0c3 commit 1c986f1
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 3 deletions.
47 changes: 47 additions & 0 deletions db/migrate/20100928185257_add_obvious_idx.rb
@@ -0,0 +1,47 @@
class AddObviousIdx < ActiveRecord::Migration
INDICES = {
#:attachments,
:cached_pages => %w{node_id},
:cached_pages_nodes => %w{node_id cached_page_id},
:columns => %w{role_id name},
:comments => %w{discussion_id reply_to user_id},
:data_entries => DataEntry::NodeLinkSymbolsId,
:discussions => %w{node_id},
:groups_users => %w{group_id user_id},
:idx_nodes_ml_strings => %w{node_id key lang value},
:idx_nodes_strings => %w{node_id key value},
:idx_templates => %w{tkpath format mode site_id node_id version_id},
# :iformats
:links => %w{source_id target_id relation_id status date},
:nodes => %w{kpath parent_id project_id section_id rgroup_id wgroup_id publish_from},
:nodes_roles => %w{node_id role_id},
:relations => %w{source_role target_role site_id},
:roles => %w{name kpath},
# :sessions
:sites => %w{host},
# :users
:versions => %w{node_id user_id},
:zips => %w{site_id},
}

def self.up
add_index(:nodes, [:zip, :site_id])

INDICES.each do |table, indices|
indices.each do |key|
add_index(table, key)
end
end


end

def self.down
remove_index(:nodes, :column => [:zip, :site_id])
INDICES.each do |table, indices|
indices.each do |key|
remove_index(table, key)
end
end
end
end
6 changes: 3 additions & 3 deletions lib/zena/deploy/httpd.rhtml
Expand Up @@ -15,12 +15,12 @@ PassengerDefaultUser www-data
</Proxy>
<% end %>

<ifmodule mode_expires.c>
<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault A0
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 year"
ExpiresByType application/x-javascript "access plus 1 year"
</ifmodule>
ExpiresByType application/javascript "access plus 1 year"
</IfModule>

0 comments on commit 1c986f1

Please sign in to comment.