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