about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAkihiko Odaki <akihiko.odaki.4i@stu.hosei.ac.jp>2017-12-12 12:11:17 +0900
committerEugen Rochko <eugen@zeonfederated.com>2017-12-12 04:11:17 +0100
commit14c4a33cd9bfc1212cb362897272e5ea7d1529e5 (patch)
tree0b28579dfb137e529c7f7c962236941b3e341b22
parent30d2ea03b05ed3efb4ad8f21cab343108d3699ac (diff)
Change account_id non-nullable in lists (#5979)
-rw-r--r--app/models/list.rb2
-rw-r--r--db/migrate/20171201000000_change_account_id_nonnullable_in_lists.rb7
-rw-r--r--db/schema.rb4
3 files changed, 10 insertions, 3 deletions
diff --git a/app/models/list.rb b/app/models/list.rb
index f45e4973d..be85c3b87 100644
--- a/app/models/list.rb
+++ b/app/models/list.rb
@@ -4,7 +4,7 @@
 # Table name: lists
 #
 #  id         :integer          not null, primary key
-#  account_id :integer
+#  account_id :integer          not null
 #  title      :string           default(""), not null
 #  created_at :datetime         not null
 #  updated_at :datetime         not null
diff --git a/db/migrate/20171201000000_change_account_id_nonnullable_in_lists.rb b/db/migrate/20171201000000_change_account_id_nonnullable_in_lists.rb
new file mode 100644
index 000000000..120f74402
--- /dev/null
+++ b/db/migrate/20171201000000_change_account_id_nonnullable_in_lists.rb
@@ -0,0 +1,7 @@
+require Rails.root.join('lib', 'mastodon', 'migration_helpers')
+
+class ChangeAccountIdNonnullableInLists < ActiveRecord::Migration[5.1]
+  def change
+    change_column_null :lists, :account_id, false
+  end
+end
diff --git a/db/schema.rb b/db/schema.rb
index cf0deb826..7887f26a2 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: 20171130000000) do
+ActiveRecord::Schema.define(version: 20171201000000) do
 
   # These are extensions that must be enabled in order to support this database
   enable_extension "plpgsql"
@@ -209,7 +209,7 @@ ActiveRecord::Schema.define(version: 20171130000000) do
   end
 
   create_table "lists", force: :cascade do |t|
-    t.bigint "account_id"
+    t.bigint "account_id", null: false
     t.string "title", default: "", null: false
     t.datetime "created_at", null: false
     t.datetime "updated_at", null: false