Increase maximum username length to 30

I'm writing some code for default NeoPass usernames, and they can get
kinda long, so I want to clear some extra space for them!
This commit is contained in:
Emi Matchu 2024-04-01 05:47:00 -07:00
parent 2e3cfd7cd1
commit b03d9b264a
5 changed files with 32 additions and 5 deletions

View file

@ -6,7 +6,7 @@ class AuthUser < AuthRecord
omniauth_providers: [:neopass]
validates :name, presence: true, uniqueness: {case_sensitive: false},
length: {maximum: 20}
length: {maximum: 30}
has_one :user, foreign_key: :remote_id, inverse_of: :auth_user

View file

@ -0,0 +1,13 @@
class IncreaseUsernameLength < ActiveRecord::Migration[7.1]
def change
# NOTE: This is paired with a migration to the `openneo_id` database, too!
reversible do |direction|
direction.up {
change_column :users, :name, :string, limit: 30, null: false
}
direction.down {
change_column :users, :name, :string, limit: 20, null: false
}
end
end
end

View file

@ -0,0 +1,14 @@
class IncreaseUsernameLength < ActiveRecord::Migration[7.1]
def change
# NOTE: This is paired with a migration to the `openneo_impress` database,
# too!
reversible do |direction|
direction.up {
change_column :users, :name, :string, limit: 30, null: false
}
direction.down {
change_column :users, :name, :string, limit: 20, null: false
}
end
end
end

View file

@ -10,9 +10,9 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.1].define(version: 2024_03_15_020053) do
ActiveRecord::Schema[7.1].define(version: 2024_04_01_124406) do
create_table "users", id: { type: :integer, unsigned: true }, charset: "utf8mb3", collation: "utf8mb3_general_ci", force: :cascade do |t|
t.string "name", limit: 20, null: false
t.string "name", limit: 30, null: false
t.string "encrypted_password", limit: 64
t.string "email", limit: 50
t.string "password_salt", limit: 32

View file

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.1].define(version: 2024_03_23_234243) do
ActiveRecord::Schema[7.1].define(version: 2024_04_01_124200) do
create_table "alt_styles", charset: "utf8mb4", collation: "utf8mb4_unicode_520_ci", force: :cascade do |t|
t.integer "species_id", null: false
t.integer "color_id", null: false
@ -254,7 +254,7 @@ ActiveRecord::Schema[7.1].define(version: 2024_03_23_234243) do
end
create_table "users", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_520_ci", force: :cascade do |t|
t.string "name", limit: 20, null: false
t.string "name", limit: 30, null: false
t.integer "auth_server_id", limit: 1, null: false
t.integer "remote_id", null: false
t.integer "points", default: 0, null: false