Skip to content

Postgres Drop() implementation incomplete #626

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

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