Class: CreateChronicTreeElements

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

Instance Method Summary collapse

Instance Method Details

#changeObject



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

def change
  create_table :chronic_tree_elements do |t|
    t.string :tree_type, not_null: true
    t.integer :parent_id, not_null: true
    t.integer :child_id, not_null: true
    t.integer :root_id, not_null: true
    t.integer :distance, not_null: true
    t.datetime :start_time, not_null: true
    t.datetime :end_time, not_null: true
    t.string :scope_name, not_null: true
    t.integer :position

    t.index :tree_type
    t.index :parent_id
    t.index :child_id
    t.index :root_id
    t.index [:start_time, :end_time]
    t.index :scope_name
  end
end