diff options
author | Francis Irving <francis@mysociety.org> | 2009-10-30 19:00:18 +0000 |
---|---|---|
committer | Francis Irving <francis@mysociety.org> | 2009-10-30 19:00:18 +0000 |
commit | f860c6acd6075dca17200ed75b223842e932ae43 (patch) | |
tree | d92d70edc5ce9b12fbbb30ebd2f35ccb4e404031 /db | |
parent | b8c3a21fe41d0916dcce190fbce1fd6183d4d5e5 (diff) |
Migrate to using a binary database field for storing raw emails, rather than text.
Does it gradually, so existing column is left alone to speed things up.
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/082_change_raw_email_to_binary.rb | 15 | ||||
-rw-r--r-- | db/schema.rb | 13 |
2 files changed, 22 insertions, 6 deletions
diff --git a/db/migrate/082_change_raw_email_to_binary.rb b/db/migrate/082_change_raw_email_to_binary.rb new file mode 100644 index 000000000..2bcceee88 --- /dev/null +++ b/db/migrate/082_change_raw_email_to_binary.rb @@ -0,0 +1,15 @@ +class ChangeRawEmailToBinary < ActiveRecord::Migration + def self.up + change_column :raw_emails, :data, :binary, :null => true + rename_column(:raw_emails, :data, :data_text) + add_column :raw_emails, :data_binary, :binary + end + + def self.down + raise "safer not to have reverse migration scripts, and we never use them" + end +end + + + + diff --git a/db/schema.rb b/db/schema.rb index 50adde788..c0782ac1d 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -9,7 +9,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 81) do +ActiveRecord::Schema.define(:version => 82) do create_table "acts_as_xapian_jobs", :force => true do |t| t.string "model", :null => false @@ -193,17 +193,18 @@ ActiveRecord::Schema.define(:version => 81) do end create_table "raw_emails", :force => true do |t| - t.text "data", :null => false + t.text "data_text" + t.binary "data_binary" end create_table "track_things", :force => true do |t| - t.integer "tracking_user_id", :null => false - t.string "track_query", :null => false + t.integer "tracking_user_id", :null => false + t.string "track_query", :null => false t.integer "info_request_id" t.integer "tracked_user_id" t.integer "public_body_id" - t.string "track_medium", :null => false - t.string "track_type", :null => false + t.string "track_medium", :null => false + t.string "track_type", :default => "internal_error", :null => false t.datetime "created_at" t.datetime "updated_at" end |