Esempio n. 1
0
def migrate_export(app: Flask, request: dict) -> bool:
    for cls_name in request["import_export_types"]:
        path = app.path / "migrations" / request["name"]
        if not exists(path):
            makedirs(path)
        with open(path / f"{cls_name}.yaml", "w") as migration_file:
            dump(export(cls_name), migration_file, default_flow_style=False)
    return True
Esempio n. 2
0
def migrate_export(path_app, request):
    for cls_name in request['import_export_types']:
        path = path_app / 'migrations' / request['name']
        if not exists(path):
            makedirs(path)
        with open(path / f'{cls_name}.yaml', 'w') as migration_file:
            dump(export(cls_name), migration_file, default_flow_style=False)
    return True
Esempio n. 3
0
def migration_export():
    name = request.form['name']
    for cls_name in request.form.getlist('export'):
        path = app.path / 'migrations' / 'import_export' / name
        if not exists(path):
            makedirs(path)
        with open(path / f'{cls_name}.yaml', 'w') as migration_file:
            dump(export(cls_name), migration_file, default_flow_style=False)
    return jsonify(True)