aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/generators/active_record/session_migration/templates/migration.rb
blob: 19811d945512470cea0a00c3a290fe6590609b8b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
class <%= @migration_class_name %> < ActiveRecord::Migration
  def self.up
    create_table :<%= session_table_name %> do |t|
      t.string :session_id, :null => false
      t.text :data
      t.timestamps
    end

    add_index :<%= session_table_name %>, :session_id
    add_index :<%= session_table_name %>, :updated_at
  end

  def self.down
    drop_table :<%= session_table_name %>
  end
end