-
Notifications
You must be signed in to change notification settings - Fork 993
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #36547 - Fix parsing of Ubuntu version in fact parsers
- Loading branch information
Showing
6 changed files
with
50 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class FixUbuntuVersions < ActiveRecord::Migration[6.0] | ||
def up | ||
# For every Ubuntu operating system with a set minor version we | ||
# * Check if there is already an operating system present with the same major and minor version combined in the major field | ||
# * If not, we update the version | ||
Operatingsystem.where('name ~* :name', name: 'ubuntu') | ||
.merge(Operatingsystem.where.not(minor: [nil, ''])).each do |os| | ||
if !Operatingsystem.where('name ~* :name', name: 'ubuntu').merge(Operatingsystem.where(major: "#{os.major}.#{os.minor}")).merge(Operatingsystem.where(minor: [nil, ''])).first | ||
os.update(major: "#{os.major}.#{os.minor}", minor: nil) | ||
end | ||
end | ||
end | ||
|