Skip to content

Commit 8f96456

Browse files
committed
Add option to skip migrations
In some cases (in particular, the solidus install) it makes sense to skip the entire migration block. With the current setup, it's impossible to not run migrations AND not be asked if you want to run migrations. This allows for a complete skip of the migrations + the question asking part, which will smooth out the Solidus installation.
1 parent 0b663ff commit 8f96456

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

lib/generators/solidus/auth/install/install_generator.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ module Auth
55
module Generators
66
class InstallGenerator < Rails::Generators::Base
77
class_option :auto_run_migrations, type: :boolean, default: false
8+
class_option :skip_migrations, type: :boolean, default: false
89

910
def self.source_paths
1011
paths = superclass.source_paths
@@ -21,6 +22,8 @@ def add_migrations
2122
end
2223

2324
def run_migrations
25+
return if options[:skip_migrations]
26+
2427
run_migrations = options[:auto_run_migrations] || ['', 'y', 'Y'].include?(ask('Would you like to run the migrations now? [Y/n]'))
2528
if run_migrations
2629
run 'bundle exec rake db:migrate'

0 commit comments

Comments
 (0)