And of course, we need to actually commit at the end of a migration.
This commit sponsored by Tamas Kemenczy. Thanks, Tamas!
This commit is contained in:
parent
0c6a34bf5c
commit
0b7cdb6f3e
@ -241,6 +241,7 @@ def mediaentry_new_slug_era(db):
|
|||||||
metadata = MetaData(bind=db.bind)
|
metadata = MetaData(bind=db.bind)
|
||||||
|
|
||||||
media_table = inspect_table(metadata, 'core__media_entries')
|
media_table = inspect_table(metadata, 'core__media_entries')
|
||||||
|
|
||||||
for row in db.execute(media_table.select()):
|
for row in db.execute(media_table.select()):
|
||||||
# no slug, try setting to an id
|
# no slug, try setting to an id
|
||||||
if not row.slug:
|
if not row.slug:
|
||||||
@ -249,3 +250,5 @@ def mediaentry_new_slug_era(db):
|
|||||||
elif u"=" in row.slug or u":" in row.slug:
|
elif u"=" in row.slug or u":" in row.slug:
|
||||||
append_garbage_till_unique(
|
append_garbage_till_unique(
|
||||||
row, row.slug.replace(u"=", u"-").replace(u":", u"-"))
|
row, row.slug.replace(u"=", u"-").replace(u":", u"-"))
|
||||||
|
|
||||||
|
db.commit()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user