Data Explorer has become more and more useful as part of a Plugin workflow, but:
How do we reliably but tolerantly add Data Explorer queries from a third party plugin so we can fail gracefully without jeopardising the build but also retry each time in case Data Explorer is eventually installed?
Options I’ve explored:
Poll Plugin: this cheats - the queries are added by the Data Explorer plugin itself
Plugin fixtures - this appears to be problematic because the Data Explorer artifacts don’t seem to be guaranteed to be available during plugin initialisation - perhaps because the Data Explorer plugin is itself a third party plugin and not guaranteed to have been loaded? I guess I could try to use SQL via Ruby code to identify if the table exists?
Migrations - I’ve written migrations but they need to harmlessly fail BUT NOT COMPLETE if Data Explorer plugin is not installed and there is no query table - the migrations should always run on rebuild until the Data Explorer plugin is installed and the table available so the queries can be added - that way from an admin point of view the solution is flexible and not depend on installation order. A failing migration should not jeopardise the build - is there a way to fail/put off a migration without stopping the build?
Using a periodic scheduled job to check presence of both the data explorer plugin/query table and the required queies.
Asking the admin to manually add them … yuk.
I guess I may try the SQL version of 2 next or maybe I’m missing something?
You could have a job that runs to check that they are installed. It wouldn’t start until everything’s running.
But to make sure stuff isn’t broken you can check that some data explorer call is available. I think that’s what I’m doing for subscriptions, maybe. (It’s early and I haven’t opened my laptop.)
They added code last week that checks whether the chat plugin is loaded.
I like the enqueue on initialisation idea. That potentially overcomes the loading issue. I prefer that to the once every 24 hour option. Might give that a go! Thanks!
I think just putting your test somewhere that it gets rescued if it fails is all you need. But can’t you just test to see if something like DataExplorer.something exists?
I do not know enough about using migrations to have considered using them for your use case. You could also have an endpoint that, say, the admin panel called, and it would check that you have your queries installed.
Now that I’m thinking, I am afraid the only problem I actually solved is adding the other plugin so that tests can work.