joplin icon indicating copy to clipboard operation
joplin copied to clipboard

Question: best way to use more than 1 data store in a migration?

Open michaelklishin opened this issue 10 years ago • 6 comments

I'd like to write a migration that loads data from PG and indexes it with ES. What's the recommended way of doing that with Joplin?

michaelklishin avatar Feb 10 '15 20:02 michaelklishin

I would use a ES seed function for this.

If you need specific mappings in the ES index I'd do that in a migrator.

If this is something you want to do repeatedly, I'd make the seed function idempotent and add it to a cron job.

On 10 Feb 2015, at 20:09, Michael Klishin [email protected] wrote:

I'd like to write a migration that loads data from PG and indexes it with ES. What's the recommended way of doing that with Joplin?

— Reply to this email directly or view it on GitHub.

martintrojer avatar Feb 10 '15 21:02 martintrojer

Seeds are not an option: we'd like to not have any seeds in production. What's the best way to access connection info of other data stores from a migrator?

michaelklishin avatar Feb 11 '15 04:02 michaelklishin

I see your problem, even with seeds there is no way of getting the target map for the other db/migrator combinations in that environment.

One potential fix is to pass the joplin "conf" map through to the core multi-methods which would allow you to call joplin.main/get-targets to extract the info.

martintrojer avatar Feb 11 '15 08:02 martintrojer

@martintrojer ok, I'll have a look.

michaelklishin avatar Feb 11 '15 08:02 michaelklishin

@martintrojer should conf then be the 2nd (optional) argument the up and down functions accept?

michaelklishin avatar Feb 13 '15 09:02 michaelklishin

sounds reasonable, please add it to args of the seed functions aswell.

martintrojer avatar Feb 13 '15 09:02 martintrojer