rename custom_name to username + fix audit logs

This commit is contained in:
ShyMike
2025-10-21 22:15:16 +01:00
parent 109ae988a0
commit a1bb20ab3f
9 changed files with 41 additions and 36 deletions

View File

@@ -0,0 +1,5 @@
class RenameCustomUsername < ActiveRecord::Migration[8.0]
def change
rename_column :users, :custom_name, :username
end
end

4
db/schema.rb generated
View File

@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[8.0].define(version: 2025_10_21_202329) do
ActiveRecord::Schema[8.0].define(version: 2025_10_21_211039) do
create_schema "pganalyze"
# These are extensions that must be enabled in order to support this database
@@ -562,7 +562,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_10_21_202329) do
t.boolean "allow_public_stats_lookup", default: true, null: false
t.boolean "default_timezone_leaderboard", default: true, null: false
t.integer "admin_level", default: 0, null: false
t.string "custom_name"
t.string "username"
t.index ["github_uid", "github_access_token"], name: "index_users_on_github_uid_and_access_token"
t.index ["github_uid"], name: "index_users_on_github_uid"
t.index ["slack_uid"], name: "index_users_on_slack_uid", unique: true

View File

@@ -14,7 +14,7 @@ Doorkeeper::Application.find_or_create_by(
if Rails.env.development?
# Creating test user
test_user = User.find_or_create_by(slack_uid: 'TEST123456') do |user|
user.custom_name = 'testuser'
user.username = 'testuser'
user.slack_username = 'testuser'
# Before you had user.is_admin = true, does not work, changed it to that, looks like it works but idk how to use the admin pages so pls check this, i just guess coded this, the cmd to seed the db works without errors