Class: CreateKeyValuesTable

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

Class Method Summary collapse

Class Method Details

.downObject



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

def self.down
  drop_table :key_values
end

.upObject



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

def self.up
  create_table :key_values do |t|
    t.string :key, :null => false
    t.binary :value, :null => false
    t.datetime :expires_at, :null => true
    t.timestamps :null => false
  end

  add_index :key_values, :key, :unique => true
  add_index :key_values, :expires_at

  change_column :key_values, :id, "bigint(20) NOT NULL AUTO_INCREMENT"
end