diff --git a/app/models/auth_user.rb b/app/models/auth_user.rb index 5830abc5..6ed8f9d8 100644 --- a/app/models/auth_user.rb +++ b/app/models/auth_user.rb @@ -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 diff --git a/db/migrate/20240401124200_increase_username_length.rb b/db/migrate/20240401124200_increase_username_length.rb new file mode 100644 index 00000000..670649bd --- /dev/null +++ b/db/migrate/20240401124200_increase_username_length.rb @@ -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 diff --git a/db/openneo_id_migrate/20240401124406_increase_username_length.rb b/db/openneo_id_migrate/20240401124406_increase_username_length.rb new file mode 100644 index 00000000..200c233f --- /dev/null +++ b/db/openneo_id_migrate/20240401124406_increase_username_length.rb @@ -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 diff --git a/db/openneo_id_schema.rb b/db/openneo_id_schema.rb index 8df274bc..a125f4ec 100644 --- a/db/openneo_id_schema.rb +++ b/db/openneo_id_schema.rb @@ -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 diff --git a/db/schema.rb b/db/schema.rb index b0f54f46..ad386717 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[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