From 8f412bf4253bcf5e5a76b1caae4cab364ce3a179 Mon Sep 17 00:00:00 2001 From: "vicky :)" <60366641+vicky-g@users.noreply.github.com> Date: Thu, 26 May 2022 15:28:45 -0700 Subject: [PATCH] [CON-177] Add new column is_available to tracks table (#3163) * add new column is_available to tracks table * actually it's lowercase true not uppercase oo000ps --- ..._add_is_available_column_to_track_table.py | 30 +++++++++++++++++++ discovery-provider/src/models/models.py | 2 ++ 2 files changed, 32 insertions(+) create mode 100644 discovery-provider/alembic/versions/5e17e0480ca7_add_is_available_column_to_track_table.py diff --git a/discovery-provider/alembic/versions/5e17e0480ca7_add_is_available_column_to_track_table.py b/discovery-provider/alembic/versions/5e17e0480ca7_add_is_available_column_to_track_table.py new file mode 100644 index 00000000000..daa50c80120 --- /dev/null +++ b/discovery-provider/alembic/versions/5e17e0480ca7_add_is_available_column_to_track_table.py @@ -0,0 +1,30 @@ +"""add is_available column to track table + +Revision ID: 5e17e0480ca7 +Revises: a83814aeb4a1 +Create Date: 2022-05-20 21:55:56.464788 + +""" +import sqlalchemy as sa +from alembic import op + +# revision identifiers, used by Alembic. +revision = "5e17e0480ca7" +down_revision = "a83814aeb4a1" +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.add_column( + "tracks", + sa.Column("is_available", sa.Boolean(), nullable=False, server_default="true"), + ) + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.drop_column("tracks", "is_available") + # ### end Alembic commands ### diff --git a/discovery-provider/src/models/models.py b/discovery-provider/src/models/models.py index 3c7b4c70e8d..00088c77423 100644 --- a/discovery-provider/src/models/models.py +++ b/discovery-provider/src/models/models.py @@ -315,6 +315,7 @@ class Track(Base): is_unlisted = Column(Boolean, nullable=False) field_visibility = Column(postgresql.JSONB, nullable=True) stem_of = Column(postgresql.JSONB, nullable=True) + is_available = Column(Boolean, default=True, nullable=False) _routes = relationship( # type: ignore "TrackRoute", @@ -390,6 +391,7 @@ def __repr__(self): f"stem_of={self.stem_of}," f"permalink={self.permalink}," f"user={self.user}" + f"is_available={self.is_available}" ")>" )