trotto/go-links

Migration of older data

Closed this issue · 1 comments

Is there any documented way of migrating old data from some other golinks solution (given base data such as creator, shortened url and target) to a new db ?

Maybe a dev API I am missing?

A possible workaround I came up with to do that directly from the code, by running something like that:

/usr/src/app/server/src# FLASK_APP=main.py flask shell

This will open a flask shell:

Instance: /usr/src/app/server/src/instance
>>>

At which point it would be possible to basically trigger directly the API using plain python:

Instance: /usr/src/app/server/src/instance
>>> from modules.links import helpers
>>> helpers.create_short_link('1.com', 'kay@g.com', 'go', 'drive', 'drive1000.com')
>>> helpers.create_short_link('1.com', 'kay@g.com', 'go', 'drive2', 'drive2000.com')

And so the path to migration can just be a series of create_short_link invocations.

Maybe there is a better way, but this worked as a patch for us.