Class: CreateCache

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/templates/migration.rb

Class Method Summary collapse

Class Method Details

.downObject



16
17
18
# File 'lib/generators/templates/migration.rb', line 16

def self.down
  drop_table :cache
end

.upObject



2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/generators/templates/migration.rb', line 2

def self.up
  create_table :cache do |t|
    t.string   :key
    t.binary   :value
    t.decimal  :created_at, :precision => 15, :scale => 5
    t.decimal  :expires_at, :precision => 15, :scale => 5
    t.boolean  :is_compressed
  end
  
  add_index :cache, :key, :unique => true
  add_index :cache, :created_at
  add_index :cache, :expires_at
end