Giter VIP home page Giter VIP logo

Comments (16)

dangkaka avatar dangkaka commented on May 21, 2024 4

hello any updates on this?

from migrate.

ahammond avatar ahammond commented on May 21, 2024 2

This would allow us to finally stop using goose. The non-static migrations could just be type .so golang plugins which implement an interface with an Up(input interface{}) and Down(input interface{}) method. Our driver for this is that we want migrations to be managed by our app, not a 3rd party binary, and we certainly don't want to be compiling code at runtime the way goose dynamic migrations do.

from migrate.

dhui avatar dhui commented on May 21, 2024 1

None AFAIK, feel free to pick it up!

from migrate.

dhui avatar dhui commented on May 21, 2024

I see the usefulness of running custom migrations in Go and/or bash and am not opposed it.

However, I don't have the bandwidth to implement it myself but will participate in design discussions and review the subsequent PR(s).

We may need to change the driver interface to support custom Go/bash migrations

from migrate.

denismakogon avatar denismakogon commented on May 21, 2024

Faced with the same problem where we need to run complex migrations involving data generation, ended up implementing our own migration framework.

from migrate.

denismakogon avatar denismakogon commented on May 21, 2024

@ahammond It's worth starting a new framework. The amount of actual work that is needed here is huge (i'm not blaming this framework, no) comparing to the amount of work needed to extract migrations framework from here: https://github.com/fnproject/fn/tree/master/api/datastore/sql/migrations

from migrate.

dhui avatar dhui commented on May 21, 2024

Using Go plugins is an interesting idea! It looks like plugins are currently only support in Linux and Mac OS.

From: https://golang.org/pkg/plugin/

Currently plugins are only supported on Linux and macOS. Please report any issues.

I'm not familiar with Go plugins (yet), so I'm not sure sure if plugins will work across platforms. e.g. built on Mac OS but used/run on Linux.

Also, I'm not sure about the requirements for this feature. Do people want to run Go migrations with SQL migrations? e.g. run 5 SQL migrations, then 1 Go migration, followed by 3 SQL migrations.

A current work around (if your DB supports it) would be to use a temporary procedure or function to perform the more complicated logic that's hard to do in SQL. e.g. for postgres, there's: https://www.postgresql.org/docs/current/server-programming.html

from migrate.

denismakogon avatar denismakogon commented on May 21, 2024

Plugins are still quite raw technology, let's be honest. With plugins, you'd have a problem when your plugin is built for another OS, etc. I'd really stick with *.go migrations (more safe)

I'm not familiar with Go plugins (yet), so I'm not sure if plugins will work across platforms. e.g. built on Mac OS but used/run on Linux.

no, linux plugins for linux, mac plugins for mac

Also, I'm not sure about the requirements for this feature. Do people want to run Go migrations with SQL migrations? e.g. run 5 SQL migrations, then 1 Go migration, followed by 3 SQL migrations.

No, there's no point having both, only *.go matters and gives a lot of options around the migration process.

from migrate.

eldad87 avatar eldad87 commented on May 21, 2024

@denismakogon can you please share an example on how to run it along this package?
Thanks!

from migrate.

ahammond avatar ahammond commented on May 21, 2024

Everything runs in docker containers these days. A user-interactive experience for these tools should be focused around debugging migrations, and to me, that means keeping the environment as close as possible to the production runtime environment. And that means a linux container.

from migrate.

eldad87 avatar eldad87 commented on May 21, 2024

@ahammond,
That's great, exactly as I thought.
Nevertheless, a real life example will become handy.

from migrate.

euskadi31 avatar euskadi31 commented on May 21, 2024

see: Yaegi for dynamic plugin :)

from migrate.

l0nax avatar l0nax commented on May 21, 2024

Is there any work going on implementing this feature?

from migrate.

mainpart avatar mainpart commented on May 21, 2024

I've ended up using this simple library that suit my needs
https://github.com/xakep666/mongo-migrate

from migrate.

eidins avatar eidins commented on May 21, 2024

What about simply making it easy to extend the CLI so that I could do,

func main() {
  custom_migrations = map[string]Migration{
    "183747version": my_function_handle
  }

  migration.CustomCLI{
    migrations: custom_migrations
  }.run()
}

Then you build this, it works identical to the normal CLI, but the migrations take into account this function as one of the steps.

Seems like it would be fairly simple and no importing .so files. If people like this idea, I could look at implementing.

from migrate.

kecci avatar kecci commented on May 21, 2024

Is there any updates for migrations with go function / extension ?
because I'm using goose right now.

from migrate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.