rubenv / sql-migrate

SQL schema migration tool for Go.
MIT License
3.18k stars 270 forks source link

sql-migrate status fails with "Could not create constraint or index" #211

Open esetnik opened 2 years ago

esetnik commented 2 years ago
$ go get -v github.com/rubenv/sql-migrate/...@v1.1.1
$ sql-migrate status -env="dev"
mssql: Could not create constraint or index. See previous errors.

How can I see previous errors as nothing else is output in the terminal. Also why is a constraint or index attempting to be created when running the status command?

esetnik commented 2 years ago

Relates to #117

esetnik commented 2 years ago

FYI this is only happening after upgrading to v1.1.0+. v1.0.0 is working fine.

$ go get -v github.com/rubenv/sql-migrate/...@v1.0.0
$ sql-migrate status -env="dev"
Getting migration status
+-----------------------------------------------------------------------------------------------+-----------------------------------+
|                                           MIGRATION                                           |              APPLIED              |
+-----------------------------------------------------------------------------------------------+-----------------------------------+
...
esetnik commented 8 months ago

I think this is being caused by https://github.com/go-gorp/gorp/issues/450

caioparazzi commented 5 months ago

This happens on my stack as well, I have a mssql database set up on a docker container and I'm able to connect my application and create tables through raw queries, however, even after setting up an empty database and running sql-migrate status, I have the constraint error :/

Pompedup commented 4 months ago

Hello, I reproduce the same issue.

I try with the last version of sql-migration and it gave me Migration failed: mssql: Could not create constraint or index. See previous errors.

After downgrading as suggested by @esetnik in 1.0.0, it worked.

My config:

development:
  dialect: mssql
  datasource: sqlserver://sa:password@localhost:1433
  dir: migrations
  table: migrations