diff --git a/.gitignore b/.gitignore index c5cda590579..5de911ec664 100644 --- a/.gitignore +++ b/.gitignore @@ -36,6 +36,7 @@ config/discourse.conf /db/*.sqlite3 /db/structure.sql /db/schema.rb +/db/schema_cache.yml # Ignore all logfiles and tempfiles. /log/*.log diff --git a/config/application.rb b/config/application.rb index f29044b5f63..65e2a72d28f 100644 --- a/config/application.rb +++ b/config/application.rb @@ -235,6 +235,9 @@ module Discourse # see: http://stackoverflow.com/questions/11894180/how-does-one-correctly-add-custom-sql-dml-in-migrations/11894420#11894420 config.active_record.schema_format = :sql + # We use this in development-mode only (see development.rb) + config.active_record.use_schema_cache_dump = false + # per https://www.owasp.org/index.php/Password_Storage_Cheat_Sheet config.pbkdf2_iterations = 64000 config.pbkdf2_algorithm = "sha256" diff --git a/config/environments/development.rb b/config/environments/development.rb index 8d9ffb6513c..0c7810dccf9 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -12,6 +12,9 @@ Discourse::Application.configure do # Log error messages when you accidentally call methods on nil. config.eager_load = false + # Use the schema_cache.yml file generated during db:migrate (via db:schema:cache:dump) + config.active_record.use_schema_cache_dump = true + # Show full error reports and disable caching config.consider_all_requests_local = true config.action_controller.perform_caching = false diff --git a/lib/tasks/db.rake b/lib/tasks/db.rake index 3575cc3cdbb..51929b85f7d 100644 --- a/lib/tasks/db.rake +++ b/lib/tasks/db.rake @@ -221,6 +221,10 @@ task 'db:migrate' => ['load_config', 'environment', 'set_locale'] do |_, args| SeedFu.quiet = true SeedFu.seed(SeedHelper.paths, SeedHelper.filter) + if Rails.env.development? + Rake::Task['db:schema:cache:dump'].invoke + end + if !Discourse.skip_post_deployment_migrations? && ENV['SKIP_OPTIMIZE_ICONS'] != '1' SiteIconManager.ensure_optimized! end