Coder Social home page Coder Social logo

Comments (5)

dkoston avatar dkoston commented on May 16, 2024

Here's a diff that will allow this to happen for SQL migrations. It'll take a little more work if you're using go migrations. Use migrations w/o transaction at your own risk:

https://gist.github.com/dkoston/9b28b092424b46ad841d3a41c56c7c83

from goose.

VojtechVitek avatar VojtechVitek commented on May 16, 2024

@dkoston nice, can you submit a PR?

from goose.

dkoston avatar dkoston commented on May 16, 2024

@VojtechVitek sorry, we forked directly off https://bitbucket.org/liamstask/goose/src. Looks like you've made some modifications after those commits that aren't part of our internal fork. I fixed up the diff to use your directory structure but you have some code changes that will require modifications to use git apply

from goose.

iosdev-republicofapps avatar iosdev-republicofapps commented on May 16, 2024

Hi,

Any progress on this? In Postgres, you also cannot modify enums inside a transaction as per https://www.postgresql.org/docs/current/static/sql-altertype.html

ALTER TYPE ... ADD VALUE (the form that adds a new value to an enum type) cannot be executed inside a transaction block.

We will be doing some of these but it seems like goose can't handle these?

Can I take over this fix and create a PR to handle this case?

Thanks

from goose.

VojtechVitek avatar VojtechVitek commented on May 16, 2024

@iosdev-republicofapps PR would be greatly appreciated!

For SQL migrations, we need a flag like:

-- +goose Up transaction=false
-- +goose StatementBegin
ALTER TYPE ...; -- no transaction
-- +goose StatementEnd

-- +goose Down
-- +goose StatementBegin
ALTER TYPE ...; -- within a transaction
-- +goose StatementEnd

For Go migrations, we can support two function signatures:

func alterTypeUp(db *sql.DB) error {} // no transaction
func alterTypeDown(tx *sql.Tx) error {} // within a transaction

Thoughts?

from goose.

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.