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:
parent
b95d1e8b0c
commit
d9f4021342
@ -27,7 +27,7 @@ def load_associated_rules():
|
|||||||
|
|
||||||
# write to db
|
# write to db
|
||||||
ops = [
|
ops = [
|
||||||
sqldb.DB['associated_artists'].insert().values(**r)
|
sqldb.DB['associated_artists'].insert().values(**r).prefix_with('OR IGNORE')
|
||||||
for r in rules
|
for r in rules
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -47,7 +47,8 @@ DB['trackartists'] = sql.Table(
|
|||||||
DB['associated_artists'] = sql.Table(
|
DB['associated_artists'] = sql.Table(
|
||||||
'associated_artists', meta,
|
'associated_artists', meta,
|
||||||
sql.Column('source_artist',sql.Integer,sql.ForeignKey('artists.id')),
|
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)
|
meta.create_all(engine)
|
||||||
|
Loading…
Reference in New Issue
Block a user