rubenv / sql-migrate

SQL schema migration tool for Go.
MIT License
3.18k stars 270 forks source link

Ability to write migration custom logic in Go #187

Open vasayxtx opened 3 years ago

vasayxtx commented 3 years ago

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

vasayxtx commented 3 years ago

@rubenv could you please review?

rubenv commented 3 years ago

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

vasayxtx commented 3 years ago

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 commented 3 years ago

@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?

rubenv commented 3 years ago

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 notifications@github.com 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 .

vasayxtx commented 3 years ago

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