2022-04-02 18:43:20 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
import asyncio
|
2023-05-25 20:24:05 +00:00
|
|
|
import logging
|
2022-04-02 18:43:20 +00:00
|
|
|
|
|
|
|
log = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
from prepare_sql_tiles import prepare_sql_tiles, _run
|
|
|
|
|
2023-05-25 20:24:05 +00:00
|
|
|
from import_regions import main as import_nuts
|
|
|
|
|
|
|
|
from reimport_tracks import main as reimport_tracks
|
|
|
|
|
2022-04-02 18:43:20 +00:00
|
|
|
|
|
|
|
async def _migrate():
|
|
|
|
await _run("alembic upgrade head")
|
|
|
|
|
|
|
|
|
|
|
|
async def main():
|
|
|
|
logging.basicConfig(level=logging.DEBUG, format="%(levelname)s: %(message)s")
|
|
|
|
log.info("Running migrations...")
|
|
|
|
await _migrate()
|
|
|
|
log.info("Preparing SQL tiles...")
|
|
|
|
await prepare_sql_tiles()
|
2023-05-25 20:24:05 +00:00
|
|
|
log.info("Importing nuts regions...")
|
|
|
|
await import_nuts()
|
|
|
|
log.info("Nuts regions imported, scheduling reimport of tracks")
|
|
|
|
await reimport_tracks()
|
|
|
|
|
2022-04-02 18:43:20 +00:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
asyncio.run(main())
|