mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 03:08:55 -05:00
* PostgreSQL driver and general drivers cleanup Signed-off-by: Toby Harradine <tobyharradine@gmail.com> * Make tests pass Signed-off-by: Toby Harradine <tobyharradine@gmail.com> * Add black --target-version flag in make.bat Signed-off-by: Toby Harradine <tobyharradine@gmail.com> * Rewrite postgres driver Most of the logic is now in PL/pgSQL. This completely avoids the use of Python f-strings to format identifiers into queries. Although an SQL-injection attack would have been impossible anyway (only the owner would have ever had the ability to do that), using PostgreSQL's format() is more reliable for unusual identifiers. Performance-wise, I'm not sure whether this is an improvement, but I highly doubt that it's worse. Signed-off-by: Toby Harradine <tobyharradine@gmail.com> * Reformat Signed-off-by: Toby Harradine <tobyharradine@gmail.com> * Fix PostgresDriver.delete_all_data() Signed-off-by: Toby Harradine <tobyharradine@gmail.com> * Clean up PL/pgSQL code Signed-off-by: Toby Harradine <tobyharradine@gmail.com> * More PL/pgSQL cleanup Signed-off-by: Toby Harradine <tobyharradine@gmail.com> * PL/pgSQL function optimisations Signed-off-by: Toby Harradine <tobyharradine@gmail.com> * Ensure compatibility with PostgreSQL 10 and below Signed-off-by: Toby Harradine <tobyharradine@gmail.com> * More/better docstrings for PG functions Signed-off-by: Toby Harradine <tobyharradine@gmail.com> * Fix typo in docstring Signed-off-by: Toby Harradine <tobyharradine@gmail.com> * Return correct value on toggle() Signed-off-by: Toby Harradine <tobyharradine@gmail.com> * Use composite type for PG function parameters Signed-off-by: Toby Harradine <tobyharradine@gmail.com> * Fix JSON driver's Config.clear_all() Signed-off-by: Toby Harradine <tobyharradine@gmail.com> * Correct description for Mongo tox recipe Signed-off-by: Toby Harradine <tobyharradine@gmail.com> * Fix linting errors Signed-off-by: Toby Harradine <tobyharradine@gmail.com> * Update dep specification after merging bumpdeps Signed-off-by: Toby Harradine <tobyharradine@gmail.com> * Add towncrier entries Signed-off-by: Toby Harradine <tobyharradine@gmail.com> * Update from merge Signed-off-by: Toby Harradine <tobyharradine@gmail.com> * Mention [postgres] extra in install docs Signed-off-by: Toby Harradine <tobyharradine@gmail.com> * Support more connection options and use better defaults Signed-off-by: Toby Harradine <tobyharradine@gmail.com> * Actually pass PG env vars in tox Signed-off-by: Toby Harradine <tobyharradine@gmail.com> * Replace event trigger with manual DELETE queries Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
33 lines
1.9 KiB
ReStructuredText
33 lines
1.9 KiB
ReStructuredText
Changes to the ``redbot.core.drivers`` package:
|
|
|
|
- The modules inside the ``redbot.core.drivers`` package no longer have the ``red_`` prefix in front of their names.
|
|
- All driver classes are now directly accessible as attributes to the ``redbot.core.drivers`` package.
|
|
- :func:`get_driver`'s signature has been changed.
|
|
- :func:`get_driver` can now use data manager to infer the backend type if it is not supplied as an argument.
|
|
- :func:`get_driver_class` has been added.
|
|
|
|
Changes to the :class:`BaseDriver` and :class:`JsonDriver` classes class:
|
|
|
|
- :meth:`BaseDriver.get_config_details` is an now abstract staticmethod.
|
|
- :meth:`BaseDriver.initialize` and :meth:`BaseDriver.teardown` are two new abstract coroutine classmethods.
|
|
- :meth:`BaseDriver.delete_all_data` is a new concrete (but overrideable) coroutine instance method.
|
|
- :meth:`BaseDriver.aiter_cogs` is a new abstract asynchronous iterator method.
|
|
- :meth:`BaseDriver.migrate_to` is a new concrete coroutine classmethod.
|
|
- :class:`JsonDriver` no longer requires the data path when constructed and will infer the data path from data manager.
|
|
|
|
Changes to the :class:`IdentifierData` class and :class:`ConfigCategory` enum:
|
|
|
|
- ``IdentifierData.custom_group_data`` has been replaced by :attr:`IdentifierData.primary_key_len`.
|
|
- :meth:`ConfigCategory.get_pkey_info` is a new classmethod.
|
|
|
|
Changes to the migration and backup system:
|
|
|
|
- All code in the ``redbot.setup`` script, excluding that regarding MongoV1, is now virtually backend-agnostic.
|
|
- All code in the ``[p]backup`` is now backend-agnostic.
|
|
- :func:`redbot.core.config.migrate` is a new coroutine function.
|
|
- All a new driver needs to do now to be compatible with migrations and backups is to implement the :class:`BaseDriver` ABC.
|
|
|
|
Enhancements to unit tests:
|
|
|
|
- New tox recipes have been added for testing against Mongo and Postgres backends. See the ``tox.ini`` file for clues on how to run them.
|