2021-06-14 21:45:35 +02:00
|
|
|
# Copyright (C) 2018-2021 by BDE ENS Paris-Saclay
|
2020-07-25 21:57:46 +02:00
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2020-05-25 01:18:24 +02:00
|
|
|
import subprocess
|
2020-05-02 16:08:40 +02:00
|
|
|
|
|
|
|
from django.core.management import call_command
|
2020-04-27 02:08:01 +02:00
|
|
|
|
2020-07-22 01:28:28 +02:00
|
|
|
from ._import_utils import ImportCommand
|
|
|
|
|
2021-05-12 17:43:18 +02:00
|
|
|
|
2020-07-22 01:28:28 +02:00
|
|
|
class Command(ImportCommand):
|
2020-02-24 14:19:40 +01:00
|
|
|
"""
|
|
|
|
Command for importing the database of NK15.
|
2021-05-12 17:43:18 +02:00
|
|
|
Need to be run by a user with a registered role in postgres for the database nk15.
|
2020-02-24 14:19:40 +01:00
|
|
|
"""
|
2020-04-27 01:19:56 +02:00
|
|
|
|
2020-02-24 14:19:40 +01:00
|
|
|
def handle(self, *args, **kwargs):
|
2020-05-25 01:18:24 +02:00
|
|
|
subprocess.call("./apps/scripts/shell/tabularasa")
|
2020-07-22 01:28:28 +02:00
|
|
|
|
|
|
|
kwargs["alias"] = True
|
|
|
|
kwargs["chunk"] = 1000
|
|
|
|
kwargs["save"] = "map.json"
|
|
|
|
call_command('import_account', **kwargs)
|
|
|
|
|
|
|
|
del kwargs["alias"]
|
|
|
|
del kwargs["save"]
|
|
|
|
kwargs["chunk"] = 100
|
|
|
|
kwargs["map"] = "map.json"
|
|
|
|
call_command('import_activities', **kwargs)
|
|
|
|
|
|
|
|
kwargs["chunk"] = 10000
|
|
|
|
kwargs["map"] = "map.json"
|
|
|
|
kwargs["buttons"] = True
|
|
|
|
call_command('import_transaction', **kwargs)
|
2020-07-22 01:43:18 +02:00
|
|
|
|
2020-07-23 07:21:29 +02:00
|
|
|
call_command('make_su','-sS', 'Coq', 'erdnaxe', 'Krokmou', 'PAC', 'Pollion', 'TLinux', 'ÿnérant')
|
2020-06-02 10:46:08 +02:00
|
|
|
call_command('syncsql')
|