Skip to content

Commit 97a6110

Browse files
authored
Merge pull request #423 from Shopify/fix-shop-migration-generator
Added Rails version to create_shops generator template
2 parents 31eae39 + 9088812 commit 97a6110

4 files changed

Lines changed: 10 additions & 9 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
7.2.10
2+
-----
3+
* Fix an issue with the create_shops generator template
4+
[[#423]](https://github.com/Shopify/shopify_app/pull/423)
5+
16
7.2.9
27
-----
38
* Remove support for Rails 4

lib/generators/shopify_app/shop_model/shop_model_generator.rb

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def create_shop_model
1212
end
1313

1414
def create_shop_migration
15-
copy_migration 'create_shops.rb'
15+
migration_template "db/migrate/create_shops.erb", "db/migrate/create_shops.rb"
1616
end
1717

1818
def create_session_storage_initializer
@@ -25,12 +25,8 @@ def create_shop_fixtures
2525

2626
private
2727

28-
def copy_migration(migration_name, config = {})
29-
migration_template(
30-
"db/migrate/#{migration_name}",
31-
"db/migrate/#{migration_name}",
32-
config
33-
)
28+
def rails_migration_version
29+
Rails.version.match(/\d\.\d/)[0]
3430
end
3531

3632
# for generating a timestamp when using `create_migration`

lib/generators/shopify_app/shop_model/templates/db/migrate/create_shops.rb renamed to lib/generators/shopify_app/shop_model/templates/db/migrate/create_shops.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
class CreateShops < ActiveRecord::Migration
1+
class CreateShops < ActiveRecord::Migration[<%= rails_migration_version %>]
22
def self.up
33
create_table :shops do |t|
44
t.string :shopify_domain, null: false

lib/shopify_app/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module ShopifyApp
2-
VERSION = '7.2.9'
2+
VERSION = '7.2.10'
33
end

0 commit comments

Comments
 (0)