mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 09:42:02 +08:00
DEV: Support post deployment migrations for plugins.
This commit is contained in:
parent
8b2a379e4e
commit
1c9b5e75e7
|
@ -1,4 +1,4 @@
|
|||
unless ['1', 'true'].include?(ENV["SKIP_POST_DEPLOYMENT_MIGRATIONS"]&.to_s)
|
||||
unless Discourse.skip_post_deployment_migrations?
|
||||
Rails.application.config.paths['db/migrate'] << Rails.root.join(
|
||||
Discourse::DB_POST_MIGRATE_PATH
|
||||
).to_s
|
||||
|
|
|
@ -649,4 +649,8 @@ module Discourse
|
|||
ENV["DISCOURSE_RUNNING_IN_RACK"] == "1"
|
||||
end
|
||||
|
||||
def self.skip_post_deployment_migrations?
|
||||
['1', 'true'].include?(ENV["SKIP_POST_DEPLOYMENT_MIGRATIONS"]&.to_s)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -460,7 +460,12 @@ class Plugin::Instance
|
|||
Rake.add_rakelib(File.dirname(path) + "/lib/tasks")
|
||||
|
||||
# Automatically include migrations
|
||||
Rails.configuration.paths["db/migrate"] << File.dirname(path) + "/db/migrate"
|
||||
migration_paths = Rails.configuration.paths["db/migrate"]
|
||||
migration_paths << File.dirname(path) + "/db/migrate"
|
||||
|
||||
unless Discourse.skip_post_deployment_migrations?
|
||||
migration_paths << "#{File.dirname(path)}/#{Discourse::DB_POST_MIGRATE_PATH}"
|
||||
end
|
||||
|
||||
public_data = File.dirname(path) + "/public"
|
||||
if Dir.exists?(public_data)
|
||||
|
|
Loading…
Reference in New Issue
Block a user