Attachments support for the outbox
This commit is contained in:
parent
a2cfc36dab
commit
1a88ce7259
11 changed files with 497 additions and 58 deletions
|
@ -1,8 +1,8 @@
|
|||
"""Initial migration
|
||||
|
||||
Revision ID: b122c3a69fc9
|
||||
Revision ID: 714b4a5307c7
|
||||
Revises:
|
||||
Create Date: 2022-06-22 19:54:19.153320
|
||||
Create Date: 2022-06-23 18:42:56.009810
|
||||
|
||||
"""
|
||||
import sqlalchemy as sa
|
||||
|
@ -10,7 +10,7 @@ import sqlalchemy as sa
|
|||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'b122c3a69fc9'
|
||||
revision = '714b4a5307c7'
|
||||
down_revision = None
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
@ -18,7 +18,7 @@ depends_on = None
|
|||
|
||||
def upgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('actors',
|
||||
op.create_table('actor',
|
||||
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),
|
||||
|
@ -28,9 +28,9 @@ def upgrade() -> None:
|
|||
sa.Column('handle', sa.String(), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_index(op.f('ix_actors_ap_id'), 'actors', ['ap_id'], unique=True)
|
||||
op.create_index(op.f('ix_actors_handle'), 'actors', ['handle'], unique=False)
|
||||
op.create_index(op.f('ix_actors_id'), 'actors', ['id'], unique=False)
|
||||
op.create_index(op.f('ix_actor_ap_id'), 'actor', ['ap_id'], unique=True)
|
||||
op.create_index(op.f('ix_actor_handle'), 'actor', ['handle'], unique=False)
|
||||
op.create_index(op.f('ix_actor_id'), 'actor', ['id'], unique=False)
|
||||
op.create_table('inbox',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
||||
|
@ -54,7 +54,7 @@ def upgrade() -> None:
|
|||
sa.Column('is_bookmarked', sa.Boolean(), nullable=False),
|
||||
sa.Column('has_replies', sa.Boolean(), nullable=False),
|
||||
sa.Column('og_meta', sa.JSON(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['actor_id'], ['actors.id'], ),
|
||||
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.ForeignKeyConstraint(['undone_by_inbox_object_id'], ['inbox.id'], ),
|
||||
|
@ -93,20 +93,33 @@ def upgrade() -> None:
|
|||
op.create_index(op.f('ix_outbox_ap_id'), 'outbox', ['ap_id'], unique=True)
|
||||
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_table('followers',
|
||||
op.create_table('upload',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column('content_type', sa.String(), nullable=False),
|
||||
sa.Column('content_hash', sa.String(), nullable=False),
|
||||
sa.Column('has_thumbnail', sa.Boolean(), nullable=False),
|
||||
sa.Column('blurhash', sa.String(), nullable=True),
|
||||
sa.Column('width', sa.Integer(), nullable=True),
|
||||
sa.Column('height', sa.Integer(), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('content_hash')
|
||||
)
|
||||
op.create_index(op.f('ix_upload_id'), 'upload', ['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'], ['actors.id'], ),
|
||||
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_followers_id'), 'followers', ['id'], unique=False)
|
||||
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),
|
||||
|
@ -114,7 +127,7 @@ def upgrade() -> None:
|
|||
sa.Column('actor_id', sa.Integer(), nullable=False),
|
||||
sa.Column('outbox_object_id', sa.Integer(), nullable=False),
|
||||
sa.Column('ap_actor_id', sa.String(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['actor_id'], ['actors.id'], ),
|
||||
sa.ForeignKeyConstraint(['actor_id'], ['actor.id'], ),
|
||||
sa.ForeignKeyConstraint(['outbox_object_id'], ['outbox.id'], ),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('actor_id'),
|
||||
|
@ -129,13 +142,24 @@ def upgrade() -> None:
|
|||
sa.Column('actor_id', sa.Integer(), nullable=True),
|
||||
sa.Column('outbox_object_id', sa.Integer(), nullable=True),
|
||||
sa.Column('inbox_object_id', sa.Integer(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['actor_id'], ['actors.id'], ),
|
||||
sa.ForeignKeyConstraint(['actor_id'], ['actor.id'], ),
|
||||
sa.ForeignKeyConstraint(['inbox_object_id'], ['inbox.id'], ),
|
||||
sa.ForeignKeyConstraint(['outbox_object_id'], ['outbox.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_index(op.f('ix_notifications_id'), 'notifications', ['id'], unique=False)
|
||||
op.create_table('outgoing_activities',
|
||||
op.create_table('outbox_object_attachment',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column('filename', sa.String(), nullable=False),
|
||||
sa.Column('outbox_object_id', sa.Integer(), nullable=False),
|
||||
sa.Column('upload_id', sa.Integer(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['outbox_object_id'], ['outbox.id'], ),
|
||||
sa.ForeignKeyConstraint(['upload_id'], ['upload.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_index(op.f('ix_outbox_object_attachment_id'), 'outbox_object_attachment', ['id'], unique=False)
|
||||
op.create_table('outgoing_activity',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column('recipient', sa.String(), nullable=False),
|
||||
|
@ -151,8 +175,8 @@ def upgrade() -> None:
|
|||
sa.ForeignKeyConstraint(['outbox_object_id'], ['outbox.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_index(op.f('ix_outgoing_activities_id'), 'outgoing_activities', ['id'], unique=False)
|
||||
op.create_table('tagged_outbox_objects',
|
||||
op.create_index(op.f('ix_outgoing_activity_id'), 'outgoing_activity', ['id'], unique=False)
|
||||
op.create_table('tagged_outbox_object',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('outbox_object_id', sa.Integer(), nullable=False),
|
||||
sa.Column('tag', sa.String(), nullable=False),
|
||||
|
@ -160,24 +184,28 @@ def upgrade() -> None:
|
|||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('outbox_object_id', 'tag', name='uix_tagged_object')
|
||||
)
|
||||
op.create_index(op.f('ix_tagged_outbox_objects_id'), 'tagged_outbox_objects', ['id'], unique=False)
|
||||
op.create_index(op.f('ix_tagged_outbox_objects_tag'), 'tagged_outbox_objects', ['tag'], unique=False)
|
||||
op.create_index(op.f('ix_tagged_outbox_object_id'), 'tagged_outbox_object', ['id'], unique=False)
|
||||
op.create_index(op.f('ix_tagged_outbox_object_tag'), 'tagged_outbox_object', ['tag'], unique=False)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_index(op.f('ix_tagged_outbox_objects_tag'), table_name='tagged_outbox_objects')
|
||||
op.drop_index(op.f('ix_tagged_outbox_objects_id'), table_name='tagged_outbox_objects')
|
||||
op.drop_table('tagged_outbox_objects')
|
||||
op.drop_index(op.f('ix_outgoing_activities_id'), table_name='outgoing_activities')
|
||||
op.drop_table('outgoing_activities')
|
||||
op.drop_index(op.f('ix_tagged_outbox_object_tag'), table_name='tagged_outbox_object')
|
||||
op.drop_index(op.f('ix_tagged_outbox_object_id'), table_name='tagged_outbox_object')
|
||||
op.drop_table('tagged_outbox_object')
|
||||
op.drop_index(op.f('ix_outgoing_activity_id'), table_name='outgoing_activity')
|
||||
op.drop_table('outgoing_activity')
|
||||
op.drop_index(op.f('ix_outbox_object_attachment_id'), table_name='outbox_object_attachment')
|
||||
op.drop_table('outbox_object_attachment')
|
||||
op.drop_index(op.f('ix_notifications_id'), table_name='notifications')
|
||||
op.drop_table('notifications')
|
||||
op.drop_index(op.f('ix_following_id'), table_name='following')
|
||||
op.drop_table('following')
|
||||
op.drop_index(op.f('ix_followers_id'), table_name='followers')
|
||||
op.drop_table('followers')
|
||||
op.drop_index(op.f('ix_follower_id'), table_name='follower')
|
||||
op.drop_table('follower')
|
||||
op.drop_index(op.f('ix_upload_id'), table_name='upload')
|
||||
op.drop_table('upload')
|
||||
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_id'), table_name='outbox')
|
||||
|
@ -185,8 +213,8 @@ def downgrade() -> None:
|
|||
op.drop_index(op.f('ix_inbox_id'), table_name='inbox')
|
||||
op.drop_index(op.f('ix_inbox_ap_id'), table_name='inbox')
|
||||
op.drop_table('inbox')
|
||||
op.drop_index(op.f('ix_actors_id'), table_name='actors')
|
||||
op.drop_index(op.f('ix_actors_handle'), table_name='actors')
|
||||
op.drop_index(op.f('ix_actors_ap_id'), table_name='actors')
|
||||
op.drop_table('actors')
|
||||
op.drop_index(op.f('ix_actor_id'), table_name='actor')
|
||||
op.drop_index(op.f('ix_actor_handle'), table_name='actor')
|
||||
op.drop_index(op.f('ix_actor_ap_id'), table_name='actor')
|
||||
op.drop_table('actor')
|
||||
# ### end Alembic commands ###
|
Loading…
Add table
Add a link
Reference in a new issue