Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Redis database driver #970

fabiante started this conversation in Ideas
Discussion options

Hi everyone!

Context

I have developed a rather small application which I did not want to use a full relational database for. Instead I went with using Redis. The service I work on stores user data and technical configuration objects. In my case this data does not often require structural changes due to changes in my applications code. But still I'd like to have the benefit of a proper migration framework such as migrate.

Therefore I want to discuss implementing support for Redis as database driver. I am in fact already experimenting with this in my local project and could post updates if there is interest in this.

Idea

The general idea is to implement the Driver interface based on a Redis API client. I currently use github.com/go-redis/redis.

type Driver interface {

Most functions defined by the interface are rather simple to implement, using 2 or 3 keys to manage the migration state (version and dirty flag) and the migration lock.

What I am currently wondering about is what the actual migrations could look like. Generally it is possible to send raw redis commands via Client.Do. This can be used to store redis commands as migration files.

For more complex use cases this may not be enough. If for example I wanted to load every key resembling some user object and then would want to change it based on some criteria, then this would require the ability to include some logic into the migrations. Maybe Lua scripting is suitable for that. I have not yet looked at this further but having a look at the mongodb driver is probably also worth a look.

What do you think? I am sure there are lots of ways to migrate data persisted in non-relational databases which I'd also like to discuss.

You must be logged in to vote

Replies: 0 comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
1 participant

AltStyle によって変換されたページ (->オリジナル) /