microblog.pub/alembic/versions/1647cef23e9b_incoming_activity_model.py

47 lines
1.7 KiB
Python
Raw Normal View History

2022-07-14 06:44:04 +00:00
"""Incoming activity model
Revision ID: 1647cef23e9b
Revises: afc37d9c4fc0
Create Date: 2022-07-14 01:20:16.617984
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = '1647cef23e9b'
down_revision = 'afc37d9c4fc0'
branch_labels = None
depends_on = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('incoming_activity',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
sa.Column('webmention_source', sa.String(), nullable=True),
sa.Column('sent_by_ap_actor_id', sa.String(), nullable=True),
sa.Column('ap_id', sa.String(), nullable=True),
sa.Column('ap_object', sa.JSON(), nullable=True),
sa.Column('tries', sa.Integer(), nullable=False),
sa.Column('next_try', sa.DateTime(timezone=True), nullable=True),
sa.Column('last_try', sa.DateTime(timezone=True), nullable=True),
sa.Column('is_processed', sa.Boolean(), nullable=False),
sa.Column('is_errored', sa.Boolean(), nullable=False),
sa.Column('error', sa.String(), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_incoming_activity_ap_id'), 'incoming_activity', ['ap_id'], unique=False)
op.create_index(op.f('ix_incoming_activity_id'), 'incoming_activity', ['id'], unique=False)
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f('ix_incoming_activity_id'), table_name='incoming_activity')
op.drop_index(op.f('ix_incoming_activity_ap_id'), table_name='incoming_activity')
op.drop_table('incoming_activity')
# ### end Alembic commands ###