sql-migrate icon indicating copy to clipboard operation
sql-migrate copied to clipboard

Ability to write migration custom logic in Go

Open vasayxtx opened this issue 4 years ago • 6 comments
trafficstars

Sometimes it's needed to write custom logic (usually for data migration, not scheme) in Go during migration. Please consider this change.

vasayxtx avatar Jan 20 '21 18:01 vasayxtx

@rubenv could you please review?

vasayxtx avatar Jan 21 '21 20:01 vasayxtx

So one reason I never added this was because it basically brakes CLI usage. Not sure what to do with this.

rubenv avatar Jan 21 '21 20:01 rubenv

So one reason I never added this was because it basically brakes CLI usage. Not sure what to do with this.

Writing migrations in Go (FuncUp/FuncDown) will be available using only MemoryMigrationSource. In this case, sql-migrate is always used as a library, not a CLI standalone tool.

For me, it's okay if the library will provide advanced functionality that is needed for projects in which the migration logic cannot be implemented in just SQL. The choice of how to write and run migrations will be up to the developer. I don't see any real problem here.

Please correct me if I'm wrong, miss something, or misunderstood your comment.

vasayxtx avatar Jan 24 '21 17:01 vasayxtx

@rubenv could you please clarify if there is a chance to continue the discussion? Or is it your final decision and fork is the only way for us?

vasayxtx avatar Feb 02 '21 11:02 vasayxtx

It's ok, we'll get this in. I just haven't found the time to review/merge this: out second kid has just been born and I more or less lost track of this PR.

I'll get back to it, ping me in a bit if I forget. And apologies for the delay!

On Tue, Feb 2, 2021, 12:41 Vasiliy Tsybenko [email protected] wrote:

@rubenv https://github.com/rubenv could you please clarify if there is a chance to continue the discussion? Or is it your final decision and fork is the only way for us?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rubenv/sql-migrate/pull/187#issuecomment-771577292, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAKPGHM5IKCFA636PF3V3DS47QHNANCNFSM4WLBYLPQ .

rubenv avatar Feb 02 '21 11:02 rubenv

No problem, this is a very important and good event! Сongratulations!:)

vasayxtx avatar Feb 02 '21 12:02 vasayxtx