summaryrefslogtreecommitdiffstats
path: root/aurweb
diff options
context:
space:
mode:
authorFrédéric Mangano-Tarumi <fmang@mg0.fr>2020-02-23 19:52:36 +0100
committerLukas Fleischer <lfleischer@archlinux.org>2020-02-27 16:44:36 +0100
commit81d55e70ee0469018af86d203ceaf2fece691ea8 (patch)
tree8a766d24632b496ab524af175bc1448ac6885917 /aurweb
parente4cbe264cf6949f82338b7de705cba90c15f4d24 (diff)
downloadaur-81d55e70ee0469018af86d203ceaf2fece691ea8.tar.gz
aur-81d55e70ee0469018af86d203ceaf2fece691ea8.tar.xz
Disable Alembic support on test databases
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Diffstat (limited to 'aurweb')
-rw-r--r--aurweb/initdb.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/aurweb/initdb.py b/aurweb/initdb.py
index c02fb961..91777f7e 100644
--- a/aurweb/initdb.py
+++ b/aurweb/initdb.py
@@ -36,14 +36,17 @@ def run(args):
# Ensure Alembic is fine before we do the real work, in order not to fail at
# the last step and leave the database in an inconsistent state. The
# configuration is loaded lazily, so we query it to force its loading.
- alembic_config = alembic.config.Config('alembic.ini')
- alembic_config.get_main_option('script_location')
+ if args.use_alembic:
+ alembic_config = alembic.config.Config('alembic.ini')
+ alembic_config.get_main_option('script_location')
engine = sqlalchemy.create_engine(aurweb.db.get_sqlalchemy_url(),
echo=(args.verbose >= 1))
aurweb.schema.metadata.create_all(engine)
feed_initial_data(engine.connect())
- alembic.command.stamp(alembic_config, 'head')
+
+ if args.use_alembic:
+ alembic.command.stamp(alembic_config, 'head')
if __name__ == '__main__':
@@ -52,5 +55,8 @@ if __name__ == '__main__':
description='Initialize the aurweb database.')
parser.add_argument('-v', '--verbose', action='count', default=0,
help='increase verbosity')
+ parser.add_argument('--no-alembic',
+ help='disable Alembic migrations support',
+ dest='use_alembic', action='store_false')
args = parser.parse_args()
run(args)