Skip to content

Migration failed with multiple statements wrapped in BEGIN/COMMIT #108

Closed
@fharding1

Description

@fharding1

Describe the Bug
I get an error when I try to run a migration with multiple statements wrapped in a BEGIN/COMMIT

Steps to Reproduce
Steps to reproduce the behavior:

  1. My migrations look like '...'
BEGIN;
ALTER TABLE sharedcampaigns CHANGE COLUMN `uuid` `id` CHAR(36);
ALTER TABLE sharedresearch CHANGE COLUMN `uuid` `id` CHAR(36);
COMMIT;
  1. I ran migrate with the following options '....'
    parseTime=true
  2. See error
panic: migration failed in line 0: BEGIN;
ALTER TABLE sharedcampaigns CHANGE COLUMN `uuid` `id` CHAR(36);
ALTER TABLE sharedresearch CHANGE COLUMN `uuid` `id` CHAR(36);
COMMIT;
 (details: Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ALTER TABLE sharedcampaigns CHANGE COLUMN `uuid` `id` CHAR(36);
ALTER TABLE shar' at line 2)

goroutine 1 [running]:
main.doe(...)
        /home/franklin/go/src/github.com/Billups/snapshot-rewrite/cmd/migrate/migrate.go:26
main.main()
        /home/franklin/go/src/github.com/Billups/snapshot-rewrite/cmd/migrate/migrate.go:69 +0x4a1

Expected Behavior
The migrations should run fine.

Migrate Version
93d53a5

Loaded Source Drivers
file

Loaded Database Drivers
mysql

Go Version
go version go1.11 linux/amd64

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions