Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added obvious SQL indices, fixed mod_expires.
- Loading branch information
Showing
2 changed files
with
50 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters