Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Timo Ley
synapse
Commits
16dd87d8
Commit
16dd87d8
authored
10 years ago
by
Erik Johnston
Browse files
Options
Downloads
Patches
Plain Diff
Don't assume db conn is a Context Manager.
Twisted adbapi wrapped connections aren't context managers.
parent
5eefd1f6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
synapse/storage/__init__.py
+5
-1
5 additions, 1 deletion
synapse/storage/__init__.py
with
5 additions
and
1 deletion
synapse/storage/__init__.py
+
5
−
1
View file @
16dd87d8
...
@@ -583,7 +583,7 @@ def prepare_database(db_conn):
...
@@ -583,7 +583,7 @@ def prepare_database(db_conn):
"""
Prepares a database for usage. Will either create all necessary tables
"""
Prepares a database for usage. Will either create all necessary tables
or upgrade from an older schema version.
or upgrade from an older schema version.
"""
"""
with
db_conn
:
try
:
cur
=
db_conn
.
cursor
()
cur
=
db_conn
.
cursor
()
version_info
=
_get_or_create_schema_state
(
cur
)
version_info
=
_get_or_create_schema_state
(
cur
)
...
@@ -596,6 +596,10 @@ def prepare_database(db_conn):
...
@@ -596,6 +596,10 @@ def prepare_database(db_conn):
cur
.
execute
(
"
PRAGMA user_version = %d
"
%
(
SCHEMA_VERSION
,))
cur
.
execute
(
"
PRAGMA user_version = %d
"
%
(
SCHEMA_VERSION
,))
cur
.
close
()
cur
.
close
()
db_conn
.
commit
()
except
:
db_conn
.
rollback
()
raise
def
_setup_new_database
(
cur
):
def
_setup_new_database
(
cur
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment