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)
This commit is contained in:
parent
4b8c9c340c
commit
7f02fafa28
|
@ -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.
|
|
@ -18,6 +18,7 @@
|
||||||
import argparse
|
import argparse
|
||||||
import curses
|
import curses
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import traceback
|
import traceback
|
||||||
|
@ -1326,6 +1327,13 @@ def main() -> None:
|
||||||
filename="port-synapse.log" if args.curses else 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 = {
|
sqlite_config = {
|
||||||
"name": "sqlite3",
|
"name": "sqlite3",
|
||||||
"args": {
|
"args": {
|
||||||
|
|
Loading…
Reference in New Issue