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

Commit

Permalink
Add a check to SQLite port DB script to ensure that the sqlite databa…
Browse files Browse the repository at this point in the history
…se passed to the script exists before trying to port from it (#15306)
  • Loading branch information
H-Shay committed Mar 22, 2023
1 parent 4b8c9c3 commit 7f02faf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions changelog.d/15306.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Add a check to [SQLite port_db script](https://matrix-org.github.io/synapse/latest/postgres.html#porting-from-sqlite)
to ensure that the sqlite database passed to the script exists before trying to port from it.
8 changes: 8 additions & 0 deletions synapse/_scripts/synapse_port_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import argparse
import curses
import logging
import os
import sys
import time
import traceback
Expand Down Expand Up @@ -1326,6 +1327,13 @@ def main() -> None:
filename="port-synapse.log" if args.curses else None,
)

if not os.path.isfile(args.sqlite_database):
sys.stderr.write(
"The sqlite database you specified does not exist, please check that you have the"
"correct path."
)
sys.exit(1)

sqlite_config = {
"name": "sqlite3",
"args": {
Expand Down

0 comments on commit 7f02faf

Please sign in to comment.