fixes #123: Tags aren't alphabetized

This commit is contained in:
albert
2011-10-14 14:28:04 -04:00
parent 13e8574c64
commit 4abf66cf44
9 changed files with 228 additions and 6 deletions

View File

@@ -33,6 +33,7 @@ class CreatePosts < ActiveRecord::Migration
# Cached
t.column :last_noted_at, :datetime
t.column :last_commented_at, :datetime
t.column :fav_count, :integer, :null => false, :default => 0
# Tags
t.column :tag_string, :text, :null => false, :default => ""

View File

@@ -4,7 +4,7 @@ class CreateTagAliases < ActiveRecord::Migration
t.column :antecedent_name, :string, :null => false
t.column :consequent_name, :string, :null => false
t.column :creator_id, :integer, :null => false
t.column :creator_ip_addr, :inet, :null => false
t.column :creator_ip_addr, "inet", :null => false
t.column :forum_topic_id, :integer
t.column :status, :text, :null => false, :default => "pending"
t.timestamps

View File

@@ -6,6 +6,9 @@ class CreatePostVotes < ActiveRecord::Migration
t.column :score, :integer, :null => false
t.timestamps
end
add_index :post_votes, :post_id
add_index :post_votes, :user_id
end
def self.down

View File

@@ -9,14 +9,14 @@ class CreateNotes < ActiveRecord::Migration
t.column :height, :integer, :null => false
t.column :is_active, :boolean, :null => false, :default => true
t.column :body, :text, :null => false
t.column :text_index, "tsvector", :null => false
t.column :body_index, "tsvector", :null => false
t.timestamps
end
add_index :notes, :creator_id
add_index :notes, :post_id
execute "CREATE INDEX index_notes_on_text_index ON notes USING GIN (text_index)"
execute "CREATE TRIGGER trigger_notes_on_update BEFORE INSERT OR UPDATE ON notes FOR EACH ROW EXECUTE PROCEDURE tsvector_update_trigger('text_index', 'pg_catalog.english', 'body')"
execute "CREATE INDEX index_notes_on_body_index ON notes USING GIN (body_index)"
execute "CREATE TRIGGER trigger_notes_on_update BEFORE INSERT OR UPDATE ON notes FOR EACH ROW EXECUTE PROCEDURE tsvector_update_trigger('body_index', 'pg_catalog.english', 'body')"
end
def self.down

View File

@@ -7,6 +7,7 @@ class CreateTagSubscriptions < ActiveRecord::Migration
t.column :post_ids, :text, :null => false
t.column :is_public, :boolean, :null => false, :default => true
t.column :last_accessed_at, :datetime
t.column :is_opted_in, :boolean, :null => false, :default => false
t.timestamps
end

View File

@@ -9,6 +9,8 @@ class CreatePoolVersions < ActiveRecord::Migration
end
add_index :pool_versions, :pool_id
add_index :pool_versions, :updater_id
add_index :pool_versions, :updater_ip_addr
end
def down