about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--app/models/account.rb6
-rw-r--r--app/models/status.rb4
-rw-r--r--db/migrate/20190419040911_add_vars_to_accounts.rb5
-rw-r--r--db/migrate/20190419045308_monsterpit_remove_nulls.rb19
-rw-r--r--db/schema.rb6
5 files changed, 36 insertions, 4 deletions
diff --git a/app/models/account.rb b/app/models/account.rb
index a26276b9b..deeea2f58 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -46,6 +46,8 @@
 #  silenced_at             :datetime
 #  suspended_at            :datetime
 #  hidden                  :boolean
+#  hidden                  :boolean          default(FALSE), not null
+#  vars                    :jsonb            not null
 #
 
 class Account < ApplicationRecord
@@ -296,6 +298,10 @@ class Account < ApplicationRecord
     self.fields = tmp
   end
 
+  def vars
+    self[:vars]
+  end
+
   def magic_key
     modulus, exponent = [keypair.public_key.n, keypair.public_key.e].map do |component|
       result = []
diff --git a/app/models/status.rb b/app/models/status.rb
index 022296145..76923ab21 100644
--- a/app/models/status.rb
+++ b/app/models/status.rb
@@ -25,9 +25,9 @@
 #  poll_id                :bigint(8)
 #  content_type           :string
 #  tsv                    :tsvector
-#  curated                :boolean
+#  curated                :boolean          default(FALSE), not null
 #  sharekey               :string
-#  network                :boolean
+#  network                :boolean          default(FALSE), not null
 #
 
 class Status < ApplicationRecord
diff --git a/db/migrate/20190419040911_add_vars_to_accounts.rb b/db/migrate/20190419040911_add_vars_to_accounts.rb
new file mode 100644
index 000000000..86e64ba33
--- /dev/null
+++ b/db/migrate/20190419040911_add_vars_to_accounts.rb
@@ -0,0 +1,5 @@
+class AddVarsToAccounts < ActiveRecord::Migration[5.2]
+  def change
+    add_column :accounts, :vars, :jsonb
+  end
+end
diff --git a/db/migrate/20190419045308_monsterpit_remove_nulls.rb b/db/migrate/20190419045308_monsterpit_remove_nulls.rb
new file mode 100644
index 000000000..32701d58a
--- /dev/null
+++ b/db/migrate/20190419045308_monsterpit_remove_nulls.rb
@@ -0,0 +1,19 @@
+class MonsterpitRemoveNulls < ActiveRecord::Migration[5.2]
+  disable_ddl_transaction!
+
+  def change
+    safety_assured do
+      change_column_null :statuses, :curated, false, false
+      change_column_default :statuses, :curated, false
+
+      change_column_null :statuses, :network, false, false
+      change_column_default :statuses, :network, false
+
+      change_column_null :accounts, :hidden, false, false
+      change_column_default :accounts, :hidden, false
+
+      change_column_null :accounts, :vars, false, {}
+      change_column_default :accounts, :vars, {}
+    end
+  end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 8ef96aac1..e90f90307 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -149,6 +149,8 @@ ActiveRecord::Schema.define(version: 2019_05_19_130537) do
     t.datetime "silenced_at"
     t.datetime "suspended_at"
     t.boolean "hidden"
+    t.boolean "hidden", default: false, null: false
+    t.jsonb "vars", default: {}, null: false
     t.index "(((setweight(to_tsvector('simple'::regconfig, (display_name)::text), 'A'::\"char\") || setweight(to_tsvector('simple'::regconfig, (username)::text), 'B'::\"char\")) || setweight(to_tsvector('simple'::regconfig, (COALESCE(domain, ''::character varying))::text), 'C'::\"char\")))", name: "search_index", using: :gin
     t.index "lower((username)::text), lower((domain)::text)", name: "index_accounts_on_username_and_domain_lower", unique: true
     t.index ["moved_to_account_id"], name: "index_accounts_on_moved_to_account_id"
@@ -640,9 +642,9 @@ ActiveRecord::Schema.define(version: 2019_05_19_130537) do
     t.bigint "poll_id"
     t.string "content_type"
     t.tsvector "tsv"
-    t.boolean "curated"
+    t.boolean "curated", default: false, null: false
     t.string "sharekey"
-    t.boolean "network"
+    t.boolean "network", default: false, null: false
     t.index ["account_id", "id", "visibility", "updated_at"], name: "index_statuses_20180106", order: { id: :desc }
     t.index ["in_reply_to_account_id"], name: "index_statuses_on_in_reply_to_account_id"
     t.index ["in_reply_to_id"], name: "index_statuses_on_in_reply_to_id"