Skip to content

Commit

Permalink
Only run migration when needed (fixes #64)
Browse files Browse the repository at this point in the history
  • Loading branch information
tiffany352 committed Jun 29, 2022
1 parent 1a8856a commit e75133f
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/TagManager.lua
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,20 @@ local function genColor(name: string): Color3
return Color3.fromHSV(h, s, v)
end

local function needsMigration(folder: Folder): boolean
if not folder then
return false
end

for _, child in folder:GetChildren() do
if child:IsA("Folder") then
return true
end
end

return false
end

function TagManager.new(store)
local self = setmetatable({
store = store,
Expand All @@ -76,7 +90,7 @@ function TagManager.new(store)
TagManager._global = self

-- Migration path to new attribute based format.
if self._defaultTagsFolder then
if needsMigration(self._defaultTagsFolder) then
ChangeHistory:SetWaypoint("Migrating tags folder")

local migrateCount = 0
Expand Down

0 comments on commit e75133f

Please sign in to comment.