about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--app/models/invite.rb2
-rw-r--r--app/models/web/setting.rb2
-rw-r--r--db/migrate/20180206000000_change_user_id_nonnullable.rb6
-rw-r--r--db/schema.rb6
4 files changed, 11 insertions, 5 deletions
diff --git a/app/models/invite.rb b/app/models/invite.rb
index b87a3b722..4ba5432d2 100644
--- a/app/models/invite.rb
+++ b/app/models/invite.rb
@@ -4,7 +4,7 @@
 # Table name: invites
 #
 #  id         :integer          not null, primary key
-#  user_id    :integer
+#  user_id    :integer          not null
 #  code       :string           default(""), not null
 #  expires_at :datetime
 #  max_uses   :integer
diff --git a/app/models/web/setting.rb b/app/models/web/setting.rb
index 12b9d1226..0a5129d17 100644
--- a/app/models/web/setting.rb
+++ b/app/models/web/setting.rb
@@ -7,7 +7,7 @@
 #  data       :json
 #  created_at :datetime         not null
 #  updated_at :datetime         not null
-#  user_id    :integer
+#  user_id    :integer          not null
 #
 
 class Web::Setting < ApplicationRecord
diff --git a/db/migrate/20180206000000_change_user_id_nonnullable.rb b/db/migrate/20180206000000_change_user_id_nonnullable.rb
new file mode 100644
index 000000000..4eecb6154
--- /dev/null
+++ b/db/migrate/20180206000000_change_user_id_nonnullable.rb
@@ -0,0 +1,6 @@
+class ChangeUserIdNonnullable < ActiveRecord::Migration[5.1]
+  def change
+    change_column_null :invites, :user_id, false
+    change_column_null :web_settings, :user_id, false
+  end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 02e84cbd1..281110124 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: 20180204034416) do
+ActiveRecord::Schema.define(version: 20180206000000) do
 
   # These are extensions that must be enabled in order to support this database
   enable_extension "plpgsql"
@@ -195,7 +195,7 @@ ActiveRecord::Schema.define(version: 20180204034416) do
   end
 
   create_table "invites", force: :cascade do |t|
-    t.bigint "user_id"
+    t.bigint "user_id", null: false
     t.string "code", default: "", null: false
     t.datetime "expires_at"
     t.integer "max_uses"
@@ -516,7 +516,7 @@ ActiveRecord::Schema.define(version: 20180204034416) do
     t.json "data"
     t.datetime "created_at", null: false
     t.datetime "updated_at", null: false
-    t.bigint "user_id"
+    t.bigint "user_id", null: false
     t.index ["user_id"], name: "index_web_settings_on_user_id", unique: true
   end