diff --git a/test_app/db/migrate/20110201164012_create_impressions_table.rb b/test_app/db/migrate/20110201164012_create_impressions_table.rb deleted file mode 100644 index c2b4533..0000000 --- a/test_app/db/migrate/20110201164012_create_impressions_table.rb +++ /dev/null @@ -1,20 +0,0 @@ -class CreateImpressionsTable < ActiveRecord::Migration - def self.up - create_table :impressions, :force => true do |t| - t.string :impressionable_type - t.integer :impressionable_id - t.integer :user_id - t.string :controller_name - t.string :action_name - t.string :view_name - t.string :request_hash - t.string :ip_address - t.string :message - t.timestamps - end - end - - def self.down - drop_table :impressions - end -end \ No newline at end of file diff --git a/test_app/db/migrate/20110212032114_create_impressions_table.rb b/test_app/db/migrate/20110212032114_create_impressions_table.rb new file mode 100644 index 0000000..751b536 --- /dev/null +++ b/test_app/db/migrate/20110212032114_create_impressions_table.rb @@ -0,0 +1,27 @@ +class CreateImpressionsTable < ActiveRecord::Migration + def self.up + create_table :impressions, :force => true do |t| + t.string :impressionable_type + t.integer :impressionable_id + t.integer :user_id + t.string :controller_name + t.string :action_name + t.string :view_name + t.string :request_hash + t.string :ip_address + t.string :message + t.timestamps + end + add_index :impressions, [:impressionable_type, :impressionable_id, :request_hash, :ip_address], :name => "poly_index", :unique => false + add_index :impressions, [:controller_name,:action_name,:request_hash,:ip_address], :name => "controlleraction_index", :unique => false + add_index :impressions, :user_id + end + + def self.down + remove_index :impressions, :name => :poly_index + remove_index :impressions, :name => :controlleraction_index + remove_index :impressions, :user_id + + drop_table :impressions + end +end \ No newline at end of file diff --git a/test_app/db/schema.rb b/test_app/db/schema.rb index 05581aa..caf8529 100644 --- a/test_app/db/schema.rb +++ b/test_app/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20110210205028) do +ActiveRecord::Schema.define(:version => 20110212032114) do create_table "articles", :force => true do |t| t.string "name" @@ -32,6 +32,10 @@ ActiveRecord::Schema.define(:version => 20110210205028) do t.datetime "updated_at" end + add_index "impressions", ["controller_name", "action_name", "request_hash", "ip_address"], :name => "controlleraction_index" + add_index "impressions", ["impressionable_type", "impressionable_id", "request_hash", "ip_address"], :name => "poly_index" + add_index "impressions", ["user_id"], :name => "index_impressions_on_user_id" + create_table "posts", :force => true do |t| t.string "name" t.datetime "created_at"