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
Container Registry
Model registry
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
Maunium
synapse
Commits
c3c01641
Commit
c3c01641
authored
10 years ago
by
Kegan Dougal
Browse files
Options
Downloads
Patches
Plain Diff
Run deltas and bump user_version in upgrade script
parent
3f6b36d9
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
UPGRADE.rst
+5
-0
5 additions, 0 deletions
UPGRADE.rst
scripts/upgrade_appservice_db.py
+23
-5
23 additions, 5 deletions
scripts/upgrade_appservice_db.py
synapse/storage/__init__.py
+1
-1
1 addition, 1 deletion
synapse/storage/__init__.py
with
29 additions
and
6 deletions
UPGRADE.rst
+
5
−
0
View file @
c3c01641
...
@@ -12,6 +12,11 @@ Servers which use captchas will need to add their public key to::
...
@@ -12,6 +12,11 @@ Servers which use captchas will need to add their public key to::
This is required in order to support registration fallback (typically used on
This is required in order to support registration fallback (typically used on
mobile devices).
mobile devices).
Servers which have registered application services need to upgrade their
database as the format of stored application services has changed in Synapse.
Run ``python upgrade_appservice_db.py <database file path>`` to convert to the
new format.
Upgrading to v0.7.0
Upgrading to v0.7.0
===================
===================
...
...
This diff is collapsed.
Click to expand it.
scripts/upgrade_appservice_db.py
+
23
−
5
View file @
c3c01641
from
synapse.storage
import
read_schema
import
argparse
import
argparse
import
json
import
json
import
sqlite3
import
sqlite3
def
main
(
dbname
):
def
do_other_deltas
(
cursor
):
con
=
sqlite3
.
connect
(
dbname
)
cursor
.
execute
(
"
PRAGMA user_version
"
)
cur
=
con
.
cursor
()
row
=
cursor
.
fetchone
()
if
row
and
row
[
0
]:
user_version
=
row
[
0
]
# Run every version since after the current version.
for
v
in
range
(
user_version
+
1
,
10
):
print
"
Running delta: %d
"
%
(
v
,)
sql_script
=
read_schema
(
"
delta/v%d
"
%
(
v
,))
cursor
.
executescript
(
sql_script
)
def
update_app_service_table
(
cur
):
cur
.
execute
(
"
SELECT id, regex FROM application_services_regex
"
)
cur
.
execute
(
"
SELECT id, regex FROM application_services_regex
"
)
for
row
in
cur
.
fetchall
():
for
row
in
cur
.
fetchall
():
try
:
try
:
print
"
checking %s...
"
%
row
[
0
]
print
"
checking %s...
"
%
row
[
0
]
json
.
loads
(
row
[
1
])
json
.
loads
(
row
[
1
])
print
"
Already in new format
"
except
ValueError
:
except
ValueError
:
# row isn't in json, make it so.
# row isn't in json, make it so.
string_regex
=
row
[
1
]
string_regex
=
row
[
1
]
...
@@ -23,13 +34,20 @@ def main(dbname):
...
@@ -23,13 +34,20 @@ def main(dbname):
"
UPDATE application_services_regex SET regex=? WHERE id=?
"
,
"
UPDATE application_services_regex SET regex=? WHERE id=?
"
,
(
new_regex
,
row
[
0
])
(
new_regex
,
row
[
0
])
)
)
def
main
(
dbname
):
con
=
sqlite3
.
connect
(
dbname
)
cur
=
con
.
cursor
()
do_other_deltas
(
cur
)
update_app_service_table
(
cur
)
cur
.
execute
(
"
PRAGMA user_version = 14
"
)
cur
.
close
()
cur
.
close
()
con
.
commit
()
con
.
commit
()
if
__name__
==
"
__main__
"
:
if
__name__
==
"
__main__
"
:
parser
=
argparse
.
ArgumentParser
()
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"
database
"
)
parser
.
add_argument
(
"
database
"
)
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
...
...
This diff is collapsed.
Click to expand it.
synapse/storage/__init__.py
+
1
−
1
View file @
c3c01641
...
@@ -74,7 +74,7 @@ SCHEMAS = [
...
@@ -74,7 +74,7 @@ SCHEMAS = [
# Remember to update this number every time an incompatible change is made to
# Remember to update this number every time an incompatible change is made to
# database schema files, so the users will be informed on server restarts.
# database schema files, so the users will be informed on server restarts.
SCHEMA_VERSION
=
1
3
SCHEMA_VERSION
=
1
4
dir_path
=
os
.
path
.
abspath
(
os
.
path
.
dirname
(
__file__
))
dir_path
=
os
.
path
.
abspath
(
os
.
path
.
dirname
(
__file__
))
...
...
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