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

Allow to skip db:create during install task #2266

Merged
merged 1 commit into from
Mar 18, 2022
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 Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ namespace :alchemy do
bin/rake db:create && \
bin/rake db:environment:set && \
bin/rake db:migrate:reset && \
bin/rails g alchemy:install --skip --skip-demo-files --auto-accept && \
bin/rails g alchemy:install --skip --skip-demo-files --auto-accept --skip-db-create && \
yarn link @alchemy_cms/admin && \
RAILS_ENV=test bin/webpack && \
cd -
Expand Down
7 changes: 6 additions & 1 deletion lib/generators/alchemy/install/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ class InstallGenerator < ::Rails::Generators::Base
default: false,
desc: "Skip running the webpacker installer."

class_option :skip_db_create,
type: :boolean,
default: false,
desc: "Skip creting the database during install."

source_root File.expand_path("files", __dir__)

def setup
Expand Down Expand Up @@ -104,7 +109,7 @@ def set_primary_language
end

def setup_database
rake("db:create", abort_on_failure: true)
rake("db:create", abort_on_failure: true) unless options[:skip_db_create]
# We can't invoke this rake task, because Rails will use wrong engine names otherwise
rake("railties:install:migrations", abort_on_failure: true)
rake("db:migrate", abort_on_failure: true)
Expand Down