"""in/out models Revision ID: caf39c6e55fc Revises: f68634d9bba2 Create Date: 2023-03-19 15:09:30.921382+00:00 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'caf39c6e55fc' down_revision = 'f68634d9bba2' branch_labels = None depends_on = None def upgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### op.create_table('inbox', sa.Column('id', sa.Integer(), nullable=False), sa.Column('created_at', sa.DateTime(timezone=True), nullable=False), sa.Column('updated_at', sa.DateTime(timezone=True), nullable=False), sa.Column('actor_id', sa.Integer(), nullable=False), sa.Column('server', sa.String(), nullable=False), sa.Column('is_hidden_from_stream', sa.Boolean(), nullable=False), sa.Column('ap_actor_id', sa.String(), nullable=False), sa.Column('ap_type', sa.String(), nullable=False), sa.Column('ap_id', sa.String(), nullable=False), sa.Column('ap_context', sa.String(), nullable=True), sa.Column('ap_published_at', sa.DateTime(timezone=True), nullable=False), sa.Column('ap_object', sa.JSON(), nullable=False), sa.Column('activity_object_ap_id', sa.String(), nullable=True), sa.Column('visibility', sa.Enum('PUBLIC', 'UNLISTED', 'FOLLOWERS_ONLY', 'DIRECT', name='visibilityenum'), nullable=False), sa.Column('relates_to_inbox_object_id', sa.Integer(), nullable=True), sa.Column('relates_to_outbox_object_id', sa.Integer(), nullable=True), sa.ForeignKeyConstraint(['actor_id'], ['actor.id'], ), sa.ForeignKeyConstraint(['relates_to_inbox_object_id'], ['inbox.id'], ), sa.ForeignKeyConstraint(['relates_to_outbox_object_id'], ['outbox.id'], ), sa.PrimaryKeyConstraint('id') ) op.create_index(op.f('ix_inbox_ap_id'), 'inbox', ['ap_id'], unique=True) op.create_index(op.f('ix_inbox_ap_type'), 'inbox', ['ap_type'], unique=False) op.create_index(op.f('ix_inbox_activity_object_ap_id'), 'inbox', ['activity_object_ap_id'], unique=False) op.create_index(op.f('ix_inbox_id'), 'inbox', ['id'], unique=False) op.create_table('outbox', sa.Column('id', sa.Integer(), nullable=False), sa.Column('created_at', sa.DateTime(timezone=True), nullable=False), sa.Column('updated_at', sa.DateTime(timezone=True), nullable=False), sa.Column('public_id', sa.String(), nullable=False), sa.Column('slug', sa.String(), nullable=True), sa.Column('ap_type', sa.String(), nullable=False), sa.Column('ap_id', sa.String(), nullable=False), sa.Column('ap_context', sa.String(), nullable=True), sa.Column('ap_object', sa.JSON(), nullable=False), sa.Column('activity_object_ap_id', sa.String(), nullable=True), sa.Column('visibility', sa.Enum('PUBLIC', 'UNLISTED', 'FOLLOWERS_ONLY', 'DIRECT', name='visibilityenum'), nullable=False), sa.Column('likes_count', sa.Integer(), nullable=False), sa.Column('announces_count', sa.Integer(), nullable=False), sa.Column('replies_count', sa.Integer(), nullable=False), sa.Column('relates_to_inbox_object_id', sa.Integer(), nullable=True), sa.Column('relates_to_outbox_object_id', sa.Integer(), nullable=True), sa.Column('relates_to_actor_id', sa.Integer(), nullable=True), sa.ForeignKeyConstraint(['relates_to_actor_id'], ['actor.id'], ), sa.ForeignKeyConstraint(['relates_to_inbox_object_id'], ['inbox.id'], ), sa.ForeignKeyConstraint(['relates_to_outbox_object_id'], ['outbox.id'], ), sa.PrimaryKeyConstraint('id') ) op.create_index(op.f('ix_outbox_activity_object_ap_id'), 'outbox', ['activity_object_ap_id'], unique=False) op.create_index(op.f('ix_outbox_ap_id'), 'outbox', ['ap_id'], unique=True) op.create_index(op.f('ix_outbox_ap_type'), 'outbox', ['ap_type'], unique=False) op.create_index(op.f('ix_outbox_id'), 'outbox', ['id'], unique=False) op.create_index(op.f('ix_outbox_public_id'), 'outbox', ['public_id'], unique=False) op.create_index(op.f('ix_outbox_slug'), 'outbox', ['slug'], unique=False) op.create_table('push', sa.Column('id', sa.Integer(), nullable=False), sa.Column('created_at', sa.DateTime(timezone=True), nullable=False), sa.Column('ap_id', sa.String(), nullable=True), sa.Column('ap_object', sa.JSON(), nullable=True), sa.PrimaryKeyConstraint('id') ) op.create_index(op.f('ix_push_ap_id'), 'push', ['ap_id'], unique=False) op.create_index(op.f('ix_push_id'), 'push', ['id'], unique=False) op.create_table('follower', sa.Column('id', sa.Integer(), nullable=False), sa.Column('created_at', sa.DateTime(timezone=True), nullable=False), sa.Column('updated_at', sa.DateTime(timezone=True), nullable=False), sa.Column('actor_id', sa.Integer(), nullable=False), sa.Column('inbox_object_id', sa.Integer(), nullable=False), sa.Column('ap_actor_id', sa.String(), nullable=False), sa.ForeignKeyConstraint(['actor_id'], ['actor.id'], ), sa.ForeignKeyConstraint(['inbox_object_id'], ['inbox.id'], ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('actor_id'), sa.UniqueConstraint('ap_actor_id') ) op.create_index(op.f('ix_follower_id'), 'follower', ['id'], unique=False) op.create_table('following', sa.Column('id', sa.Integer(), nullable=False), sa.Column('created_at', sa.DateTime(timezone=True), nullable=False), sa.Column('updated_at', sa.DateTime(timezone=True), nullable=False), sa.Column('actor_id', sa.Integer(), nullable=False), sa.Column('out_object_id', sa.Integer(), nullable=False), sa.Column('ap_actor_id', sa.String(), nullable=False), sa.ForeignKeyConstraint(['actor_id'], ['actor.id'], ), sa.ForeignKeyConstraint(['out_object_id'], ['outbox.id'], ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('actor_id'), sa.UniqueConstraint('ap_actor_id') ) op.create_index(op.f('ix_following_id'), 'following', ['id'], unique=False) # ### end Alembic commands ### def downgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### op.drop_index(op.f('ix_following_id'), table_name='following') op.drop_table('following') op.drop_index(op.f('ix_follower_id'), table_name='follower') op.drop_table('follower') op.drop_index(op.f('ix_push_id'), table_name='push') op.drop_index(op.f('ix_push_ap_id'), table_name='push') op.drop_table('push') op.drop_index(op.f('ix_outbox_slug'), table_name='outbox') op.drop_index(op.f('ix_outbox_public_id'), table_name='outbox') op.drop_index(op.f('ix_outbox_id'), table_name='outbox') op.drop_index(op.f('ix_outbox_ap_type'), table_name='outbox') op.drop_index(op.f('ix_outbox_ap_id'), table_name='outbox') op.drop_index(op.f('ix_outbox_activity_object_ap_id'), table_name='outbox') op.drop_table('outbox') op.drop_index(op.f('ix_inbox_id'), table_name='inbox') op.drop_index(op.f('ix_inbox_ap_type'), table_name='inbox') op.drop_index(op.f('ix_inbox_ap_id'), table_name='inbox') op.drop_table('inbox') # ### end Alembic commands ###