migrate icon indicating copy to clipboard operation
migrate copied to clipboard

Better implementation for mongodb.SetVersion

Open SinghCoder opened this issue 3 years ago • 2 comments

Is your feature request related to a problem? Please describe. Do we really need to drop the migrations collection everytime we want to set the version here, can't we just run an update call? This requires giving drop permissions to service which wants to run such migrations which I think is an unnecessary thing to do.

Describe the solution you'd like We can just run an update operation instead I propose.

migrationsCollection.UpdateOne(context.TODO(), bson.D{}, bson.M{"version": version, "dirty": dirty}

Describe alternatives you've considered

_

Additional context

_

SinghCoder avatar Jul 25 '22 16:07 SinghCoder

This requires giving drop permissions to service which wants to run such migrations which I think is an unnecessary thing to do.

Good point, but there's also the migrate drop command which will probably need drop permissions. Anyways, it makes sense to me if you didn't want to give migrate drop permissions. Feel free to open a PR with this change. You'll need to do an upsert.

dhui avatar Jul 27 '22 05:07 dhui

Would do, thanks for responding

SinghCoder avatar Jul 27 '22 06:07 SinghCoder