From 4480f59e6e359b32152022b2586b21a22209fedc Mon Sep 17 00:00:00 2001
From: Benjamin Neff <benjamin@coding4coffee.ch>
Date: Sat, 15 Oct 2016 21:04:51 +0200
Subject: [PATCH] Remove empty pod and make pod host NOT NULL

---
 db/migrate/20161015174300_remove_empty_pod.rb | 11 +++++++++++
 db/schema.rb                                  |  4 ++--
 2 files changed, 13 insertions(+), 2 deletions(-)
 create mode 100644 db/migrate/20161015174300_remove_empty_pod.rb

diff --git a/db/migrate/20161015174300_remove_empty_pod.rb b/db/migrate/20161015174300_remove_empty_pod.rb
new file mode 100644
index 0000000000..482b4f5db3
--- /dev/null
+++ b/db/migrate/20161015174300_remove_empty_pod.rb
@@ -0,0 +1,11 @@
+class RemoveEmptyPod < ActiveRecord::Migration
+  def up
+    Pod.delete_all("host IS NULL")
+
+    change_column :pods, :host, :string, null: false
+  end
+
+  def down
+    change_column :pods, :host, :string, null: true
+  end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 48a75a8648..c8f63ceb52 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: 20160906225138) do
+ActiveRecord::Schema.define(version: 20161015174300) do
 
   create_table "account_deletions", force: :cascade do |t|
     t.string   "diaspora_handle", limit: 255
@@ -358,7 +358,7 @@ ActiveRecord::Schema.define(version: 20160906225138) do
   add_index "photos", ["status_message_guid"], name: "index_photos_on_status_message_guid", length: {"status_message_guid"=>191}, using: :btree
 
   create_table "pods", force: :cascade do |t|
-    t.string   "host",          limit: 255
+    t.string   "host",          limit: 255,                                 null: false
     t.boolean  "ssl"
     t.datetime "created_at",                                                null: false
     t.datetime "updated_at",                                                null: false
-- 
GitLab