lib/scrivito/migrations/migrator.rb in scrivito_sdk-0.65.2 vs lib/scrivito/migrations/migrator.rb in scrivito_sdk-0.66.0.rc1
- old
+ new
@@ -67,36 +67,15 @@
end
private
def workspace
- workspace = migration_workspace
-
- if workspace
- if workspace_lock.exists?
- workspace_lock.validate(workspace)
- end
- else
- workspace = Workspace.create(title: 'Migration Working Copy', id: 'rtc')
- workspace_lock.write(workspace)
- end
-
- workspace
+ @workspace = workspace_lock.get
end
- def migration_workspace
- Workspace.find('rtc')
- rescue ResourceNotFound
- end
-
def remove_workspace_with(&block)
- workspace = migration_workspace
-
- if workspace
- workspace_lock.validate(workspace)
-
+ if workspace_lock.exists?
yield
-
workspace_lock.remove
else
raise ScrivitoError.new('Migration workspace does not exist')
end
end