AddCharacterForeignKeysToCharacterPermissions object
Object table AddCharacterForeignKeysToCharacterPermissions in plugin/migrations/20261025130100_add_character_foreign_keys_to_character_permissions.lua
Part of Admin Mod
Migration that adds foreign keys with ON DELETE CASCADE from the character_id column of
the character_permissions and character_temp_permissions tables to characters, so
that the database deletes the permissions of a character together with it, also when the
character is deleted along with its user rather than by the plugin. The rows that belong
to characters that do not exist are deleted first.
The admin plugin also runs without the Characters plugin, so the foreign keys are only
added if the characters table exists when the migration runs. Without them, the plugin
still deletes the permissions of a character that a player deletes.
Summary
Methods
AddCharacterForeignKeysToCharacterPermissions:down()
shared plugins/admin/plugin/migrations/20261025130100_add_character_foreign_keys_to_character_permissions.lua:27Removes the foreign keys, if they were added.
AddCharacterForeignKeysToCharacterPermissions:up()
shared plugins/admin/plugin/migrations/20261025130100_add_character_foreign_keys_to_character_permissions.lua:17Deletes the permissions of characters that do not exist and adds the foreign keys, if the characters table exists.