Class: CreateVestalVersions

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

Class Method Summary collapse

Class Method Details

.downObject



25
26
27
# File 'lib/generators/vestal_versions/migration/templates/migration.rb', line 25

def self.down
  drop_table :versions
end

.upObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/generators/vestal_versions/migration/templates/migration.rb', line 2

def self.up
  create_table :versions do |t|
    t.belongs_to :versioned, :polymorphic => true
    t.belongs_to :user, :polymorphic => true
    t.string  :user_name
    t.text    :modifications
    t.integer :number
    t.integer :reverted_from
    t.string  :tag

    t.timestamps
  end

  change_table :versions do |t|
    t.index [:versioned_id, :versioned_type]
    t.index [:user_id, :user_type]
    t.index :user_name
    t.index :number
    t.index :tag
    t.index :created_at
  end
end