summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20150204041713_create_agents.rb9
-rw-r--r--db/migrate/20150204042612_add_agent_id_to_events.rb5
-rw-r--r--db/schema.rb11
3 files changed, 24 insertions, 1 deletions
diff --git a/db/migrate/20150204041713_create_agents.rb b/db/migrate/20150204041713_create_agents.rb
new file mode 100644
index 0000000..151d745
--- /dev/null
+++ b/db/migrate/20150204041713_create_agents.rb
@@ -0,0 +1,9 @@
+class CreateAgents < ActiveRecord::Migration
+ def change
+ create_table :agents, id: :uuid, default: 'uuid_generate_v4()' do |t|
+ t.string :hostname
+
+ t.timestamps null: false
+ end
+ end
+end
diff --git a/db/migrate/20150204042612_add_agent_id_to_events.rb b/db/migrate/20150204042612_add_agent_id_to_events.rb
new file mode 100644
index 0000000..40b4125
--- /dev/null
+++ b/db/migrate/20150204042612_add_agent_id_to_events.rb
@@ -0,0 +1,5 @@
+class AddAgentIdToEvents < ActiveRecord::Migration
+ def change
+ add_reference :events, :agent, index: true
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 1c756d5..1011d84 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,12 +11,18 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20150204033540) do
+ActiveRecord::Schema.define(version: 20150204042612) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
enable_extension "uuid-ossp"
+ create_table "agents", id: :uuid, default: "uuid_generate_v4()", force: :cascade do |t|
+ t.string "hostname"
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ end
+
create_table "dispositions", id: :uuid, default: "uuid_generate_v4()", force: :cascade do |t|
t.string "fingerprint"
t.integer "state"
@@ -29,6 +35,9 @@ ActiveRecord::Schema.define(version: 20150204033540) do
t.json "data"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
+ t.integer "agent_id"
end
+ add_index "events", ["agent_id"], name: "index_events_on_agent_id", using: :btree
+
end