Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 7f02faf

Browse files
authored
Add a check to SQLite port DB script to ensure that the sqlite database passed to the script exists before trying to port from it (#15306)
1 parent 4b8c9c3 commit 7f02faf

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

Diff for: changelog.d/15306.bugfix

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Add a check to [SQLite port_db script](https://matrix-org.github.io/synapse/latest/postgres.html#porting-from-sqlite)
2+
to ensure that the sqlite database passed to the script exists before trying to port from it.

Diff for: synapse/_scripts/synapse_port_db.py

+8
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import argparse
1919
import curses
2020
import logging
21+
import os
2122
import sys
2223
import time
2324
import traceback
@@ -1326,6 +1327,13 @@ def main() -> None:
13261327
filename="port-synapse.log" if args.curses else None,
13271328
)
13281329

1330+
if not os.path.isfile(args.sqlite_database):
1331+
sys.stderr.write(
1332+
"The sqlite database you specified does not exist, please check that you have the"
1333+
"correct path."
1334+
)
1335+
sys.exit(1)
1336+
13291337
sqlite_config = {
13301338
"name": "sqlite3",
13311339
"args": {

0 commit comments

Comments
 (0)