SeaQL / sea-orm

🐚 An async & dynamic ORM for Rust
https://www.sea-ql.org/SeaORM/
Apache License 2.0
6.56k stars 459 forks source link

Migration fresh command cannot drop types with Postgresql #2215

Open vdebergue opened 1 month ago

vdebergue commented 1 month ago

Description

Steps to Reproduce

  1. Write a migration that enables citext on postgresql:
    CREATE EXTENSION IF NOT EXISTS citext;
  2. Apply the migration on a clean postgresql db
  3. Run the command migration command fresh to clean the database cargo run -- fresh
  4. The command returns an error:
...
Dropping all types
Dropping type 'citext'
Execution Error: error returned from database: cannot drop type citext because extension citext requires it

Expected Behavior

The fresh command executes without error. Either it deletes the extension or it only deletes types that can be deleted or it continues without an error

Actual Behavior

Command runs with an error

See: https://github.com/SeaQL/sea-orm/blob/master/sea-orm-migration/src/migrator.rs#L330-L342

Reproduces How Often

Always

Workarounds

Reproducible Example

Versions

sea-orm = "0.12"

postgresql = 16