mirror of
https://github.com/codeninjasllc/discourse.git
synced 2025-03-14 00:50:14 -04:00
FIX: plugins that use models in their initialize section might fail when bootstrapping a new database
This commit is contained in:
parent
fd28d4c978
commit
3faeeca5c8
1 changed files with 7 additions and 1 deletions
|
@ -172,7 +172,13 @@ class Plugin::Instance
|
|||
end
|
||||
|
||||
initializers.each do |callback|
|
||||
callback.call(self)
|
||||
begin
|
||||
callback.call(self)
|
||||
rescue ActiveRecord::StatementInvalid => e
|
||||
# When running db:migrate for the first time on a new database, plugin initializers might
|
||||
# try to use models. Tolerate it.
|
||||
raise e unless e.message.try(:include?, "PG::UndefinedTable")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue