Comments (3)
Ye this is a bit unfortunate, I suppose you could move the semicolon to a new line, or wrap that statement in a +goose StatementBegin
/ +goose StatementEnd
.
The SQL parser is quite basic and does the bare minimum. Open to suggestions on how this could be improved.
from goose.
Certainly, I can manually adjust the SQL, but for my scenario, which involves programmatically generating migrations from mysqldump
, the task becomes more challenging.
For now, my temporary workaround is to regex my arrows from -->
to ->
, but this is obviously not a universal fix for --
.
I don't really see any solutions that doesn't require complicating ParseSQLMigration
.
Maybe we can track whether or not we are inside a string by looking for the '
character? But there are many edge cases...
from goose.
Certainly, I can manually adjust the SQL, but for my scenario, which involves programmatically generating migrations from mysqldump, the task becomes more challenging.
Yep, that's an excellent example.
I don't really see any solutions that doesn't require complicating ParseSQLMigration.
Pretty much. Which gets us into the territory of writing a full-blown SQL parser, otherwise we're always fighting a new edge case. To make matters worse, there's always some subtle dialect-specific difference.
I'll keep this issue open and continue to think this through in the background.
I wonder if you could wrap your entire dumped schema with all statements within:
-- +goose Up
-- +goose StatementBegin
... your entire schema here
-- +goose StatementEnd
This tells goose
to send the entire set of querie(s) as a single semicolon-separated query. And usually this just works unless you have an extensive schema, exceed the database limit or a specific query can't be run in the same transaction.
A bit more background on these annotations can be found here:
https://pressly.github.io/goose/blog/2022/overview-sql-file/#multiple-statements
from goose.
Related Issues (20)
- feat: Expand Store interface; add GetLatestVersion method in Provider
- 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
- ENVSUB is not working HOT 7
- Migrations created with local timestamp instead of utc HOT 3
- Need advice and guidance on our case. 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
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.