-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Description
Describe the Bug
I'd like to add multiple indexes to my postgresql schema in a single migration file.
Steps to Reproduce
- My migrations look like '...'
CREATE INDEX CONCURRENTLY idx_my_table_col1 ON my_table(col1);
CREATE INDEX CONCURRENTLY idx_my_table_col2 ON my_table(col2);
- I ran migrate with the following options '....'
migrate -source file:migrations -database "postgres://localhost:5432/my-database?sslmode=disable" up
- See error
(details: pq: CREATE INDEX CONCURRENTLY cannot run inside a transaction block)
Expected Behavior
I expected the migration to succeed and add both indexes. This migration does succeed if I only try to create one index at a time and have two sequential migration files with the following contents:
CREATE INDEX CONCURRENTLY idx_my_table_col1 ON my_table(col1);
```
```
CREATE INDEX CONCURRENTLY idx_my_table_col2 ON my_table(col2);
```
**Migrate Version**
v4.6.2
**Loaded Source Drivers**
Source drivers: github, github-ee, gitlab, go-bindata, godoc-vfs, gcs, file, s3
**Loaded Database Drivers**
Database drivers: cockroachdb, crdb-postgres, postgres, redshift, postgresql, spanner, sqlserver, cassandra, clickhouse, cockroach, mongodb, mysql, stub
**Go Version**
go version go1.13 darwin/amd64
J7mbo, frederikhors, khasburrahman, serezha93 and jfxio
Metadata
Metadata
Assignees
Labels
No labels