br41nslug / directus-extension-randomized

An extension to get randomized results from directus.
MIT License
16 stars 5 forks source link

v11, long term. Compatibility with future versions #5

Open kuncevic opened 1 day ago

kuncevic commented 1 day ago

Thank you for great extension ⭐

This is more a question rather than an issue.

As it seems, this extension was created as a follow-up to this discussion. The current major version of Directus is 11 tho as per documentation tested with Directus 10.10.4.

I wonder if this extension has been battle-tested with v11 and if it is safe to rely on that going forward, as it seems there is still no native functionality like that.

br41nslug commented 9 hours ago

I havent personally tested the extension with v11 yet however it should work 🤔 None of the functionalities this extension relies on have been changed since 10.10 afaik

kuncevic commented 8 hours ago

@br41nslug yeah I see, what do you think, are there any chances similar functionality will land in directus sometime in the future?

br41nslug commented 8 hours ago

I somewhat doubt it considering the "best" (most performant) way to implement this is on the SQL level like (in postgres):

SELECT *
FROM my_collection
ORDER BY RANDOM();

But I am not sure this is consistently supported for all database providers supported by Directus.

kuncevic commented 8 hours ago

@br41nslug does directus support running queries like that natively?

br41nslug commented 8 hours ago

You can from within backend extensions like this, but when using raw SQL you'll have to be sure of the underlying database compatibility if you'd want to distribute that extension

kuncevic commented 7 hours ago

just dig a bit deeper https://github.com/directus/directus/discussions/12452 tho this is the best pointer I've found so far https://github.com/directus/directus/discussions/3312