diff --git a/APP_TEMPLATE b/APP_TEMPLATE index f16e115cbd..5ffbeb40b1 100644 --- a/APP_TEMPLATE +++ b/APP_TEMPLATE @@ -7,11 +7,21 @@ class Profile private attr_reader :options, :location def client - postgres? ? "RailsEventStore::JSONClient.new" : "RailsEventStore::Client.new" + if postgres? || mysql? + "RailsEventStore::JSONClient.new" + else + "RailsEventStore::Client.new" + end end def data_type - postgres? ? "jsonb" : "binary" + if postgres? + "jsonb" + elsif mysql? + "json" + else + "binary" + end end def for_existing_app @@ -24,6 +34,10 @@ class Profile !!location end + def mysql? + %w[mysql2 mysql trilogy].include?(database.downcase) + end + def postgres? database.downcase.eql?("postgresql") end @@ -71,9 +85,7 @@ CODE route "mount RailsEventStore::Browser => '/res' if Rails.env.development?" -profile.for_existing_app do - run_bundle unless run "bundle check" -end +profile.for_existing_app { run_bundle unless run "bundle check" } after_bundle do rails_command "db:create" @@ -81,6 +93,4 @@ after_bundle do rails_command "db:migrate" end -profile.for_existing_app do - run_after_bundle_callbacks -end \ No newline at end of file +profile.for_existing_app { run_after_bundle_callbacks }