From 826b60e445359c97eddc2128fb6035521cf396cc Mon Sep 17 00:00:00 2001 From: Deimos Date: Wed, 22 Aug 2018 18:30:09 -0600 Subject: [PATCH] Drop removed_time column on topics This column wasn't being used, and the TopicLog can handle it. --- ...d376252_drop_topics_removed_time_column.py | 32 +++++++++++++++++++ tildes/tildes/models/topic/topic.py | 1 - 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 tildes/alembic/versions/a1708d376252_drop_topics_removed_time_column.py diff --git a/tildes/alembic/versions/a1708d376252_drop_topics_removed_time_column.py b/tildes/alembic/versions/a1708d376252_drop_topics_removed_time_column.py new file mode 100644 index 0000000..ef78348 --- /dev/null +++ b/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, + ), + ) diff --git a/tildes/tildes/models/topic/topic.py b/tildes/tildes/models/topic/topic.py index 46ac091..540360c 100644 --- a/tildes/tildes/models/topic/topic.py +++ b/tildes/tildes/models/topic/topic.py @@ -92,7 +92,6 @@ class Topic(DatabaseModel): is_removed: bool = Column( Boolean, nullable=False, server_default="false", index=True ) - removed_time: Optional[datetime] = Column(TIMESTAMP(timezone=True)) title: str = Column( Text, CheckConstraint(f"LENGTH(title) <= {TITLE_MAX_LENGTH}", name="title_length"),