fucked up migrations again..

This commit is contained in:
Tangent 2019-06-27 19:33:10 -07:00
parent 664666441e
commit aa4b02c195

View File

@ -46,12 +46,14 @@ import Tracks, Tags from require "models"
for name, count in pairs tags
Tags\create { :name, :count }
[6]: =>
return true -- formerly a bad migration
[7]: =>
-- WARNING: removes all tags!
for track in *Tracks\select "*"
tags = ""
for field in *{"artist", "mood", "link", "genre"}
if track[field] and #track[field] > 0
tags ..= " #{field}:#{track[field]}"
tags ..= " #{field}:#{track[field]\gsub "%s+", "_"}"
if #tags > 0
track.tags = process_tags "untagged" .. tags
else