-
Notifications
You must be signed in to change notification settings - Fork 28
Rename template file to have .tt extension #73
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
Conversation
Nice, that seems to have worked for CodeQL at least:
Previously, the output looked like this:
|
After some local testing, I think the migration to change the ID column to a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR renames the migration template to use a .tt
extension and updates the Rails generator to reference the new file name, aiming to resolve CodeQL parse errors.
- Rename
migration.rb
template tomigration.rb.tt
- Update
migration_template
call to point to the new.tt
file - Clean up stray whitespace in the template
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
File | Description |
---|---|
lib/generators/github/ds/templates/migration.rb.tt | Renamed template file to .tt and removed extra lines |
lib/generators/github/ds/active_record_generator.rb | Updated migration_template call to use .tt file |
Comments suppressed due to low confidence (2)
lib/generators/github/ds/templates/migration.rb.tt:11
- Removing the
change_column
call means theid
column type will no longer be altered. If the migration should still adjust the primary key tobigint
, restore this line or document why it was removed.
change_column <%= table_name %>, :id, "bigint(20) NOT NULL AUTO_INCREMENT"
@@ -9,11 +9,9 @@ def self.up | |||
|
|||
add_index <%= table_name %>, :key, :unique => true | |||
add_index <%= table_name %>, :expires_at | |||
|
|||
change_column <%= table_name %>, :id, "bigint(20) NOT NULL AUTO_INCREMENT" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How long has this been the Rails default? I think we should restrict which Rails versions we support in the gemspec
if we're going to go this route.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this was changed in Rails 6.0, in rails/rails#26266.
I'll go ahead and restrict the Rails version that we support in #72
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, let's be sure to land #72 before this PR.
CodeQL is giving out that one file can't be scanned, and looking at the latest job run, these are the lines that jump out about it:
They point to
lib/generators/github/ds/templates/migration.rb
and I think it's the ERB code included that's tripping it up. I'm trying out renaming the template file to have a.tt
extension, like other Rails generator templates do to see if it cleans up the CodeQL output.