* Denormalized post versions. Testing has shown it reduces the size

of the table 66%.
This commit is contained in:
albert
2010-11-04 18:17:03 -04:00
parent d0d3487fc8
commit 551c25909c
9 changed files with 157 additions and 114 deletions

View File

@@ -0,0 +1,16 @@
class CreatePostHistories < ActiveRecord::Migration
def self.up
create_table :post_histories do |t|
t.timestamps
t.column :post_id, :integer, :null => false
t.column :revisions, :text, :null => false
end
add_index :post_histories, :post_id
end
def self.down
drop_table :post_histories
end
end

View File

@@ -1,26 +0,0 @@
class CreatePostVersions < ActiveRecord::Migration
def self.up
create_table :post_versions do |t|
t.timestamps
# Post
t.column :post_id, :integer, :null => false
# Versioned
t.column :source, :string
t.column :rating, :character, :null => false, :default => 'q'
t.column :tag_string, :text, :null => false
# Updater
t.column :updater_id, :integer, :null => false
t.column :updater_ip_addr, "inet", :null => false
end
add_index :post_versions, :post_id
add_index :post_versions, :updater_id
end
def self.down
drop_table :post_versions
end
end