From dceab1990ada081803b757543ae0ce1444166074 Mon Sep 17 00:00:00 2001 From: Kamil Monicz Date: Wed, 6 Nov 2024 06:54:15 +0000 Subject: [PATCH] Remove migration code --- docker-compose.yml | 1 - main.py | 6 ------ shell.nix | 17 +---------------- 3 files changed, 1 insertion(+), 23 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index c49d2ba..ed209fa 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -28,6 +28,5 @@ services: - ${LISTEN:-80}:8000 volumes: - - ./data/postgres:/app/data/postgres16 - ./data/postgres17:/app/data/postgres - /mnt/data/${TAG}/photos:/app/data/photos diff --git a/main.py b/main.py index 776248e..ff9e2bf 100644 --- a/main.py +++ b/main.py @@ -7,10 +7,8 @@ from anyio import create_task_group from fastapi import APIRouter, FastAPI from fastapi.middleware.cors import CORSMiddleware -from sqlalchemy import text from starlette_compress import CompressMiddleware -from db import db_write from json_response import JSONResponseUTF8 from middlewares.cache_control_middleware import CacheControlMiddleware from middlewares.cache_response_middleware import CacheResponseMiddleware @@ -26,10 +24,6 @@ async def lifespan(_): worker_state = await WorkerService.init() if worker_state.is_primary: - async with db_write() as session: - await session.connection(execution_options={'isolation_level': 'AUTOCOMMIT'}) - await session.execute(text('VACUUM ANALYZE')) - async with create_task_group() as tg: await tg.start(CountryService.update_db_task) await tg.start(AEDService.update_db_task) diff --git a/shell.nix b/shell.nix index 5b93906..1ce4254 100644 --- a/shell.nix +++ b/shell.nix @@ -22,15 +22,12 @@ let ''; }); - postgres16 = with pkgs; postgresql_16_jit.withPackages (ps: [ ps.postgis ]); - postgres17 = with pkgs; postgresql_17_jit.withPackages (ps: [ ps.postgis ]); - packages' = with pkgs; [ python' uv ruff coreutils - postgres17 + (postgresql_17_jit.withPackages (ps: [ ps.postgis ])) valkey # Scripts @@ -63,18 +60,6 @@ let --text-search-config=pg_catalog.simple \ --auth=trust \ --username=postgres - - if [ $(cat data/postgres16/PG_VERSION) = "16" ]; then - mkdir -p /tmp/openaedmap-postgres - cp data/postgres/pg_hba.conf data/postgres16/pg_hba.conf - ${postgres16}/bin/pg_ctl start -o "-c config_file=config/postgres.conf" -D data/postgres16 - ${postgres16}/bin/pg_dump -h localhost -U postgres -d postgres -F c -Z 3 -f backup.pgdump - ${postgres16}/bin/pg_ctl stop -D data/postgres16 - ${postgres17}/bin/pg_ctl start -o "-c config_file=config/postgres.conf" -D data/postgres - ${postgres17}/bin/pg_restore -h localhost -U postgres -d postgres backup.pgdump - ${postgres17}/bin/pg_ctl stop -D data/postgres - rm backup.pgdump - fi fi mkdir -p /tmp/openaedmap-postgres data/supervisor