Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #34233 - Align migration file naming convention #736

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

ekohl
Copy link
Member

@ekohl ekohl commented Jan 7, 2022

Currently Foreman uses +%Y%m%d%H%M%S and Katello uses +%y%m%d%H%M%S. Historically Kafo has recommended the latter but the former uses complete timestamps, which makes them easier to recognize. It also uses underscores which is generally recommended for Ruby files.

Right now this hasn't been subject to a lot of testing. Only the included tests, no real system yet.

The reasoning for the probing of files is to make it work for scenarios that have not renamed their files yet. This may be optimized using regular expressions but I think this will be fast enough since it's all queried from the same directory so the dirent cache should suffice. Alternatively the hook could list all files in the directory (using the glob) and treat it as a regular array.

The reasoning for this is that eventually we can end up sharing migrations between foreman and katello by having the same migrations directory.

Currently Foreman uses +%Y%m%d%H%M%S and Katello uses +%y%m%d%H%M%S.
Historically Kafo has recommended the latter but the former uses
complete timestamps, which makes them easier to recognize. It also uses
underscores which is generally recommended for Ruby files.
@ekohl
Copy link
Member Author

ekohl commented Feb 8, 2022

Marking back as draft since some migrations were added and this is out of date now. It should really add a check to ensure everything is in line.

@ehelms
Copy link
Member

ehelms commented Mar 9, 2022

I took this for a test drive and saw no significant issues. One aspect of it that I wanted to double check was intended as it generates a diff between new installations and upgrade is the "duplication" of migrations in the applied list -- the old name and the new name. For example:

 cat /etc/foreman-installer/scenarios.d/katello-migrations-applied | grep without
- 211108174119-disable-registration-without-templates.rb
- 20211108174119_disable_registration_without_templates.rb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants