Skip to content

Cannot revert. #4381

Description

@MaxKingPor

I have found these related issues/pull requests

#3439

Description

In PostgreSQL, when using options[search_path]=data,public, revert is not possible.

Reproduction steps

PS E:\tmp> Get-ComputerInfo | Select-Object WindowsVersion, WindowsBuildLabEx

WindowsVersion WindowsBuildLabEx
-------------- -----------------
2009           26100.1.amd64fre.ge_release.240331-1435
PS E:\tmp> cat .env
DATABASE_URL="postgres://rust:123456@192.168.31.200/rust?options[search_path]=data,public"
PS E:\tmp> sqlx migrate add -r init
Creating migrations\20260815075646_init.up.sql
Creating migrations\20260815075646_init.down.sql
PS E:\tmp> cat migrations\20260815075646_init.up.sql
-- Add up migration script here
CREATE SCHEMA IF NOT EXISTS data;
PS E:\tmp> cat migrations\20260815075646_init.down.sql
-- Add down migration script here
DROP SCHEMA IF EXISTS data CASCADE;
PS E:\tmp> sqlx migrate run
Applied 20260815075646/migrate init (39.7574ms)
PS E:\tmp> sqlx migrate revert
No migrations available to revert
PS E:\tmp> cat .\.env
DATABASE_URL="postgres://rust:123456@192.168.31.200/rust?options[search_path]=public"
PS E:\tmp> sqlx migrate revert
Applied 20260815075646/revert init (32.6879ms)
PS E:\tmp

SQLx version

sqlx-cli 0.9.0

Enabled SQLx features

default

Database server and version

PostgreSQL 18.4 (Debian 18.4-1.pgdg13+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 14.2.0-19) 14.2.0, 64-bit

Operating system

docker.io/library/postgres:18

Rust version

rustc 1.97.1 (8bab26f4f 2026-07-14)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions