From 2ac873886ead49fc91a2997c7a45e146c9579745 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Wed, 1 Jun 2016 10:32:13 +0200 Subject: [PATCH] Added Package.migration_execute to execute all pending package migrations at once. --- app/models/package.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app/models/package.rb b/app/models/package.rb index 41c93a13c..8cafb3880 100644 --- a/app/models/package.rb +++ b/app/models/package.rb @@ -361,6 +361,22 @@ returns record end +=begin + +execute all pending package migrations at once + + Package.migration_execute + +=end + + def self.migration_execute + Package.all.each {|package| + json_file = Package._get_bin(package.name, package.version) + package = JSON.parse(json_file) + Package::Migration.migrate(package['name']) + } + end + def self._get_bin(name, version) package = Package.find_by( name: name,