diff options
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20201006140511_create_resources.rb | 13 | ||||
-rw-r--r-- | db/schema.rb | 10 |
2 files changed, 22 insertions, 1 deletions
diff --git a/db/migrate/20201006140511_create_resources.rb b/db/migrate/20201006140511_create_resources.rb new file mode 100644 index 0000000..761d5bc --- /dev/null +++ b/db/migrate/20201006140511_create_resources.rb @@ -0,0 +1,13 @@ +class CreateResources < ActiveRecord::Migration[6.0] + def change + create_table :resources do |t| + t.uuid :uuid + t.jsonb :feature + t.references :agent, null: false, foreign_key: true + + t.timestamps + end + add_index :resources, [:uuid], unique: true + add_index :resources, [:agent_id] + end +end diff --git a/db/schema.rb b/db/schema.rb index ef4f4cd..8433cd9 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2020_10_05_155004) do +ActiveRecord::Schema.define(version: 2020_10_06_140511) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -34,6 +34,14 @@ ActiveRecord::Schema.define(version: 2020_10_05_155004) do t.index ["uuid"], name: "index_agents_on_uuid", unique: true end + create_table "resources", force: :cascade do |t| + t.uuid "uuid" + t.jsonb "feature" + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + t.index ["uuid"], name: "index_resources_on_uuid", unique: true + end + create_table "users", force: :cascade do |t| t.string "name" t.string "username" |