-
Notifications
You must be signed in to change notification settings - Fork 998
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
11 changed files
with
127 additions
and
17 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,19 @@ | ||
class FixUbuntuVersions < ActiveRecord::Migration[6.0] | ||
def up | ||
# For every Ubuntu operating system with a major version and a minor version in the format "<digits>(.<digits>)", | ||
# * We check if there is already an operating system present with a major version of | ||
# "<major>.<first_place_of_minor>" and a minor version of "<second_place_of_minor_or_empty>". | ||
# * If not, we update the major version of the operating system to "<major>.<first_place_of_minor>" and the minor | ||
# version to "<second_place_of_minor_or_empty>". | ||
Operatingsystem.where(name: 'Ubuntu') | ||
.where('operatingsystems.major ~* ?', '^\d*$') | ||
.where('operatingsystems.minor ~* ?', '^\d\d(\.\d)?$') | ||
.where('o2.id IS NULL') | ||
.joins("left outer join operatingsystems o2 " \ | ||
"on o2.name = operatingsystems.name " \ | ||
"and o2.major = concat(operatingsystems.major, '.', split_part(operatingsystems.minor, '.', 1)) " \ | ||
"and o2.minor = split_part(operatingsystems.minor, '.', 2)") | ||
.update_all("major = concat(operatingsystems.major, '.', split_part(operatingsystems.minor, '.', 1)), " \ | ||
"minor = split_part(operatingsystems.minor, '.', 2)") | ||
end | ||
end |
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