method

prepare_all

Importance_0
v7.0.0 - Show latest stable - 0 notes - Class: DatabaseTasks
prepare_all() public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/tasks/database_tasks.rb, line 188
      def prepare_all
        seed = false

        configs_for(env_name: env).each do |db_config|
          ActiveRecord::Base.establish_connection(db_config)

          # Skipped when no database
          migrate

          if ActiveRecord.dump_schema_after_migration
            dump_schema(db_config, ActiveRecord.schema_format)
          end
        rescue ActiveRecord::NoDatabaseError
          create_current(db_config.env_name, db_config.name)

          if File.exist?(schema_dump_path(db_config))
            load_schema(
              db_config,
              ActiveRecord.schema_format,
              nil
            )
          else
            migrate
          end

          seed = true
        end

        ActiveRecord::Base.establish_connection
        load_seed if seed
      end
Register or log in to add new notes.