fix-migration-call
This commit is contained in:
parent
6268e3f2c7
commit
3e188a54c3
|
@ -258,17 +258,21 @@ def data_load():
|
|||
return storage
|
||||
|
||||
|
||||
async def main():
|
||||
async def handling_migration():
|
||||
init_tables()
|
||||
await all_handle(data_load(), sys.argv)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
def process():
|
||||
if "migrate" in sys.argv:
|
||||
loop = asyncio.get_event_loop()
|
||||
loop.run_until_complete(main())
|
||||
loop.run_until_complete(handling_migration())
|
||||
elif "bson" in sys.argv:
|
||||
import bson2json
|
||||
bson2json.json_tables()
|
||||
else:
|
||||
print("[migration] usage: python server.py migrate")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
process()
|
||||
|
|
|
@ -89,10 +89,10 @@ if __name__ == "__main__":
|
|||
reload=want_reload
|
||||
) # , ssl_keyfile="discours.key", ssl_certfile="discours.crt")
|
||||
elif x == "migrate":
|
||||
from migration import migrate
|
||||
from migration import process
|
||||
print("MODE: MIGRATE")
|
||||
|
||||
migrate()
|
||||
process()
|
||||
elif x == "bson":
|
||||
from migration.bson2json import json_tables
|
||||
print("MODE: BSON")
|
||||
|
|
Loading…
Reference in New Issue
Block a user