1
0
mirror of https://github.com/krateng/maloja.git synced 2023-08-10 21:12:55 +03:00

Fixed duplicate artist association rules

This commit is contained in:
krateng 2022-02-15 04:45:42 +01:00
parent b95d1e8b0c
commit d9f4021342
2 changed files with 3 additions and 2 deletions

View File

@ -27,7 +27,7 @@ def load_associated_rules():
# write to db
ops = [
sqldb.DB['associated_artists'].insert().values(**r)
sqldb.DB['associated_artists'].insert().values(**r).prefix_with('OR IGNORE')
for r in rules
]

View File

@ -47,7 +47,8 @@ DB['trackartists'] = sql.Table(
DB['associated_artists'] = sql.Table(
'associated_artists', meta,
sql.Column('source_artist',sql.Integer,sql.ForeignKey('artists.id')),
sql.Column('target_artist',sql.Integer,sql.ForeignKey('artists.id'))
sql.Column('target_artist',sql.Integer,sql.ForeignKey('artists.id')),
sql.UniqueConstraint('source_artist', 'target_artist')
)
meta.create_all(engine)