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