-
Notifications
You must be signed in to change notification settings - Fork 991
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #37606 - Drop old CentOS installation media
The host mirror.centos.org is gone now that CentOS < 9 is EOL. It includes a migration to simplify the name, but doesn't include migrations to remove old entries. That is up to the user because they may have modified them and still use them. Co-authored-by: Chris Roberts <[email protected]>
- Loading branch information
Showing
5 changed files
with
25 additions
and
14 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
21 changes: 21 additions & 0 deletions
21
db/migrate/20240813141845_rename_centos_stream_mirror_to_centos.rb
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,21 @@ | ||
class RenameCentosStreamMirrorToCentos < ActiveRecord::Migration[6.1] | ||
OLD_NAME = "CentOS Stream 9 mirror" | ||
NEW_NAME = "CentOS mirror" | ||
|
||
def up | ||
# Name column isn't unique, so we can't just rename and catch | ||
# ActiveRecord::RecordNotUnique | ||
old = Medium.unscoped.where(name: OLD_NAME) | ||
return unless old.exists? | ||
|
||
if Medium.unscoped.where(name: NEW_NAME).exists? | ||
logger.warn("Couldn't rename medium '#{OLD_NAME}' to '#{NEW_NAME}': already exists") | ||
else | ||
old.update_all(name: NEW_NAME) | ||
end | ||
end | ||
|
||
def down | ||
Medium.unscoped.where(name: NEW_NAME).update_all(name: OLD_NAME) | ||
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