[themotte/rDrama#451] DDL: add comments.descendant_count column

This commit is contained in:
faul_sname 2023-01-02 23:58:25 -08:00
parent d7589716f6
commit 9525396131
2 changed files with 34 additions and 0 deletions

View file

@ -41,6 +41,7 @@ class Comment(Base):
upvotes = Column(Integer, default=1, nullable=False)
downvotes = Column(Integer, default=0, nullable=False)
realupvotes = Column(Integer, default=1, nullable=False)
descendant_count = Column(Integer, default=0, nullable=False)
body = Column(String)
body_html = Column(String)
ban_reason = Column(String)

View file

@ -0,0 +1,33 @@
"""DDL: add comments.descendant_count column
Revision ID: f8ba0e88ddd1
Revises: e2cd2818a196
Create Date: 2023-01-03 07:49:32.295633+00:00
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'f8ba0e88ddd1'
down_revision = 'e2cd2818a196'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('comments', sa.Column(
'descendant_count',
sa.Integer(),
nullable=False,
server_default=sa.text('0')
))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('comments', 'descendant_count')
# ### end Alembic commands ###