Skip to content

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

Merged
merged 3 commits into from
Jun 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/generators/github/ds/active_record_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class ActiveRecordGenerator < ::Rails::Generators::Base
source_paths << File.join(File.dirname(__FILE__), "templates")

def create_migration_file
migration_template "migration.rb", "db/migrate/create_key_values_table.rb", migration_version: migration_version
migration_template "migration.rb.tt", "db/migrate/create_key_values_table.rb", migration_version: migration_version
end

def self.next_migration_number(dirname)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Copy link
Contributor

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.

Copy link
Contributor Author

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

Copy link
Contributor

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.

end

def self.down
drop_table <%= table_name %>
drop_table <%= table_name %>
end
end
4 changes: 1 addition & 3 deletions test/generators/github/store/active_record_generator_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,10 @@ 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"
end

def self.down
drop_table :#{table_name}
drop_table :#{table_name}
end
end
EOM
Expand Down