You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the Bug
Migrate.Drop() function only drops tables, not custom types.
When a migration creates a custom type a drop followed by an up fails with type already exists.
Steps to Reproduce
Steps to reproduce the behavior:
My migration looks like 'CREATE TYPE mytype AS ENUM('a', 'b');'
I ran migrate with func(m *migrate.Migrate) {m.Drop();m.Up()}
See error: migration failed: type "mytype" already exists in line 0: CREATE TYPE mytype AS ENUM('a', 'b'); (details: pq: type "mytype" already exists)
Expected Behavior Migrate.Drop() should also drop custom types so a Migrate.Up() succeeds on a cleaned database.
Migrate Version
4.15.0
Obtained by checking: go.mod
Loaded Source Drivers
file
Loaded Database Drivers
postgres
Go Version
go1.16.8 linux/amd64
Obtained by running: go version
Activity
[-]Postgress Drop() implementation incomplete[/-][+]Postgres Drop() implementation incomplete[/+]kvij commentedon Oct 31, 2021
@Fontinalis @dhui Is there something else I need to do or is do you disagree with the scope of Drop()?
dhui commentedon Oct 31, 2021
See also: #193
fix: Drop() also removes custom enum types in Postgres