Commit 5755635d authored by Lukáš Lalinský's avatar Lukáš Lalinský

Remove track_mbid_flag

parent bb009801
Pipeline #20469 passed with stages
in 3 minutes and 8 seconds
...@@ -98,8 +98,6 @@ def merge_mbids(conn, target_mbid, source_mbids): ...@@ -98,8 +98,6 @@ def merge_mbids(conn, target_mbid, source_mbids):
conn.execute(update_stmt.values(track_mbid_id=row['id'])) conn.execute(update_stmt.values(track_mbid_id=row['id']))
update_stmt = schema.track_mbid_change.update().where(schema.track_mbid_change.c.track_mbid_id.in_(old_ids)) update_stmt = schema.track_mbid_change.update().where(schema.track_mbid_change.c.track_mbid_id.in_(old_ids))
conn.execute(update_stmt.values(track_mbid_id=row['id'])) conn.execute(update_stmt.values(track_mbid_id=row['id']))
update_stmt = schema.track_mbid_flag.update().where(schema.track_mbid_flag.c.track_mbid_id.in_(old_ids))
conn.execute(update_stmt.values(track_mbid_id=row['id']))
if to_delete: if to_delete:
delete_stmt = schema.track_mbid.delete().where( delete_stmt = schema.track_mbid.delete().where(
schema.track_mbid.c.id.in_(to_delete)) schema.track_mbid.c.id.in_(to_delete))
...@@ -138,8 +136,6 @@ def _merge_tracks_gids(conn, name_with_id, target_id, source_ids): ...@@ -138,8 +136,6 @@ def _merge_tracks_gids(conn, name_with_id, target_id, source_ids):
if name == 'mbid': if name == 'mbid':
tab_chg = schema.metadata.tables['track_%s_change' % name] tab_chg = schema.metadata.tables['track_%s_change' % name]
col_chg = tab_chg.columns['track_%s_id' % name] col_chg = tab_chg.columns['track_%s_id' % name]
tab_flag = schema.metadata.tables['track_%s_flag' % name]
col_flag = tab_flag.columns['track_%s_id' % name]
columns = [ columns = [
sql.func.min(tab.c.id).label('id'), sql.func.min(tab.c.id).label('id'),
sql.func.array_agg(tab.c.id).label('all_ids'), sql.func.array_agg(tab.c.id).label('all_ids'),
...@@ -162,8 +158,6 @@ def _merge_tracks_gids(conn, name_with_id, target_id, source_ids): ...@@ -162,8 +158,6 @@ def _merge_tracks_gids(conn, name_with_id, target_id, source_ids):
if name == 'mbid': if name == 'mbid':
update_stmt = tab_chg.update().where(col_chg.in_(old_ids)) update_stmt = tab_chg.update().where(col_chg.in_(old_ids))
conn.execute(update_stmt.values({col_chg: row['id']})) conn.execute(update_stmt.values({col_chg: row['id']}))
update_stmt = tab_flag.update().where(col_flag.in_(old_ids))
conn.execute(update_stmt.values({col_flag: row['id']}))
if to_delete: if to_delete:
delete_stmt = tab.delete().where(tab.c.id.in_(to_delete)) delete_stmt = tab.delete().where(tab.c.id.in_(to_delete))
conn.execute(delete_stmt) conn.execute(delete_stmt)
......
...@@ -233,14 +233,6 @@ track_mbid_change = Table('track_mbid_change', metadata, ...@@ -233,14 +233,6 @@ track_mbid_change = Table('track_mbid_change', metadata,
Column('note', Text), Column('note', Text),
) )
track_mbid_flag = Table('track_mbid_flag', metadata,
Column('id', Integer, primary_key=True),
Column('track_mbid_id', Integer, ForeignKey('track_mbid.id'), nullable=False),
Column('account_id', Integer, ForeignKey('account.id'), nullable=False),
Column('handled', Boolean, default=False, server_default=sql.false(), nullable=False),
Column('created', DateTime(timezone=True), server_default=sql.func.current_timestamp(), nullable=False),
)
track_puid = Table('track_puid', metadata, track_puid = Table('track_puid', metadata,
Column('track_id', Integer, ForeignKey('track.id'), nullable=False), Column('track_id', Integer, ForeignKey('track.id'), nullable=False),
Column('puid', UUID, nullable=False, index=True), Column('puid', UUID, nullable=False, index=True),
......
...@@ -52,7 +52,6 @@ SEQUENCES = [ ...@@ -52,7 +52,6 @@ SEQUENCES = [
('track_mbid', 'id'), ('track_mbid', 'id'),
('track_mbid_source', 'id'), ('track_mbid_source', 'id'),
('track_mbid_change', 'id'), ('track_mbid_change', 'id'),
('track_mbid_flag', 'id'),
('track_puid', 'id'), ('track_puid', 'id'),
('track_puid_source', 'id'), ('track_puid_source', 'id'),
('track_meta', 'id'), ('track_meta', 'id'),
...@@ -76,7 +75,6 @@ TABLES = [ ...@@ -76,7 +75,6 @@ TABLES = [
'track_mbid', 'track_mbid',
'track_mbid_source', 'track_mbid_source',
'track_mbid_change', 'track_mbid_change',
'track_mbid_flag',
'track_puid', 'track_puid',
'track_puid_source', 'track_puid_source',
'track_meta', 'track_meta',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment