-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Backfill null artist pick discrepancies in discprov (#4569)
- Loading branch information
1 parent
208f785
commit a75133e
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
discovery-provider/alembic/versions/36ed02ac38f7_backfill_null_artist_pick_discrepancies_.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
"""backfill null artist pick discrepancies in discprov | ||
Revision ID: 36ed02ac38f7 | ||
Revises: efafdb22df81 | ||
Create Date: 2023-01-06 23:42:58.493746 | ||
""" | ||
import os | ||
|
||
import sqlalchemy as sa | ||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = '36ed02ac38f7' | ||
down_revision = 'efafdb22df81' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
env = os.getenv("audius_discprov_env") | ||
if env == "prod": | ||
connection = op.get_bind() | ||
sql = """UPDATE users | ||
SET artist_pick_track_id = null | ||
WHERE users.is_current = True AND users.updated_at < '2023-01-06 08:35:00' AND users.handle_lc = ANY(ARRAY['yyosu', 'amc_music', 'merawan', 'joshbay', 'ohrage']); | ||
""" | ||
connection.execute(sql) | ||
|
||
|
||
def downgrade(): | ||
pass |