mirror of
https://github.com/mastodon/mastodon.git
synced 2025-05-13 05:01:10 +00:00
Add id_scheme
attribute to Account
This commit is contained in:
parent
fc04c80bb6
commit
6e330d2b2a
|
@ -51,6 +51,7 @@
|
||||||
# requested_review_at :datetime
|
# requested_review_at :datetime
|
||||||
# indexable :boolean default(FALSE), not null
|
# indexable :boolean default(FALSE), not null
|
||||||
# attribution_domains :string default([]), is an Array
|
# attribution_domains :string default([]), is an Array
|
||||||
|
# id_scheme :integer default("username_ap_id")
|
||||||
#
|
#
|
||||||
|
|
||||||
class Account < ApplicationRecord
|
class Account < ApplicationRecord
|
||||||
|
@ -102,6 +103,7 @@ class Account < ApplicationRecord
|
||||||
|
|
||||||
enum :protocol, { ostatus: 0, activitypub: 1 }
|
enum :protocol, { ostatus: 0, activitypub: 1 }
|
||||||
enum :suspension_origin, { local: 0, remote: 1 }, prefix: true
|
enum :suspension_origin, { local: 0, remote: 1 }, prefix: true
|
||||||
|
enum :id_scheme, { username_ap_id: 0, numeric_ap_id: 1 }
|
||||||
|
|
||||||
validates :username, presence: true
|
validates :username, presence: true
|
||||||
validates_with UniqueUsernameValidator, if: -> { will_save_change_to_username? }
|
validates_with UniqueUsernameValidator, if: -> { will_save_change_to_username? }
|
||||||
|
@ -184,11 +186,6 @@ class Account < ApplicationRecord
|
||||||
|
|
||||||
update_index('accounts', :self)
|
update_index('accounts', :self)
|
||||||
|
|
||||||
def numeric_ap_id?
|
|
||||||
# TODO: this is a placeholder for now
|
|
||||||
false
|
|
||||||
end
|
|
||||||
|
|
||||||
def local?
|
def local?
|
||||||
domain.nil?
|
domain.nil?
|
||||||
end
|
end
|
||||||
|
|
7
db/migrate/20250331120259_add_id_scheme_to_accounts.rb
Normal file
7
db/migrate/20250331120259_add_id_scheme_to_accounts.rb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class AddIdSchemeToAccounts < ActiveRecord::Migration[8.0]
|
||||||
|
def change
|
||||||
|
add_column :accounts, :id_scheme, :integer, default: 0
|
||||||
|
end
|
||||||
|
end
|
|
@ -10,7 +10,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema[8.0].define(version: 2025_03_13_123400) do
|
ActiveRecord::Schema[8.0].define(version: 2025_03_31_120259) do
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "pg_catalog.plpgsql"
|
enable_extension "pg_catalog.plpgsql"
|
||||||
|
|
||||||
|
@ -198,6 +198,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_03_13_123400) do
|
||||||
t.datetime "requested_review_at", precision: nil
|
t.datetime "requested_review_at", precision: nil
|
||||||
t.boolean "indexable", default: false, null: false
|
t.boolean "indexable", default: false, null: false
|
||||||
t.string "attribution_domains", default: [], array: true
|
t.string "attribution_domains", default: [], array: true
|
||||||
|
t.integer "id_scheme", default: 0
|
||||||
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 "(((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), COALESCE(lower((domain)::text), ''::text)", name: "index_accounts_on_username_and_domain_lower", unique: true
|
t.index "lower((username)::text), COALESCE(lower((domain)::text), ''::text)", name: "index_accounts_on_username_and_domain_lower", unique: true
|
||||||
t.index ["domain", "id"], name: "index_accounts_on_domain_and_id"
|
t.index ["domain", "id"], name: "index_accounts_on_domain_and_id"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user