Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration fresh command cannot drop types with Postgresql #2215

Open
vdebergue opened this issue May 7, 2024 · 0 comments
Open

Migration fresh command cannot drop types with Postgresql #2215

vdebergue opened this issue May 7, 2024 · 0 comments

Comments

@vdebergue
Copy link

Description

Steps to Reproduce

  1. Write a migration that enables citext on postgresql:
CREATE EXTENSION IF NOT EXISTS citext;
  1. Apply the migration on a clean postgresql db
  2. Run the command migration command fresh to clean the database cargo run -- fresh
  3. 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

  • Don't use citext extension
  • Avoid using the fresh command and use other commands like refresh and write my own down script to drop the citext extension before hand

Reproducible Example

  • Start a postgresql database
  • Execute manually: CREATE EXTENSION IF NOT EXISTS citext;
  • Run the command sea-orm-cli migrate fresh

Versions

sea-orm = "0.12"

postgresql = 16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant