Skip to content

Command "goose validate" don't run #674

Open
@darkoment

Description

@darkoment

goose version: v3.16.0

I have created migrations through the goose create command.
The migration files are created in the datetime_name.sql format.
When I run the goose validate command, nothing happens.

Example file.sql (sql query was specifically written with an error):

-- +goose Up
-- +goose StatementBegin
INSERTINTO `options` (
    `id`,`questions_id`,`text`,`image`,`type`
) VALUES
      ( 1, 4, 'танцую', NULL, 'regular'),
      ( 2, 4, 'вяжу крючком', NULL, 'regular')
;
-- +goose StatementEnd

-- +goose Down
-- +goose StatementBegin
DELETE FROM options id <= 2;
-- +goose StatementEnd

if you break annotation (for example, gooseStatementBegin instead of goose StatementBegin), a message will be displayed in the terminal:
2023/12/18 15:52:16 goose validate: failed to parse file "20231215150001_add_test_options.sql": '-- +goose StatementEnd' must be defined after '-- +goose StatementBegin', see https://github.com/pressly/goose#sql-migrations

The description of the command states: "Check migration files without running them"
however, no validation actually takes place.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions