@@ -193,6 +193,7 @@ def upgrade(
193193 parameters : dict | None = None ,
194194 max_version : str | packaging .version .Version | None = None ,
195195 beta_testing : bool = False ,
196+ force : bool = False ,
196197 skip_drop_app : bool = False ,
197198 skip_create_app : bool = False ,
198199 grant : bool = True ,
@@ -211,6 +212,8 @@ def upgrade(
211212 If True, the module is upgraded in beta testing mode.
212213 This means that the module will not be allowed to receive any future updates.
213214 We strongly discourage using this for production.
215+ force:
216+ If True, allow upgrading a module that is installed in beta testing mode.
214217 skip_drop_app:
215218 If True, drop app handlers will be skipped.
216219 skip_create_app:
@@ -225,6 +228,17 @@ def upgrade(
225228 )
226229 raise PumException (msg )
227230
231+ migration_details = self .schema_migrations .migration_details (connection )
232+ installed_beta_testing = bool (migration_details .get ("beta_testing" , False ))
233+ if installed_beta_testing and not force :
234+ msg = (
235+ "This module is installed in beta testing mode, upgrades are disabled. "
236+ "Re-run with force=True (or --force in the CLI) if you really want to upgrade anyway."
237+ )
238+ raise PumException (msg )
239+
240+ effective_beta_testing = beta_testing or installed_beta_testing
241+
228242 logger .info ("Starting upgrade process..." )
229243
230244 if not skip_drop_app :
@@ -251,7 +265,7 @@ def upgrade(
251265 commit = False ,
252266 parameters = parameters ,
253267 schema_migrations = self .schema_migrations ,
254- beta_testing = beta_testing ,
268+ beta_testing = effective_beta_testing ,
255269 )
256270
257271 if not skip_create_app :
0 commit comments