Giter Club home page Giter Club logo

Comments (7)

mfridman avatar mfridman commented on June 13, 2024

Shouldn't it be the below, note the -- +goose ENVSUB ON annotation towards the top (not sure if you had a copy/paste error).

-- +goose ENVSUB ON

-- +goose Up
-- +goose StatementBegin
CREATE TABLE ${GOD}.test (id int);
-- +goose StatementEnd

-- +goose Down
-- +goose StatementBegin
DROP TABLE ${GOD}.test ;
-- +goose StatementEnd

from goose.

vigneshnvxi avatar vigneshnvxi commented on June 13, 2024

@mfridman thanks for your response . I tried as you mentioned still I get the same error

❯ cat 20240130095049_test_1.sql
-- +goose ENVSUB ON
-- +goose Up
-- +goose StatementBegin
CREATE TABLE ${GOD}.test (id int);
-- +goose StatementEnd

-- +goose Down
-- +goose StatementBegin
DROP TABLE ${GOD}.test ;
-- +goose StatementEnd

output 

❯ ./goose -v up
2024/01/30 18:35:57 -- +goose ENVSUB ON
2024/01/30 18:35:57 StateMachine: ignore comment
2024/01/30 18:35:57 -- +goose Up
2024/01/30 18:35:57 StateMachine: set 0 => 1
2024/01/30 18:35:57 -- +goose StatementBegin
2024/01/30 18:35:57 StateMachine: set 1 => 2
2024/01/30 18:35:57 CREATE TABLE ${GOD}.test (id int);
2024/01/30 18:35:57 -- +goose StatementEnd
2024/01/30 18:35:57 StateMachine: set 2 => 3
2024/01/30 18:35:57 StateMachine: store Up statement
2024/01/30 18:35:57 StateMachine: set 3 => 1
2024/01/30 18:35:57
2024/01/30 18:35:57 StateMachine: ignore comment
2024/01/30 18:35:57 -- +goose Down
2024/01/30 18:35:57 StateMachine: set 1 => 4
2024/01/30 18:35:57 -- +goose StatementBegin
2024/01/30 18:35:57 StateMachine: set 4 => 5
2024/01/30 18:35:57 DROP TABLE ${GOD}.test ;
2024/01/30 18:35:57 StateMachine: ignore up
2024/01/30 18:35:57 -- +goose StatementEnd
2024/01/30 18:35:57 StateMachine: set 5 => 6
2024/01/30 18:35:57 StateMachine: ignore comment
2024/01/30 18:35:57 Begin transaction
2024/01/30 18:35:57 Executing statement: CREATE TABLE ${GOD}.test (id int);

2024/01/30 18:35:57 Rollback transaction
2024/01/30 18:35:57 goose run: ERROR 20240130095049_test_1.sql: failed to run SQL migration: failed to execute SQL query "CREATE TABLE ${GOD}.test (id int);": ERROR: syntax error at or near "$" (SQLSTATE 42601)

from goose.

mfridman avatar mfridman commented on June 13, 2024

Ah, my bad. The feature got merged after https://github.com/pressly/goose/releases/tag/v3.17.0 was released, which means it was merged bu is still "unreleased" on main.

from goose.

vigneshnvxi avatar vigneshnvxi commented on June 13, 2024

@mfridman thanks for your response. since I saw this feature present in Readme.md I was belief that it was part of release. When will be the next release @mfridman a tentative data will be good.

from goose.

mfridman avatar mfridman commented on June 13, 2024

I'll cut a release in the next few days.

from goose.

mfridman avatar mfridman commented on June 13, 2024

@vigneshnvxi I've tagged a new v3.18.0 release, so pull the latest goose binary and give it a try. If any issues let us know!

goose --version
goose version: v3.18.0

from goose.

mfridman avatar mfridman commented on June 13, 2024

Going to close this issue, as I think it should be resolved with the latest release (see previous comment).

But if you continue to run into issues let us know.

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.