~sircmpwn/lists.sr.ht

a438d6b68f5eb4b232e748b0d666ae5e7afc2c4c — Thorben Günther 1 year, 6 months ago 129d081
schema: Add missing PATCHSET_RECEIVED user event
2 files changed, 39 insertions(+), 1 deletions(-)

A listssrht/alembic/versions/b4a0d2c6fc5a_add_missing_user_webhook_event.py
M schema.sql
A listssrht/alembic/versions/b4a0d2c6fc5a_add_missing_user_webhook_event.py => listssrht/alembic/versions/b4a0d2c6fc5a_add_missing_user_webhook_event.py +37 -0
@@ 0,0 1,37 @@
"""Add missing user webhook event

Revision ID: b4a0d2c6fc5a
Revises: 7faa55b46247
Create Date: 2023-03-20 13:38:15.888787

"""

# revision identifiers, used by Alembic.
revision = 'b4a0d2c6fc5a'
down_revision = '7faa55b46247'

from alembic import op
import sqlalchemy as sa


def upgrade():
    op.execute("""
    ALTER TYPE "webhook_event" ADD VALUE 'PATCHSET_RECEIVED';
    """)


def downgrade():
    op.execute("""
    ALTER TYPE "webhook_event" RENAME TO "webhook_event_old";
    CREATE TYPE "webhook_event" AS ENUM (
        'LIST_CREATED',
        'LIST_UPDATED',
        'LIST_DELETED',
        'EMAIL_RECEIVED'
    );
    ALTER TABLE "gql_user_wh_sub" ALTER COLUMN events TYPE varchar[];
    ALTER TABLE "gql_user_wh_sub" ALTER COLUMN events TYPE webhook_event[] USING events::webhook_event[];
    ALTER TABLE "gql_user_wh_delivery" ALTER COLUMN event TYPE varchar;
    ALTER TABLE "gql_user_wh_delivery" ALTER COLUMN event TYPE webhook_event USING event::webhook_event;
    DROP TYPE "webhook_event_old";
    """)

M schema.sql => schema.sql +2 -1
@@ 23,7 23,8 @@ CREATE TYPE webhook_event AS ENUM (
	'LIST_CREATED',
	'LIST_UPDATED',
	'LIST_DELETED',
	'EMAIL_RECEIVED'
	'EMAIL_RECEIVED',
	'PATCHSET_RECEIVED'
);

CREATE TABLE "user" (