Comments (7)
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.
@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.
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.
@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.
I'll cut a release in the next few days.
from goose.
@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.
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)
- Command "goose validate" don't run HOT 1
- Make goose annotations case-insensitive
- Ydb: type casting PG<->YQL was broken in latest YDB HOT 1
- Unable to create postgres schema. HOT 2
- Migrations created with local timestamp instead of utc HOT 3
- Need advice and guidance on our case. HOT 3
- Semicolon Detection Fails for "--" in Strings in SQL Statements HOT 3
- Support for quiet operations HOT 4
- Creating two migrations at the same time HOT 1
- New feature `up-preview` `down-preview`? HOT 3
- Request to release 3.18.1 HOT 4
- Question: Is it possible to conditionally run different statements based on type of database? HOT 5
- Build breaks: undefined symbol: duckdb_xx HOT 4
- Feature request: goose seed HOT 4
- failed to insert new goose version: Error 1054 (42S22): Unknown column '$1' in 'field list' HOT 2
- "NO TRANSACTION" migrations should mark database as dirty if not successful HOT 3
- clickhouse: getting a sql.ErrSkip at createVersionTable() HOT 4
- Error when executing SQL migration with specific comments HOT 2
- support for using a custom dialect? HOT 13
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from goose.