mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 00:36:38 -04:00
catch duplicate tags in upgrade
This commit is contained in:
parent
ed5a8b0e3e
commit
942307190e
1 changed files with 8 additions and 2 deletions
|
@ -3847,8 +3847,14 @@ create index if not exists ix_factsDeleted_factId on factsDeleted (factId)""")
|
||||||
deck.s.statement("""
|
deck.s.statement("""
|
||||||
create index if not exists ix_mediaDeleted_factId on mediaDeleted (mediaId)""")
|
create index if not exists ix_mediaDeleted_factId on mediaDeleted (mediaId)""")
|
||||||
# tags
|
# tags
|
||||||
|
txt = "create unique index if not exists ix_tags_tag on tags (tag)"
|
||||||
|
try:
|
||||||
|
deck.s.statement(txt)
|
||||||
|
except:
|
||||||
deck.s.statement("""
|
deck.s.statement("""
|
||||||
create unique index if not exists ix_tags_tag on tags (tag)""")
|
delete from tags where exists (select 1 from tags t2 where tags.tag = t2.tag
|
||||||
|
and tags.rowid > t2.rowid)""")
|
||||||
|
deck.s.statement(txt)
|
||||||
deck.s.statement("""
|
deck.s.statement("""
|
||||||
create index if not exists ix_cardTags_tagCard on cardTags (tagId, cardId)""")
|
create index if not exists ix_cardTags_tagCard on cardTags (tagId, cardId)""")
|
||||||
deck.s.statement("""
|
deck.s.statement("""
|
||||||
|
|
Loading…
Reference in a new issue