alembic/update database models

This commit is contained in:
SouthFox 2023-03-16 17:41:07 +08:00 committed by SouthFox
parent ec099b76ec
commit 2457a85564
3 changed files with 8 additions and 1 deletions

View file

@ -26,6 +26,8 @@ def upgrade() -> None:
sa.Column('ap_actor', sa.String(), nullable=False),
sa.Column('is_blocked', sa.Boolean(), server_default='0', nullable=False),
sa.Column('is_deleted', sa.Boolean(), server_default='0', nullable=False),
sa.Column('ap_type', sa.String(), nullable=False),
sa.Column('handle', sa.String(), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_actor_ap_id'), 'actor', ['ap_id'], unique=True)
@ -39,6 +41,7 @@ def upgrade() -> None:
)
op.create_index(op.f('ix_ingress_ap_id'), 'ingress', ['ap_id'], unique=False)
op.create_index(op.f('ix_ingress_id'), 'ingress', ['id'], unique=False)
op.create_index(op.f('ix_actor_handle'), 'actor', ['handle'], unique=False)
# ### end Alembic commands ###
@ -49,5 +52,6 @@ def downgrade() -> None:
op.drop_table('ingress')
op.drop_index(op.f('ix_actor_id'), table_name='actor')
op.drop_index(op.f('ix_actor_ap_id'), table_name='actor')
op.drop_index(op.f('ix_actor_handle'), table_name='actor')
op.drop_table('actor')
# ### end Alembic commands ###

View file

@ -32,7 +32,9 @@ class Actor(Base):
ap_id: Mapped[str] = Column(String, unique=True, nullable=False, index=True) # type: ignore
ap_actor = Column(JSON, nullable=False)
ap_actor = Column(String, nullable=False)
ap_type = Column(String, nullable=False)
handle = Column(String, nullable=True, index=True)
is_blocked = Column(Boolean, nullable=False, default=False, server_default="0")
is_deleted = Column(Boolean, nullable=False, default=False, server_default="0")

1
data/.gitignore vendored
View file

@ -4,6 +4,7 @@
tmp/
config.toml
*.pem
*.db
*.py[cod]
*.egg