Replies: 1 comment
-
|
I often use just That written: It also might be meaningful to check if a migration would be literally empty and in that case just don't do anthing there, although we might want to emit a warning as that might not be desired? I'm happy to review a PR for that. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Backend
PostgreSQL
Diesel version
2.3.7
Diesel Features
"postgres", "uuid", "chrono", "r2d2", "64-column-tables", "serde_json"
Operating System Version
No response
Third party libraries
No response
What do you want to do?
I want to write a very small migration, where the only line in the
up.sqladds a value to an existing enum type:Because deleting existing values from enum types is not straightforward, I don't want to bother making any database changes when reverting the migration.
However, every migration has to have a
down.sqlfile, and reverting the migration fails if that file is empty.What should I put in the
down.sqlfile for the migration to "revert" successfully?Forum searches suggest
BEGIN;COMMIT;as a "noop" equivalent for PostgreSQL (NULLexists, but can only be used within branching statements). However, this fails with the error "Cannot perform this operation outside of a transaction" (hitting #4854, I think).Compile time error
No response
What code do you already have?
No response
Additional details
No response
Checklist
Beta Was this translation helpful? Give feedback.
All reactions