From 862ee9fa2efd42bc3f93ba6c432435b255c3499a Mon Sep 17 00:00:00 2001 From: Georg Hopp Date: Fri, 6 May 2016 09:04:29 +0200 Subject: [PATCH] Add reference to used certificate to host. --- db/migrate/20160506065802_add_certificate_to_hosts.rb | 5 +++++ db/schema.rb | 9 ++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 db/migrate/20160506065802_add_certificate_to_hosts.rb diff --git a/db/migrate/20160506065802_add_certificate_to_hosts.rb b/db/migrate/20160506065802_add_certificate_to_hosts.rb new file mode 100644 index 0000000..2333676 --- /dev/null +++ b/db/migrate/20160506065802_add_certificate_to_hosts.rb @@ -0,0 +1,5 @@ +class AddCertificateToHosts < ActiveRecord::Migration + def change + add_reference :hosts, :certificate, index: true, foreign_key: true + end +end diff --git a/db/schema.rb b/db/schema.rb index bba22cb..ef8be17 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20160428191808) do +ActiveRecord::Schema.define(version: 20160506065802) do create_table "certificates", force: :cascade do |t| t.text "key" @@ -24,8 +24,11 @@ ActiveRecord::Schema.define(version: 20160428191808) do create_table "hosts", force: :cascade do |t| t.string "name" t.string "uri" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "certificate_id" end + add_index "hosts", ["certificate_id"], name: "index_hosts_on_certificate_id" + end