Browse Source

Drop removed_time column on topics

This column wasn't being used, and the TopicLog can handle it.
merge-requests/34/head
Deimos 6 years ago
parent
commit
826b60e445
  1. 32
      tildes/alembic/versions/a1708d376252_drop_topics_removed_time_column.py
  2. 1
      tildes/tildes/models/topic/topic.py

32
tildes/alembic/versions/a1708d376252_drop_topics_removed_time_column.py

@ -0,0 +1,32 @@
"""Drop topics.removed_time column
Revision ID: a1708d376252
Revises: bcf1406bb6c5
Create Date: 2018-08-23 00:29:41.024890
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = "a1708d376252"
down_revision = "bcf1406bb6c5"
branch_labels = None
depends_on = None
def upgrade():
op.drop_column("topics", "removed_time")
def downgrade():
op.add_column(
"topics",
sa.Column(
"removed_time",
postgresql.TIMESTAMP(timezone=True),
autoincrement=False,
nullable=True,
),
)

1
tildes/tildes/models/topic/topic.py

@ -92,7 +92,6 @@ class Topic(DatabaseModel):
is_removed: bool = Column( is_removed: bool = Column(
Boolean, nullable=False, server_default="false", index=True Boolean, nullable=False, server_default="false", index=True
) )
removed_time: Optional[datetime] = Column(TIMESTAMP(timezone=True))
title: str = Column( title: str = Column(
Text, Text,
CheckConstraint(f"LENGTH(title) <= {TITLE_MAX_LENGTH}", name="title_length"), CheckConstraint(f"LENGTH(title) <= {TITLE_MAX_LENGTH}", name="title_length"),

Loading…
Cancel
Save