Skip to content

Postgres Drop() implementation incomplete #626

Open

Description

@kvij

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:

  1. My migration looks like 'CREATE TYPE mytype AS ENUM('a', 'b');'
  2. I ran migrate with func(m *migrate.Migrate) {m.Drop();m.Up()}
  3. 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

  1. changed the title [-]Postgress Drop() implementation incomplete[/-] [+]Postgres Drop() implementation incomplete[/+] on Sep 24, 2021
  2. kvij commented on Oct 31, 2021

    @kvij
    Author

    @Fontinalis @dhui Is there something else I need to do or is do you disagree with the scope of Drop()?

  3. dhui commented on Oct 31, 2021

    @dhui
    Member

    See also: #193

  4. added a commit that references this issue on Apr 13, 2026
    f697b27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdatabaseUpdates database drivers

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions