2 Implementation of the 'transition' subcommand.
4 This subcommand provides standins for functions that were available
5 through the PHP scripts but are now no longer directly accessible.
6 This module will be removed as soon as the transition phase is over.
10 from ..db.connection import connect
12 # Do not repeat documentation of subcommand classes.
13 # pylint: disable=C0111
14 # Using non-top-level imports to avoid eventually unused imports.
15 # pylint: disable=E0012,C0415
17 LOG = logging.getLogger()
19 class AdminTransition:
21 Internal functions for code transition. Do not use.
26 group = parser.add_argument_group('Sub-functions')
27 group.add_argument('--create-db', action='store_true',
28 help='Create nominatim db')
29 group.add_argument('--setup-db', action='store_true',
30 help='Build a blank nominatim db')
31 group = parser.add_argument_group('Options')
32 group.add_argument('--no-partitions', action='store_true',
33 help='Do not partition search indices')
37 from ..tools import database_import
40 LOG.warning('Create DB')
41 database_import.create_db(args.config.get_libpq_dsn())
44 LOG.warning('Setup DB')
45 mpath = database_import.install_module(args.module_dir, args.project_dir,
46 args.config.DATABASE_MODULE_PATH)
48 with connect(args.config.get_libpq_dsn()) as conn:
49 database_import.setup_extensions(conn)
50 database_import.check_module_dir_path(conn, mpath)
52 database_import.import_base_data(args.config.get_libpq_dsn(),
53 args.data_dir, args.no_partitions)