Skip to content

Conversation

tlsharkie
Copy link

Updated player deletion code in server/player.lua to accommodate tables that do not use the column name citizenid.
Many scripts use other column names to store the citizenid but contain data that should be deleted upon character deletion. This leads to excess data build up in the database that is no longer needed and currently requires manual effort to clean out the database.

New format for playertables now contains table and key variables (primary key column name)
and updated SQL commands in DeleteCharacter and ForceDeleteCharacter to handle variable column names

--- 'table' is the new SQL table name
--- 'key' is the column name which contains the 'citizenid'
{ table = 'players', key = 'citizenid' } 

Checklist

  • I have personally loaded this code into an updated qbcore project and checked all of its functionality.
  • My code fits the style guidelines.
  • My PR fits the contribution guidelines.

Updated `Delete character` code to handle database tables where primary key is not `citizenid`

Changed `playertables` format to handle any primary key

Updated `DeleteCharater()` and `ForceDeleteCharater()` SQL commands
…e column name citizenid

Updated player deletion code in server/player.lua to accommodate tables that do not use the column name citizenid
Many scripts use other column names to store the citizenid but contain data that should be deleted upon character deletion. This leads to excess data build up in the database that is no longer needed and currently requires manual effort to clean out the database.
Copy link

This PR has had 60 days of inactivity & will close within 7 days

@github-actions github-actions bot added the Stale label May 14, 2025
Copy link
Author

@tlsharkie tlsharkie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed trailing whitespaces

Copy link
Author

@tlsharkie tlsharkie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed trailing whitespaces from functions.lua to pass lint tests

tlsharkie added 2 commits May 14, 2025 10:59
Removed trailing whitespace to pass lint tests
@tlsharkie
Copy link
Author

updated code and removed trailing whitespaces to pass lint tests

@github-actions github-actions bot removed the Stale label May 15, 2025
@GhzGarage
Copy link
Member

This includes tables that do not exist in qbcore

Copy link
Contributor

@Z3rio Z3rio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good to me, just some tables that shouldnt be there, otherwise I'd be fine to approve this :)

Comment on lines +554 to +565
{ table = 'bank_cards', key = 'identifier' },
{ table = 'bank_history', key = 'identifier' },
{ table = 'casino_players', key = 'identifier' },
{ table = 'cd_garage_privategarage', key = 'identifier' },
{ table = 'inventory_clothes', key = 'identifier' },
{ table = 'lation_detecting', key = 'identifier' },
{ table = 'm_hunting', key = 'identifier' },

--Tables with other citizenid labels
{ table = 'bank_process', key = 'owner' },
{ table = 'mail_accounts', key = 'owner' },
{ table = 'lation_chopshop', key = 'player_identifier' },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None of these exist on a normal/default qbcore server.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am fine with you remvoving the non-qbcore tables from the official push.
Please use the addtional tables as a reference for how to use the new format.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am fine with you remvoving the non-qbcore tables from the official push. Please use the addtional tables as a reference for how to use the new format.

This is your PR, so I cant remove them for you. Sorry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants