DB: Replace `NULL` boolean values with `FALSE` in Monsterpit feature columns; add `vars` column for persistent bangtag variable storage.
parent
b8b525c54a
commit
f7c5171a83
|
@ -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 = []
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class AddVarsToAccounts < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :accounts, :vars, :jsonb
|
||||
end
|
||||
end
|
|
@ -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
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue