From c59be2ea64e1c2ff23a4cb4def2050dc82305ea7 Mon Sep 17 00:00:00 2001 From: Deimos Date: Fri, 4 Oct 2019 18:53:33 -0600 Subject: [PATCH] Drop original_url column from Topic This isn't being used for anything, might as well get rid of the cruft. --- ...f8cc5ddd_topic_drop_original_url_column.py | 24 +++++++++++++++++++ tildes/scripts/clean_private_data.py | 1 - tildes/tildes/models/topic/topic.py | 2 -- 3 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 tildes/alembic/versions/8326f8cc5ddd_topic_drop_original_url_column.py diff --git a/tildes/alembic/versions/8326f8cc5ddd_topic_drop_original_url_column.py b/tildes/alembic/versions/8326f8cc5ddd_topic_drop_original_url_column.py new file mode 100644 index 0000000..e24963f --- /dev/null +++ b/tildes/alembic/versions/8326f8cc5ddd_topic_drop_original_url_column.py @@ -0,0 +1,24 @@ +"""Topic: drop original_url column + +Revision ID: 8326f8cc5ddd +Revises: 20b5f07e5f80 +Create Date: 2019-10-05 00:52:20.515858 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = "8326f8cc5ddd" +down_revision = "20b5f07e5f80" +branch_labels = None +depends_on = None + + +def upgrade(): + op.drop_column("topics", "original_url") + + +def downgrade(): + op.add_column("topics", sa.Column("original_url", sa.Text(), nullable=True)) diff --git a/tildes/scripts/clean_private_data.py b/tildes/scripts/clean_private_data.py index f3c9659..a84d734 100644 --- a/tildes/scripts/clean_private_data.py +++ b/tildes/scripts/clean_private_data.py @@ -145,7 +145,6 @@ class DataCleaner: "markdown": DEFAULT, "rendered_html": DEFAULT, "link": DEFAULT, - "original_url": DEFAULT, "content_metadata": DEFAULT, "_tags": DEFAULT, }, diff --git a/tildes/tildes/models/topic/topic.py b/tildes/tildes/models/topic/topic.py index 25893f3..5af94b6 100644 --- a/tildes/tildes/models/topic/topic.py +++ b/tildes/tildes/models/topic/topic.py @@ -116,7 +116,6 @@ class Topic(DatabaseModel): _markdown: Optional[str] = deferred(Column("markdown", Text)) rendered_html: Optional[str] = Column(Text) link: Optional[str] = Column(Text) - original_url: Optional[str] = Column(Text) content_metadata: Dict[str, Any] = Column( MutableDict.as_mutable(JSONB(none_as_null=True)) ) @@ -229,7 +228,6 @@ class Topic(DatabaseModel): new_topic = cls._create_base_topic(group, author, title) new_topic.topic_type = TopicType.LINK new_topic.link = link - new_topic.original_url = link incr_counter("topics", type="link")