diff --git a/Procfile b/Procfile index 73a131355..01bfd1c1f 100644 --- a/Procfile +++ b/Procfile @@ -1,3 +1,3 @@ -release: bundle exec rails db:prepare +release: bundle exec rails db:chatwoot_prepare web: bin/rails server -p $PORT -e $RAILS_ENV worker: bundle exec sidekiq -C config/sidekiq.yml diff --git a/app.json b/app.json index af1a496a4..cca08fec2 100644 --- a/app.json +++ b/app.json @@ -12,9 +12,6 @@ "vue" ], "success_url": "/", - "scripts": { - "postdeploy": "bundle exec rake db:seed" - }, "env": { "SECRET_TOKEN": { "description": "A secret key for verifying the integrity of signed cookies.", diff --git a/app/javascript/widget/assets/scss/woot.scss b/app/javascript/widget/assets/scss/woot.scss index 78d8f7211..f2799af28 100755 --- a/app/javascript/widget/assets/scss/woot.scss +++ b/app/javascript/widget/assets/scss/woot.scss @@ -45,3 +45,16 @@ body { .cursor-pointer { cursor: pointer; } + + +.message-content { + ul { + list-style: disc; + padding-left: $space-slab; + } + + ol { + list-style: decimal; + padding-left: $space-normal; + } +} diff --git a/config/app.yml b/config/app.yml index d66b484c7..b1eed4b4b 100644 --- a/config/app.yml +++ b/config/app.yml @@ -1,5 +1,5 @@ shared: &shared - version: '1.12.0' + version: '1.12.1' development: <<: *shared diff --git a/lib/tasks/db_enhancements.rake b/lib/tasks/db_enhancements.rake index a6535c60f..f106a4d37 100644 --- a/lib/tasks/db_enhancements.rake +++ b/lib/tasks/db_enhancements.rake @@ -5,3 +5,28 @@ Rake::Task['db:migrate'].enhance do ConfigLoader.new.process end end + +# we are creating a custom database prepare task +# the default rake db:prepare task isn't ideal for environments like heroku +# In heroku the database is already created before the first run of db:prepare +# In this case rake db:prepare tries to run db:migrate from all the way back from the beginning +# Since the assumption is migrations are only run after schema load from a point x, this could lead to things breaking. +# ref: https://github.com/rails/rails/blob/main/activerecord/lib/active_record/railties/databases.rake#L356 +db_namespace = namespace :db do + desc 'Runs setup if database does not exist, or runs migrations if it does' + task chatwoot_prepare: :load_config do + ActiveRecord::Base.configurations.configs_for(env_name: Rails.env).each do |db_config| + ActiveRecord::Base.establish_connection(db_config.config) + # handling case where database was created by the provider, with out running db:setup + if ActiveRecord::Base.connection.tables.count.zero? + db_namespace['load_config'].invoke if ActiveRecord::Base.schema_format == :ruby + ActiveRecord::Tasks::DatabaseTasks.load_schema_current(:ruby, ENV['SCHEMA']) + db_namespace['seed'].invoke + end + + db_namespace['migrate'].invoke + rescue ActiveRecord::NoDatabaseError + db_namespace['setup'].invoke + end + end +end diff --git a/package.json b/package.json index 4437479e9..6490af496 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@chatwoot/chatwoot", - "version": "1.12.0", + "version": "1.12.1", "license": "MIT", "scripts": { "eslint": "eslint app/javascript --fix",