require 'singleton' module Scrivito module Migrations class MigrationStore include Singleton def backend @backend ||= CmsBackend.new end def versions @versions ||= MultiJson.load(backend.read.presence || '[]') end def add_version(version) versions << version backend.save(MultiJson.dump(versions)) end end end end