Class: CreateChawkBase

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

Overview

~~~- Created via -~~~

Instance Method Summary collapse

Instance Method Details

#downObject



50
51
52
53
54
55
56
# File 'lib/generators/chawk_rails/templates/migration.rb', line 50

def down
	drop_table "chawk_agents"
	drop_table "chawk_nodes"
	drop_table "chawk_points"
	drop_table "chawk_values"
	drop_table "chawk_relations"
end

#upObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/generators/chawk_rails/templates/migration.rb', line 4

def up
	create_table "chawk_agents", force: true do |t|
		t.integer "foreign_id"
		t.string  "name",       limit: 200
		t.timestamps
	end

	create_table "chawk_nodes", force: true do |t|
		t.string  "key",     		limit: 150
		t.text  "decription"
		t.boolean "public_read",              default: false
		t.boolean "public_write",             default: false
	end

	create_table "chawk_points", force: true do |t|
		t.float    "observed_at"
		t.datetime "recorded_at"
		t.text     "meta"
		t.integer  "value"
		t.integer  "node_id",     null: false
	end

	add_index "chawk_points", ["node_id"], name: "index_chawk_points_node", using: :btree

	create_table "chawk_values", force: true do |t|
		t.float    "observed_at"
		t.datetime "recorded_at"
		t.text     "meta"
		t.text     "value"
		t.integer  "node_id",     null: false
	end

	add_index "chawk_values", ["node_id"], name: "index_chawk_values_node", using: :btree

	create_table "chawk_relations", force: true do |t|
		t.boolean "admin",    default: false
		t.boolean "read",     default: false
		t.boolean "write",    default: false
		t.integer "agent_id",                 null: false
		t.integer "node_id",                  null: false
	end

	add_index "chawk_relations", ["agent_id"], name: "index_chawk_relations_agent", using: :btree
	add_index "chawk_relations", ["node_id"], name: "index_chawk_relations_node", using: :btree
end