discourse/discourse · error
Error: the database must be started before it can be migrate
Error message
Error: the database must be started before it can be migrated.
What it means
Error "Error: the database must be started before it can be migrated." thrown in discourse/discourse.
Source
Thrown at lib/temporary_db.rb:162
ENV["PATH"] = "#{pg_bin_path}:#{old_path}"
yield
ensure
ENV["PGHOST"] = old_host
ENV["PGUSER"] = old_user
ENV["PGPORT"] = old_port
ENV["DISCOURSE_DEV_DB"] = old_dev_db
ENV["RAILS_DB"] = old_rails_db
ENV["PATH"] = old_path
end
def remove
raise "Error: the database must be stopped before it can be removed" if @started
FileUtils.rm_rf @pg_temp_path
end
def migrate
raise "Error: the database must be started before it can be migrated." if !@started
ActiveRecord::Base.establish_connection(connection_hash)
puts "Running migrations on blank database!"
old_stdout = $stdout.clone
old_stderr = $stderr.clone
$stdout.reopen(File.new("/dev/null", "w"))
$stderr.reopen(File.new("/dev/null", "w"))
SeedFu.quiet = true
Rake::Task["db:migrate"].invoke
ensure
$stdout.reopen(old_stdout) if old_stdout
$stderr.reopen(old_stderr) if old_stderr
end
private
View on GitHub (pinned to 1b2d7253e8)
When it happens
Trigger: Thrown at lib/temporary_db.rb:162 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of discourse/discourse@1b2d7253e8 (2026-08-26).
Data as JSON: /api/errors/10f9822004a08a96.
Report an issue: GitHub.