Skip to content

Instantly share code, notes, and snippets.

@kaniak274
Last active June 7, 2021 12:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kaniak274/de6089f42e3e3f30c283bf74ee4024f4 to your computer and use it in GitHub Desktop.
Save kaniak274/de6089f42e3e3f30c283bf74ee4024f4 to your computer and use it in GitHub Desktop.
Enum downgrade for the enum article
def downgrade():
op.execute("ALTER TYPE status RENAME TO status_old")
op.execute("CREATE TYPE status AS ENUM('STARTED', 'ACCEPTED')")
op.execute((
"ALTER TABLE transactions ALTER COLUMN status TYPE status USING "
"status::text::status"
))
op.execute("DROP TYPE status_old")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment