mirror of https://github.com/encode/starlette.git
Default rollback_on_shutdown to false in DatabaseMiddleware (#357)
This commit is contained in:
parent
d3a0a723a7
commit
678589b2de
|
@ -155,7 +155,8 @@ if TESTING:
|
|||
DATABASE_URL = DATABASE_URL.replace(database='test_' + DATABASE_URL.database)
|
||||
|
||||
|
||||
# Use 'rollback_on_shutdown' during testing, to ensure we have
|
||||
# Use 'rollback_on_shutdown' during testing, to ensure we do not persist
|
||||
# database changes
|
||||
app = Starlette()
|
||||
app.add_middleware(
|
||||
DatabaseMiddleware,
|
||||
|
|
|
@ -16,7 +16,7 @@ class DatabaseMiddleware:
|
|||
self,
|
||||
app: ASGIApp,
|
||||
database_url: typing.Union[str, DatabaseURL],
|
||||
rollback_on_shutdown: bool,
|
||||
rollback_on_shutdown: bool = False,
|
||||
) -> None:
|
||||
self.app = app
|
||||
self.backend = self.get_backend(database_url)
|
||||
|
|
Loading…
Reference in New Issue