From 198506f0626a057704d00c3e9935cc91c3641d04 Mon Sep 17 00:00:00 2001 From: "MH.Dmitrii" Date: Sat, 29 Aug 2026 13:04:41 +0300 Subject: [PATCH] db change --- .gitignore | 1 + configs/.env.example | 8 +- docker/compose-dev.yaml | 63 ++++ docker/dockerfile | 32 +- makefile | 16 +- poetry.lock | 281 +++++++++++++----- pyproject.toml | 5 +- src/logging/logger.py | 6 +- src/migrations/env.py | 2 +- src/migrations/versions/23dd6d3efe4b_.py | 32 -- src/migrations/versions/2f92088cdce4_.py | 32 -- src/migrations/versions/385d4efec15f_.py | 50 ---- src/migrations/versions/439a77f8a4d4_.py | 69 ----- src/migrations/versions/74814eb1b7f8_.py | 32 -- src/migrations/versions/75074097a2a3_.py | 103 ------- src/migrations/versions/8c136ff14180_.py | 32 -- src/migrations/versions/8c300c4d43ea_.py | 40 --- src/migrations/versions/ebe80cd28822_.py | 46 --- .../{5e60c8fbc553_.py => f4018d3509eb_.py} | 150 ++++++++-- src/models/configs_read/env.py | 6 + src/models/database_models/model.py | 4 +- 21 files changed, 455 insertions(+), 555 deletions(-) delete mode 100644 src/migrations/versions/23dd6d3efe4b_.py delete mode 100644 src/migrations/versions/2f92088cdce4_.py delete mode 100644 src/migrations/versions/385d4efec15f_.py delete mode 100644 src/migrations/versions/439a77f8a4d4_.py delete mode 100644 src/migrations/versions/74814eb1b7f8_.py delete mode 100644 src/migrations/versions/75074097a2a3_.py delete mode 100644 src/migrations/versions/8c136ff14180_.py delete mode 100644 src/migrations/versions/8c300c4d43ea_.py delete mode 100644 src/migrations/versions/ebe80cd28822_.py rename src/migrations/versions/{5e60c8fbc553_.py => f4018d3509eb_.py} (52%) diff --git a/.gitignore b/.gitignore index c323f24..3d509c5 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,7 @@ Thumbs.db *.env #db *.db +DB/ #logs logs/ diff --git a/configs/.env.example b/configs/.env.example index 4bf8b14..1682bc3 100644 --- a/configs/.env.example +++ b/configs/.env.example @@ -1,4 +1,10 @@ SECRET_KEY = "change_me" ALGORITHM = "HS256" ACCESS_TOKEN_EXPIRE_MINUTES = 15 -REFRESH_TOKEN_EXPIRE_DAYS= 45 \ No newline at end of file +REFRESH_TOKEN_EXPIRE_DAYS= 45 + +DB_USER="change_me" +DB_PASSWORD="change_me" +DB_POSTGRESS="change_me" +DB_HOST="change_me" +DB_PORT="change_me" \ No newline at end of file diff --git a/docker/compose-dev.yaml b/docker/compose-dev.yaml index 006b5ee..883596d 100644 --- a/docker/compose-dev.yaml +++ b/docker/compose-dev.yaml @@ -11,6 +11,8 @@ services: target: dev init: true #Manage processes and reap zombies ipc: private #Inter-Process Communication (IPC) namespace for high-performance applications + environment: + - DB_HOST=psql volumes: - type: bind source: ../src @@ -32,6 +34,11 @@ services: target: /home/excel-project/logs networks: - backend + depends_on: + psql: + condition: service_healthy + migration: + condition: service_completed_successfully ports: - "80:8000" entrypoint: ["./entrypoint.sh", "--dev"] @@ -46,6 +53,8 @@ services: target: prod init: true #Manage processes and reap zombies ipc: private #Inter-Process Communication (IPC) namespace for high-performance applications + environment: + - DB_HOST=psql volumes: - type: bind source: ../configs @@ -62,9 +71,63 @@ services: networks: - backend restart: unless-stopped + depends_on: + psql: + condition: service_healthy + migration: + condition: service_completed_successfully ports: - "80:8000" + psql: + profiles: ["prod", "dev", "db"] + image: postgres:16-alpine + container_name: psql + init: true + ipc: private + environment: + POSTGRES_USER: ${DB_USER} + POSTGRES_PASSWORD: ${DB_PASSWORD} + POSTGRES_DB: ${DB_POSTGRESS} + volumes: + - type: bind + source: ../DB + target: /var/lib/postgresql/data + networks: + - backend + restart: unless-stopped + healthcheck: + test: ["CMD-SHELL", "pg_isready -U ${DB_USER} -d ${DB_POSTGRESS}"] + interval: 5s + timeout: 5s + retries: 5 + ports: + - "5432:5432" + + + migration: + profiles: ["prod", "dev"] + image: "${DOCKER_REGISTRY:-local}/migration-tool:${IMAGE_TAG:-local}" + build: + dockerfile: ./docker/dockerfile + context: ../ + target: migration-tool + environment: + - DB_HOST=psql + volumes: + - type: bind + source: ../configs + target: /home/excel-project/configs + - type: bind + source: ../src/migrations + target: /home/excel-project/src/migrations + + depends_on: + - psql + networks: + - backend + + networks: backend: name: "${BACKEND_NETWORK:-backend_network}" \ No newline at end of file diff --git a/docker/dockerfile b/docker/dockerfile index 36e24b2..36626ab 100644 --- a/docker/dockerfile +++ b/docker/dockerfile @@ -1,8 +1,8 @@ # --- Stage 1: Python Backend dev --- FROM python:3.14-slim AS dev -LABEL org.opencontainers.image.title="the-great-excel-project-dev" -LABEL org.opencontainers.image.source="https://git.homyk.space/MH.Dmitrii/The_Great_Excel_Project" +LABEL org.opencontainers.image.title="The-DisExcel-project-dev" +LABEL org.opencontainers.image.source="https://git.homyk.space/MH.Dmitrii/The_DisExcel_project" WORKDIR /home/excel-project @@ -18,8 +18,8 @@ RUN pip install --no-cache-dir --break-system-packages poetry \ FROM python:3.14-slim AS prod -LABEL org.opencontainers.image.title="the-great-excel-project-prod" -LABEL org.opencontainers.image.source="https://git.homyk.space/MH.Dmitrii/The_Great_Excel_Project" +LABEL org.opencontainers.image.title="The-DisExcel-project-prod" +LABEL org.opencontainers.image.source="https://git.homyk.space/MH.Dmitrii/The_DisExcel_project" WORKDIR /home/excel-project @@ -39,3 +39,27 @@ RUN groupadd --gid 1000 appuser \ USER appuser ENTRYPOINT ["./entrypoint.sh", "--prod"] + + +FROM python:3.14-slim AS migration-tool + +LABEL org.opencontainers.image.title="The-DisExcel-project" +LABEL org.opencontainers.image.source="https://git.homyk.space/MH.Dmitrii/The_DisExcel_project" + +WORKDIR /home/excel-project + +COPY pyproject.toml poetry.lock alembic.ini ./ +COPY src/models/database_models ./src/models/database_models +COPY src/models/configs_read ./src/models/configs_read + +RUN pip install --no-cache-dir --break-system-packages poetry \ + && poetry config virtualenvs.create false \ + && poetry install --no-root --no-interaction --only main + +RUN groupadd --gid 1000 appuser \ + && useradd --uid 1000 --gid appuser --shell /bin/bash --create-home appuser \ + && chown -R appuser:appuser /home/excel-project + +USER appuser + +CMD ["alembic", "upgrade", "head"] \ No newline at end of file diff --git a/makefile b/makefile index ec68e8c..9df9efe 100644 --- a/makefile +++ b/makefile @@ -3,6 +3,8 @@ ALLURE:=.venv/allure-2.44.0/bin/allure #linux&macos #ALLURE=.venv\allure-2.44.0\bin\allure #Windows NUM_DOWN ?= 1 +#make run-dev BUILD=--build +BUILD ?= .DEFAULT_GOAL := help @@ -15,23 +17,27 @@ help: ## .PHONY: run run: ## Run dev local application - ${VENV} uvicorn main:app --host 0.0.0.0 --port 8000 --reload + docker compose -f docker/compose-dev.yaml --env-file configs/.env --profile db up -d && ${VENV} uvicorn main:app --host 0.0.0.0 --port 8000 --reload + +.PHONY: down +down: ## Down dev local db + docker compose -f docker/compose-dev.yaml --env-file configs/.env --profile db down .PHONY: run-dev run-dev: ## Run dev application - docker compose -f docker/compose-dev.yaml --profile dev up -d + docker compose -f docker/compose-dev.yaml --env-file configs/.env --profile dev up -d ${BUILD} .PHONY: run-prod run-prod: ## Run prod application - docker compose -f docker/compose-dev.yaml --profile prod up -d + docker compose -f docker/compose-dev.yaml --env-file configs/.env --profile prod up -d ${BUILD} .PHONY: down-dev down-dev: ## Down dev application - docker compose -f docker/compose-dev.yaml --profile dev down + docker compose -f docker/compose-dev.yaml --env-file configs/.env --profile dev down .PHONY: down-prod down-prod: ## Down prod application - docker compose -f docker/compose-dev.yaml --profile prod down + docker compose -f docker/compose-dev.yaml --env-file configs/.env --profile prod down ## ## Migration section diff --git a/poetry.lock b/poetry.lock index ed3aef2..783393d 100644 --- a/poetry.lock +++ b/poetry.lock @@ -12,22 +12,6 @@ files = [ {file = "aiofiles-25.1.0.tar.gz", hash = "sha256:a8d728f0a29de45dc521f18f07297428d56992a742f0cd2701ba86e44d23d5b2"}, ] -[[package]] -name = "aiosqlite" -version = "0.22.1" -description = "asyncio bridge to the standard sqlite3 module" -optional = false -python-versions = ">=3.9" -groups = ["main"] -files = [ - {file = "aiosqlite-0.22.1-py3-none-any.whl", hash = "sha256:21c002eb13823fad740196c5a2e9d8e62f6243bd9e7e4a1f87fb5e44ecb4fceb"}, - {file = "aiosqlite-0.22.1.tar.gz", hash = "sha256:043e0bd78d32888c0a9ca90fc788b38796843360c855a7262a532813133a0650"}, -] - -[package.extras] -dev = ["attribution (==1.8.0)", "black (==25.11.0)", "build (>=1.2)", "coverage[toml] (==7.10.7)", "flake8 (==7.3.0)", "flake8-bugbear (==24.12.12)", "flit (==3.12.0)", "mypy (==1.19.0)", "ufmt (==2.8.0)", "usort (==1.0.8.post1)"] -docs = ["sphinx (==8.1.3)", "sphinx-mdinclude (==0.6.2)"] - [[package]] name = "alembic" version = "1.18.5" @@ -138,6 +122,76 @@ files = [ astroid = ["astroid (>=2,<5)"] test = ["astroid (>=2,<5)", "pytest (<9.0)", "pytest-cov", "pytest-xdist"] +[[package]] +name = "asyncpg" +version = "0.31.0" +description = "An asyncio PostgreSQL driver" +optional = false +python-versions = ">=3.9.0" +groups = ["main"] +files = [ + {file = "asyncpg-0.31.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:831712dd3cf117eec68575a9b50da711893fd63ebe277fc155ecae1c6c9f0f61"}, + {file = "asyncpg-0.31.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:0b17c89312c2f4ccea222a3a6571f7df65d4ba2c0e803339bfc7bed46a96d3be"}, + {file = "asyncpg-0.31.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:3faa62f997db0c9add34504a68ac2c342cfee4d57a0c3062fcf0d86c7f9cb1e8"}, + {file = "asyncpg-0.31.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:8ea599d45c361dfbf398cb67da7fd052affa556a401482d3ff1ee99bd68808a1"}, + {file = "asyncpg-0.31.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:795416369c3d284e1837461909f58418ad22b305f955e625a4b3a2521d80a5f3"}, + {file = "asyncpg-0.31.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:a8d758dac9d2e723e173d286ef5e574f0b350ec00e9186fce84d0fc5f6a8e6b8"}, + {file = "asyncpg-0.31.0-cp310-cp310-win32.whl", hash = "sha256:2d076d42eb583601179efa246c5d7ae44614b4144bc1c7a683ad1222814ed095"}, + {file = "asyncpg-0.31.0-cp310-cp310-win_amd64.whl", hash = "sha256:9ea33213ac044171f4cac23740bed9a3805abae10e7025314cfbd725ec670540"}, + {file = "asyncpg-0.31.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:eee690960e8ab85063ba93af2ce128c0f52fd655fdff9fdb1a28df01329f031d"}, + {file = "asyncpg-0.31.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:2657204552b75f8288de08ca60faf4a99a65deef3a71d1467454123205a88fab"}, + {file = "asyncpg-0.31.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:a429e842a3a4b4ea240ea52d7fe3f82d5149853249306f7ff166cb9948faa46c"}, + {file = "asyncpg-0.31.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c0807be46c32c963ae40d329b3a686356e417f674c976c07fa49f1b30303f109"}, + {file = "asyncpg-0.31.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:e5d5098f63beeae93512ee513d4c0c53dc12e9aa2b7a1af5a81cddf93fe4e4da"}, + {file = "asyncpg-0.31.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:37fc6c00a814e18eef51833545d1891cac9aa69140598bb076b4cd29b3e010b9"}, + {file = "asyncpg-0.31.0-cp311-cp311-win32.whl", hash = "sha256:5a4af56edf82a701aece93190cc4e094d2df7d33f6e915c222fb09efbb5afc24"}, + {file = "asyncpg-0.31.0-cp311-cp311-win_amd64.whl", hash = "sha256:480c4befbdf079c14c9ca43c8c5e1fe8b6296c96f1f927158d4f1e750aacc047"}, + {file = "asyncpg-0.31.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:b44c31e1efc1c15188ef183f287c728e2046abb1d26af4d20858215d50d91fad"}, + {file = "asyncpg-0.31.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:0c89ccf741c067614c9b5fc7f1fc6f3b61ab05ae4aaa966e6fd6b93097c7d20d"}, + {file = "asyncpg-0.31.0-cp312-cp312-manylinux_2_28_aarch64.whl", hash = "sha256:12b3b2e39dc5470abd5e98c8d3373e4b1d1234d9fbdedf538798b2c13c64460a"}, + {file = "asyncpg-0.31.0-cp312-cp312-manylinux_2_28_x86_64.whl", hash = "sha256:aad7a33913fb8bcb5454313377cc330fbb19a0cd5faa7272407d8a0c4257b671"}, + {file = "asyncpg-0.31.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:3df118d94f46d85b2e434fd62c84cb66d5834d5a890725fe625f498e72e4d5ec"}, + {file = "asyncpg-0.31.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:bd5b6efff3c17c3202d4b37189969acf8927438a238c6257f66be3c426beba20"}, + {file = "asyncpg-0.31.0-cp312-cp312-win32.whl", hash = "sha256:027eaa61361ec735926566f995d959ade4796f6a49d3bde17e5134b9964f9ba8"}, + {file = "asyncpg-0.31.0-cp312-cp312-win_amd64.whl", hash = "sha256:72d6bdcbc93d608a1158f17932de2321f68b1a967a13e014998db87a72ed3186"}, + {file = "asyncpg-0.31.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:c204fab1b91e08b0f47e90a75d1b3c62174dab21f670ad6c5d0f243a228f015b"}, + {file = "asyncpg-0.31.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:54a64f91839ba59008eccf7aad2e93d6e3de688d796f35803235ea1c4898ae1e"}, + {file = "asyncpg-0.31.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c0e0822b1038dc7253b337b0f3f676cadc4ac31b126c5d42691c39691962e403"}, + {file = "asyncpg-0.31.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:bef056aa502ee34204c161c72ca1f3c274917596877f825968368b2c33f585f4"}, + {file = "asyncpg-0.31.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:0bfbcc5b7ffcd9b75ab1558f00db2ae07db9c80637ad1b2469c43df79d7a5ae2"}, + {file = "asyncpg-0.31.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:22bc525ebbdc24d1261ecbf6f504998244d4e3be1721784b5f64664d61fbe602"}, + {file = "asyncpg-0.31.0-cp313-cp313-win32.whl", hash = "sha256:f890de5e1e4f7e14023619399a471ce4b71f5418cd67a51853b9910fdfa73696"}, + {file = "asyncpg-0.31.0-cp313-cp313-win_amd64.whl", hash = "sha256:dc5f2fa9916f292e5c5c8b2ac2813763bcd7f58e130055b4ad8a0531314201ab"}, + {file = "asyncpg-0.31.0-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:f6b56b91bb0ffc328c4e3ed113136cddd9deefdf5f79ab448598b9772831df44"}, + {file = "asyncpg-0.31.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:334dec28cf20d7f5bb9e45b39546ddf247f8042a690bff9b9573d00086e69cb5"}, + {file = "asyncpg-0.31.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:98cc158c53f46de7bb677fd20c417e264fc02b36d901cc2a43bd6cb0dc6dbfd2"}, + {file = "asyncpg-0.31.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:9322b563e2661a52e3cdbc93eed3be7748b289f792e0011cb2720d278b366ce2"}, + {file = "asyncpg-0.31.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:19857a358fc811d82227449b7ca40afb46e75b33eb8897240c3839dd8b744218"}, + {file = "asyncpg-0.31.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:ba5f8886e850882ff2c2ace5732300e99193823e8107e2c53ef01c1ebfa1e85d"}, + {file = "asyncpg-0.31.0-cp314-cp314-win32.whl", hash = "sha256:cea3a0b2a14f95834cee29432e4ddc399b95700eb1d51bbc5bfee8f31fa07b2b"}, + {file = "asyncpg-0.31.0-cp314-cp314-win_amd64.whl", hash = "sha256:04d19392716af6b029411a0264d92093b6e5e8285ae97a39957b9a9c14ea72be"}, + {file = "asyncpg-0.31.0-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:bdb957706da132e982cc6856bb2f7b740603472b54c3ebc77fe60ea3e57e1bd2"}, + {file = "asyncpg-0.31.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:6d11b198111a72f47154fa03b85799f9be63701e068b43f84ac25da0bda9cb31"}, + {file = "asyncpg-0.31.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:18c83b03bc0d1b23e6230f5bf8d4f217dc9bc08644ce0502a9d91dc9e634a9c7"}, + {file = "asyncpg-0.31.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:e009abc333464ff18b8f6fd146addffd9aaf63e79aa3bb40ab7a4c332d0c5e9e"}, + {file = "asyncpg-0.31.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:3b1fbcb0e396a5ca435a8826a87e5c2c2cc0c8c68eb6fadf82168056b0e53a8c"}, + {file = "asyncpg-0.31.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:8df714dba348efcc162d2adf02d213e5fab1bd9f557e1305633e851a61814a7a"}, + {file = "asyncpg-0.31.0-cp314-cp314t-win32.whl", hash = "sha256:1b41f1afb1033f2b44f3234993b15096ddc9cd71b21a42dbd87fc6a57b43d65d"}, + {file = "asyncpg-0.31.0-cp314-cp314t-win_amd64.whl", hash = "sha256:bd4107bb7cdd0e9e65fae66a62afd3a249663b844fa34d479f6d5b3bef9c04c3"}, + {file = "asyncpg-0.31.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:ebb3cde58321a1f89ce41812be3f2a98dddedc1e76d0838aba1d724f1e4e1a95"}, + {file = "asyncpg-0.31.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:e6974f36eb9a224d8fb428bcf66bd411aa12cf57c2967463178149e73d4de366"}, + {file = "asyncpg-0.31.0-cp39-cp39-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:bc2b685f400ceae428f79f78b58110470d7b4466929a7f78d455964b17ad1008"}, + {file = "asyncpg-0.31.0-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:bb223567dea5f47c45d347f2bde5486be8d9f40339f27217adb3fb1c3be51298"}, + {file = "asyncpg-0.31.0-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:22be6e02381bab3101cd502d9297ac71e2f966c86e20e78caead9934c98a8af6"}, + {file = "asyncpg-0.31.0-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:37a58919cfef2448a920df00d1b2f821762d17194d0dbf355d6dde8d952c04f9"}, + {file = "asyncpg-0.31.0-cp39-cp39-win32.whl", hash = "sha256:c1a9c5b71d2371a2290bc93336cd05ba4ec781683cab292adbddc084f89443c6"}, + {file = "asyncpg-0.31.0-cp39-cp39-win_amd64.whl", hash = "sha256:c1e1ab5bc65373d92dd749d7308c5b26fb2dc0fbe5d3bf68a32b676aa3bcd24a"}, + {file = "asyncpg-0.31.0.tar.gz", hash = "sha256:c989386c83940bfbd787180f2b1519415e2d3d6277a70d9d0f0145ac73500735"}, +] + +[package.extras] +gssauth = ["gssapi ; platform_system != \"Windows\"", "sspilib ; platform_system == \"Windows\""] + [[package]] name = "attrs" version = "26.1.0" @@ -1489,6 +1543,83 @@ files = [ dev = ["abi3audit", "black", "check-manifest", "colorama ; os_name == \"nt\"", "coverage", "packaging", "psleak", "pylint", "pyperf", "pypinfo", "pyreadline3 ; os_name == \"nt\"", "pytest", "pytest-cov", "pytest-instafail", "pytest-xdist", "pywin32 ; os_name == \"nt\" and implementation_name != \"pypy\"", "requests", "rstcheck", "ruff", "setuptools", "sphinx", "sphinx_rtd_theme", "toml-sort", "twine", "validate-pyproject[all]", "virtualenv", "vulture", "wheel", "wheel ; os_name == \"nt\" and implementation_name != \"pypy\"", "wmi ; os_name == \"nt\" and implementation_name != \"pypy\""] test = ["psleak", "pytest", "pytest-instafail", "pytest-xdist", "pywin32 ; os_name == \"nt\" and implementation_name != \"pypy\"", "setuptools", "wheel ; os_name == \"nt\" and implementation_name != \"pypy\"", "wmi ; os_name == \"nt\" and implementation_name != \"pypy\""] +[[package]] +name = "psycopg2-binary" +version = "2.9.12" +description = "psycopg2 - Python-PostgreSQL Database Adapter" +optional = false +python-versions = ">=3.9" +groups = ["main"] +files = [ + {file = "psycopg2_binary-2.9.12-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:9b818ceff717f98851a64bffd4c5eb5b3059ae280276dcecc52ac658dcf006a4"}, + {file = "psycopg2_binary-2.9.12-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:d2fa0d7caca8635c56e373055094eeda3208d901d55dd0ff5abc1d4e47f82b56"}, + {file = "psycopg2_binary-2.9.12-cp310-cp310-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:864c261b3690e1207d14bbfe0a61e27567981b80c47a778561e49f676f7ce433"}, + {file = "psycopg2_binary-2.9.12-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:c5ee5213445dd45312459029b8c4c0a695461eb517b753d2582315bd07995f5e"}, + {file = "psycopg2_binary-2.9.12-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:6f9cae1f848779b5b01f417e762c40d026ea93eb0648249a604728cda991dde3"}, + {file = "psycopg2_binary-2.9.12-cp310-cp310-manylinux_2_38_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:63a3ebbd543d3d1eda088ac99164e8c5bac15293ee91f20281fd17d050aee1c4"}, + {file = "psycopg2_binary-2.9.12-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:d6fcbba8c9fed08a73b8ac61ea79e4821e45b1e92bb466230c5e746bbf3d5256"}, + {file = "psycopg2_binary-2.9.12-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:36512911ebb2b60a0c3e44d0bb5048c1980aced91235d133b7874f3d1d93487c"}, + {file = "psycopg2_binary-2.9.12-cp310-cp310-musllinux_1_2_riscv64.whl", hash = "sha256:8ffdb59fe88f99589e34354a130217aa1fd2d615612402d6edc8b3dbc7a44463"}, + {file = "psycopg2_binary-2.9.12-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:a46fe069b65255df410f856d842bc235f90e22ffdf532dda625fd4213d3fd9b1"}, + {file = "psycopg2_binary-2.9.12-cp310-cp310-win_amd64.whl", hash = "sha256:ab29414b25dcb698bf26bf213e3348abdcd07bbd5de032a5bec15bd75b298b03"}, + {file = "psycopg2_binary-2.9.12-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:5c8ce6c61bd1b1f6b9c24ee32211599f6166af2c55abb19456090a21fd16554b"}, + {file = "psycopg2_binary-2.9.12-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:b4a9eaa6e7f4ff91bec10aa3fb296878e75187bced5cc4bafe17dc40915e1326"}, + {file = "psycopg2_binary-2.9.12-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:c6528cefc8e50fcc6f4a107e27a672058b36cc5736d665476aeb413ba88dbb06"}, + {file = "psycopg2_binary-2.9.12-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:e4e184b1fb6072bf05388aa41c697e1b2d01b3473f107e7ec44f186a32cfd0b8"}, + {file = "psycopg2_binary-2.9.12-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:4766ab678563054d3f1d064a4db19cc4b5f9e3a8d9018592a8285cf200c248f3"}, + {file = "psycopg2_binary-2.9.12-cp311-cp311-manylinux_2_38_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:5a0253224780c978746cb9be55a946bcdaf40fe3519c0f622924cdabdafe2c39"}, + {file = "psycopg2_binary-2.9.12-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:0dc9228d47c46bda253d2ecd6bb93b56a9f2d7ad33b684a1fa3622bf74ffe30c"}, + {file = "psycopg2_binary-2.9.12-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:f921f3cd87035ef7df233383011d7a53ea1d346224752c1385f1edfd790ceb6a"}, + {file = "psycopg2_binary-2.9.12-cp311-cp311-musllinux_1_2_riscv64.whl", hash = "sha256:3d999bd982a723113c1a45b55a7a6a90d64d0ed2278020ed625c490ff7bef96c"}, + {file = "psycopg2_binary-2.9.12-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:29d4d134bd0ab46ffb04e94aa3c5fa3ef582e9026609165e2f758ff76fc3a3be"}, + {file = "psycopg2_binary-2.9.12-cp311-cp311-win_amd64.whl", hash = "sha256:cb4a1dacdd48077150dc762a9e5ddbf32c256d66cb46f80839391aa458774936"}, + {file = "psycopg2_binary-2.9.12-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:5cdc05117180c5fa9c40eea8ea559ce64d73824c39d928b7da9fb5f6a9392433"}, + {file = "psycopg2_binary-2.9.12-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:d3227a3bc228c10d21011a99245edca923e4e8bf461857e869a507d9a41fe9f6"}, + {file = "psycopg2_binary-2.9.12-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:995ce929eede89db6254b50827e2b7fd61e50d11f0b116b29fffe4a2e53c4580"}, + {file = "psycopg2_binary-2.9.12-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:9fe06d93e72f1c048e731a2e3e7854a5bfaa58fc736068df90b352cefe66f03f"}, + {file = "psycopg2_binary-2.9.12-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:40e7b28b63aaf737cb3a1edc3a9bbc9a9f4ad3dcb7152e8c1130e4050eddcb7d"}, + {file = "psycopg2_binary-2.9.12-cp312-cp312-manylinux_2_38_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:89d19a9f7899e8eb0656a2b3a08e0da04c720a06db6e0033eab5928aabe60fa9"}, + {file = "psycopg2_binary-2.9.12-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:612b965daee295ae2da8f8218ce1d274645dc76ef3f1abf6a0a94fd57eff876d"}, + {file = "psycopg2_binary-2.9.12-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:b9a339b79d37c1b45f3235265f07cdeb0cb5ad7acd2ac7720a5920989c17c24e"}, + {file = "psycopg2_binary-2.9.12-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:3471336e1acfd9c7fe507b8bad5af9317b6a89294f9eb37bd9a030bb7bebcdc6"}, + {file = "psycopg2_binary-2.9.12-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:7af18183109e23502c8b2ae7f6926c0882766f35b5175a4cd737ad825e4d7a1b"}, + {file = "psycopg2_binary-2.9.12-cp312-cp312-win_amd64.whl", hash = "sha256:398fcd4db988c7d7d3713e2b8e18939776fd3fb447052daae4f24fa39daede4c"}, + {file = "psycopg2_binary-2.9.12-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:7c729a73c7b1b84de3582f73cdd27d905121dc2c531f3d9a3c32a3011033b965"}, + {file = "psycopg2_binary-2.9.12-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:4413d0caef93c5cf50b96863df4c2efe8c269bf2267df353225595e7e15e8df7"}, + {file = "psycopg2_binary-2.9.12-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:4dfcf8e45ebb0c663be34a3442f65e17311f3367089cd4e5e3a3e8e62c978777"}, + {file = "psycopg2_binary-2.9.12-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:c41321a14dd74aceb6a9a643b9253a334521babfa763fa873e33d89cfa122fb5"}, + {file = "psycopg2_binary-2.9.12-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:83946ba43979ebfdc99a3cd0ee775c89f221df026984ba19d46133d8d75d3cd9"}, + {file = "psycopg2_binary-2.9.12-cp313-cp313-manylinux_2_38_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:411e85815652d13560fbe731878daa5d92378c4995a22302071890ec3397d019"}, + {file = "psycopg2_binary-2.9.12-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:1c8ad4c08e00f7679559eaed7aff1edfffc60c086b976f93972f686384a95e2c"}, + {file = "psycopg2_binary-2.9.12-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:00814e40fa23c2b37ef0a1e3c749d89982c73a9cb5046137f0752a22d432e82f"}, + {file = "psycopg2_binary-2.9.12-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:98062447aebc20ed20add1f547a364fd0ef8933640d5372ff1873f8deb9b61be"}, + {file = "psycopg2_binary-2.9.12-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:66a7685d7e548f10fb4ce32fb01a7b7f4aa702134de92a292c7bd9e0d3dbd290"}, + {file = "psycopg2_binary-2.9.12-cp313-cp313-win_amd64.whl", hash = "sha256:b6937f5fe4e180aeee87de907a2fa982ded6f7f15d7218f78a083e4e1d68f2a0"}, + {file = "psycopg2_binary-2.9.12-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:6f3b3de8a74ef8db215f22edffb19e32dc6fa41340456de7ec99efdc8a7b3ec2"}, + {file = "psycopg2_binary-2.9.12-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:1006fb62f0f0bc5ce256a832356c6262e91be43f5e4eb15b5eaf38079464caf2"}, + {file = "psycopg2_binary-2.9.12-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:840066105706cd2eb29b9a1c2329620056582a4bf3e8169dec5c447042d0869f"}, + {file = "psycopg2_binary-2.9.12-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:863f5d12241ebe1c76a72a04c2113b6dc905f90b9cef0e9be0efd994affd9354"}, + {file = "psycopg2_binary-2.9.12-cp314-cp314-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:a99eaab34a9010f1a086b126de467466620a750634d114d20455f3a824aae033"}, + {file = "psycopg2_binary-2.9.12-cp314-cp314-manylinux_2_38_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:ffdd7dc5463ccd61845ac37b7012d0f35a1548df9febe14f8dd549be4a0bc81e"}, + {file = "psycopg2_binary-2.9.12-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:54a0dfecab1b48731f934e06139dfe11e24219fb6d0ceb32177cf0375f14c7b5"}, + {file = "psycopg2_binary-2.9.12-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:96937c9c5d891f772430f418a7a8b4691a90c3e6b93cf72b5bd7cad8cbca32a5"}, + {file = "psycopg2_binary-2.9.12-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:77b348775efd4cdab410ec6609d81ccecd1139c90265fa583a7255c8064bc03d"}, + {file = "psycopg2_binary-2.9.12-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:527e6342b3e44c2f0544f6b8e927d60de7f163f5723b8f1dfa7d2a84298738cd"}, + {file = "psycopg2_binary-2.9.12-cp314-cp314-win_amd64.whl", hash = "sha256:f12ae41fcafadb39b2785e64a40f9db05d6de2ac114077457e0e7c597f3af980"}, + {file = "psycopg2_binary-2.9.12-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:ee2d84ef5eb6c04702d2e9c372ad557fb027f26a5d82804f749dfb14c7fdd2ab"}, + {file = "psycopg2_binary-2.9.12-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:cfa2517c94ea3af6deb46f81e1bbd884faa63e28481eb2f889989dd8d95e5f03"}, + {file = "psycopg2_binary-2.9.12-cp39-cp39-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:ba3df2fc42a1cfa45b72cf096d4acb2b885937eedc61461081d53538d4a82a86"}, + {file = "psycopg2_binary-2.9.12-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:718e1fc18edf573b02cb8aea868de8d8d33f99ce9620206aa9144b67b0985e94"}, + {file = "psycopg2_binary-2.9.12-cp39-cp39-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5c7cb4cbf894a1d36c720d713de507952c7c58f66d30834708f03dbe5c822ccf"}, + {file = "psycopg2_binary-2.9.12-cp39-cp39-manylinux_2_38_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:049366c6d884bdcd65d66e6ca1fdbebe670b56c6c9ba46f164e6667e90881964"}, + {file = "psycopg2_binary-2.9.12-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:fb1828cf3da68f99e45ebce1355d65d2d12b6a78fb5dfb16247aad6bdef5f5d2"}, + {file = "psycopg2_binary-2.9.12-cp39-cp39-musllinux_1_2_ppc64le.whl", hash = "sha256:127467c6e476dd876634f17c3d870530e73ff454ff99bff73d36e80af28e1115"}, + {file = "psycopg2_binary-2.9.12-cp39-cp39-musllinux_1_2_riscv64.whl", hash = "sha256:ace94261f43850e9e79f6c56636c5e0147978ab79eda5e5e5ebf13ae146fc8fe"}, + {file = "psycopg2_binary-2.9.12-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:a7e39a65b7d2a20e4ba2e0aaad1960b61cc2888d6ab047769f8347bd3c9ad915"}, + {file = "psycopg2_binary-2.9.12-cp39-cp39-win_amd64.whl", hash = "sha256:f625abb7020e4af3432d95342daa1aa0db3fa369eed19807aa596367ba791b10"}, + {file = "psycopg2_binary-2.9.12.tar.gz", hash = "sha256:5ac9444edc768c02a6b6a591f070b8aae28ff3a99be57560ac996001580f294c"}, +] + [[package]] name = "ptyprocess" version = "0.7.0" @@ -2034,74 +2165,68 @@ files = [ [[package]] name = "sqlalchemy" -version = "2.0.51" +version = "2.0.52" description = "Database Abstraction Library" optional = false python-versions = ">=3.7" groups = ["main"] files = [ - {file = "sqlalchemy-2.0.51-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:0e8203d2fbd5c6254692ef0a72c740d75b2f3c7ca345404f4c1a4604813c77c0"}, - {file = "sqlalchemy-2.0.51-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:1af05726b3d0cdba1c55284bf408fd3b792e690fe2399bfb8304565551cda652"}, - {file = "sqlalchemy-2.0.51-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:2e54ff2dd657f2e3e0fbf2b097db1182f7bfea263eca4353f00065bae2a67c3d"}, - {file = "sqlalchemy-2.0.51-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:1e47b1199c2e832e325eacabc8d32d2487f58c9358f97e9a00f5eb93c5680d84"}, - {file = "sqlalchemy-2.0.51-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:c68568f3facf8f66fa76c60e0ced69b67666ffa9941d1d0a3756fda196049080"}, - {file = "sqlalchemy-2.0.51-cp310-cp310-win32.whl", hash = "sha256:0592bdadf86ddcabfd72d9ab66ea8a5d8d2cc6be1cc51fa7e66c03868ac5eac1"}, - {file = "sqlalchemy-2.0.51-cp310-cp310-win_amd64.whl", hash = "sha256:740cf6f35351b1ac3d82369152acf1d51d37e3dcf85d4dc0a22ca01410eabe2a"}, - {file = "sqlalchemy-2.0.51-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:1aa10c0daee6705294d181daadaa793221e1a59ed55000a3fab1d42b088ce4ba"}, - {file = "sqlalchemy-2.0.51-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:a5b2ed6d828f1f09bd812861f4f59ca3bc3803f9df871f4555187f0faf018604"}, - {file = "sqlalchemy-2.0.51-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:436728ce18a80f6951a1e11cc6112c2ede9faf20766f1a26195a7c441ca12dbd"}, - {file = "sqlalchemy-2.0.51-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:dc261707bf5739aea8a541593f3cc1d463c2701fb05fbcbba0ce031b69a21260"}, - {file = "sqlalchemy-2.0.51-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:a6d26094615306d116dd5e4a51b0304c99dd2356fc569eed6922a80a6bd3b265"}, - {file = "sqlalchemy-2.0.51-cp311-cp311-win32.whl", hash = "sha256:ca8435d13829b92f4a97362d91975154a4015db3a2634154e1754e9a915e6b86"}, - {file = "sqlalchemy-2.0.51-cp311-cp311-win_amd64.whl", hash = "sha256:4a011ea4510683319ce4ed274b56ee05194b39b6da9d09ca7a39388f0fa84dcc"}, - {file = "sqlalchemy-2.0.51-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:7d78702b26ba1c18b2d0fb2ea940ba7f17a9581b42e8361ff93920ebbee1235a"}, - {file = "sqlalchemy-2.0.51-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:581921d849d6e6f994d560389192955e80e2950e18fcdfe2ccea863e01158e6e"}, - {file = "sqlalchemy-2.0.51-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:1d21ce524ab86c23046e992a5b81cb54c21079c6df6e78b8fc77d77cac70a6b9"}, - {file = "sqlalchemy-2.0.51-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:c5d98a2709840027f5a347c3af0a7c3d5f6c1ff93af2ca1c54494e23cba8f389"}, - {file = "sqlalchemy-2.0.51-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:1181256e0f16479691b5616d36375dc2620ad8332b25978763c3d206ad3f3f1d"}, - {file = "sqlalchemy-2.0.51-cp312-cp312-win32.whl", hash = "sha256:9f380393be5abeb6815f68fd39271b95127173511b6706b0a630a9995d53f8f5"}, - {file = "sqlalchemy-2.0.51-cp312-cp312-win_amd64.whl", hash = "sha256:2cf39aabdf48e87c1c2c2ed6d20d33ffa0733b3071ce9c5f66357947dd009080"}, - {file = "sqlalchemy-2.0.51-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:7c2056838b6685b72fdb36c99996cf862753461a62f2e84f4196371d3b2d6a07"}, - {file = "sqlalchemy-2.0.51-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:483b11bd46bf35fc14c52faf338b04300c9e6ce554bce9b11be85bfec3bc3195"}, - {file = "sqlalchemy-2.0.51-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:1bed1ee8b01da6088210aa9412023326fb98a599ba502e6118308601dcbef77f"}, - {file = "sqlalchemy-2.0.51-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:72ca54c952107ba5cd58854b67a5a6268631289d21651a1235396f3b98b47400"}, - {file = "sqlalchemy-2.0.51-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:b3e693d15533a45cd5906f0589f9c35090bef6ef45bf1e8195c424aa0ae06a8d"}, - {file = "sqlalchemy-2.0.51-cp313-cp313-win32.whl", hash = "sha256:b93ab07b5292dbe7e6b8da89475275e7042744283921344b56105f3eeb0f828b"}, - {file = "sqlalchemy-2.0.51-cp313-cp313-win_amd64.whl", hash = "sha256:0f053118c30e53161857a953e4de667d90e274980dccbe5dd3829bbbeece72a5"}, - {file = "sqlalchemy-2.0.51-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:6ea306caaae6bd5afd0a46050003c88f6bf33227377a49298c498c3cb88ff491"}, - {file = "sqlalchemy-2.0.51-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c45a496d6bc05dec41dcd4c3a2b183723f47473255c159cd80b503c8f246424d"}, - {file = "sqlalchemy-2.0.51-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:4004ada0aafe8ae1991b2cd1d99c6d9146126e123bd6f883c260d974aa012e54"}, - {file = "sqlalchemy-2.0.51-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:0f6bcad487aee1c638d707235682fc96f741de00663619881ab235400d03289e"}, - {file = "sqlalchemy-2.0.51-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:39a76529db6305693d8d4affa58ad5b5e2e18edd62daea628b29b97930b3513d"}, - {file = "sqlalchemy-2.0.51-cp314-cp314-win32.whl", hash = "sha256:08a204d8b5638717c26a24df18fcf40af45a6b22e35b70b1d62f0113c2e278e8"}, - {file = "sqlalchemy-2.0.51-cp314-cp314-win_amd64.whl", hash = "sha256:96747bfbadb055466e5b46d572618170046b45ce5a4879167f50d70a5319a499"}, - {file = "sqlalchemy-2.0.51-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:e5ea1a213be1fcd5e49d9904c3b9939211ded90bc2a64e93f4c01963474285de"}, - {file = "sqlalchemy-2.0.51-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:7c6b36ed71f41942bdcd2ad2522be46bfce09d5705be5640ecf19bbc7660e4b7"}, - {file = "sqlalchemy-2.0.51-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:0c2c62877097e1a0db401fba5cb4debee33265e5b2a55c4ccb489c02c53b4f72"}, - {file = "sqlalchemy-2.0.51-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:0378d055e9e8cd6ce4d8dff683bdd3d7d413533c4ee51d67a2b1e0f9eacc0f23"}, - {file = "sqlalchemy-2.0.51-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:6e46fc36029eff666391e0531e5387b62ce6c4f1d8e50b3fb3099eaca1b42522"}, - {file = "sqlalchemy-2.0.51-cp314-cp314t-win32.whl", hash = "sha256:9161cfc9efce70d1715f47d6ff40f79c6778c00d53be4fbc09d70301e4b83ba7"}, - {file = "sqlalchemy-2.0.51-cp314-cp314t-win_amd64.whl", hash = "sha256:159bb6ba32059f57ad7375a8f50d844dd2f19d14954ecf820cd33e20debd46b2"}, - {file = "sqlalchemy-2.0.51-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:bb1f5062f98b0b3290e72b707747fdd7e0f22d6956b236ba7ca7f5c9971d2da2"}, - {file = "sqlalchemy-2.0.51-cp38-cp38-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:247acaa29ccef6250dfd6a3eedf8f94ddf23564180a39fe362e32ae9dbdbde46"}, - {file = "sqlalchemy-2.0.51-cp38-cp38-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c95ef01f53233a305a874a44a63fbfb1d81cd79b49de0f8529b3548cde437e37"}, - {file = "sqlalchemy-2.0.51-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:fa268106c8987639a17a18514cfe0cd9bf17420ab887e1e1bf486da8836135b1"}, - {file = "sqlalchemy-2.0.51-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:b7f08588854bbb724041d9ae9d980d40040c922382e1d9a2ecb390edc4fd5032"}, - {file = "sqlalchemy-2.0.51-cp38-cp38-win32.whl", hash = "sha256:6b588fd681ddf0c196b8df1ea49a8913514894b2b8f945a9511b4b48871f99c8"}, - {file = "sqlalchemy-2.0.51-cp38-cp38-win_amd64.whl", hash = "sha256:ca216e8af5c05e326efc7e28716ac2381a7cf9791749f5ee1849dccdc99c9b00"}, - {file = "sqlalchemy-2.0.51-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:aa18ae738b5170e253ad0bb6c4b0f07585081e8a6e50893e4d911d47b39a0904"}, - {file = "sqlalchemy-2.0.51-cp39-cp39-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:59cab3686b1bc039dd9cded2f8d0c08a246e84e76bd4ab5b4f18c7cdae293825"}, - {file = "sqlalchemy-2.0.51-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:111604e637da87031255ddc26c7d7bc22bc6af6f5d459ccff3af1b4660233a85"}, - {file = "sqlalchemy-2.0.51-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:ad30ae663711786303fbcd46a47516302d201ee49a877cb3fac61f672895110a"}, - {file = "sqlalchemy-2.0.51-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:b21f0e7efc7a5c509e953784e9d1575ebb8b4318960e7e7d7a93bb803626cf64"}, - {file = "sqlalchemy-2.0.51-cp39-cp39-win32.whl", hash = "sha256:a42ad6afcbaaa777241e347aa2e29155993045a0d6b7db74da61053ffe875fe0"}, - {file = "sqlalchemy-2.0.51-cp39-cp39-win_amd64.whl", hash = "sha256:2a97eaad21c84b4ef8010b11eeba9fe6153eb0b3df3ff8b6abc309df1b978ef7"}, - {file = "sqlalchemy-2.0.51-py3-none-any.whl", hash = "sha256:bb024d8b621d0be75f4f44ecc7c950450026e76d66dc8f791bb5331d7fed59d5"}, - {file = "sqlalchemy-2.0.51.tar.gz", hash = "sha256:804dccd8a4a6242c4e30ad961e540e18a588f6527202f2d6791b01845d59fdc9"}, + {file = "sqlalchemy-2.0.52-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:a7438774e1091192fc50a2bd8ceff5c596912d00ecd46587e88effdea7826101"}, + {file = "sqlalchemy-2.0.52-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:6c1b7ed45bf87b214e0a9def9c2313949067efe6269db5ef18d542ee13250af7"}, + {file = "sqlalchemy-2.0.52-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:309cc8ba50fc5d2174189dfcd49cdf7aa711f8346afcff19f2642ae4fc449c14"}, + {file = "sqlalchemy-2.0.52-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:2f9eccf8793c8c3f8dd2dfd11b9e400cb27d1d19370ef732b66017e212107822"}, + {file = "sqlalchemy-2.0.52-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:9255ceb65a80c1b001129060b63ee776a2e9c288be3b662be36dfbb888fffdcd"}, + {file = "sqlalchemy-2.0.52-cp310-cp310-win32.whl", hash = "sha256:2e15b1d1116a64fc399b8c2694a83f3e792fdc58df28514a81e1dc4f8cf22729"}, + {file = "sqlalchemy-2.0.52-cp310-cp310-win_amd64.whl", hash = "sha256:11560064cc4696e772298b6221ede59e646386d9f2a85d549365473b972f7850"}, + {file = "sqlalchemy-2.0.52-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:e0c3ce43907374889f3352bdcc6195c970148a2cb71574cd0237a5071a37fb6c"}, + {file = "sqlalchemy-2.0.52-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:7a0d48c4b80717c61385b4e966e087c839a66cfd7b780641dcb428f4dba65608"}, + {file = "sqlalchemy-2.0.52-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:938325a5373267afc53bfbe72983b20fbd64ca47842aac62433c3da1137ecff1"}, + {file = "sqlalchemy-2.0.52-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:5f8438a98d49424acf69d0d53c0a522951dfe49a6f2d86417fbb37ad3066ab43"}, + {file = "sqlalchemy-2.0.52-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:4699dbb8d396d199e7e78fd4d525e3ad3d6008a9c8c0160b87e74c606c2c3736"}, + {file = "sqlalchemy-2.0.52-cp311-cp311-win32.whl", hash = "sha256:cef328349452ae152637df4d11ce5a0919ecdf0a363e16c830c3518ee33bde72"}, + {file = "sqlalchemy-2.0.52-cp311-cp311-win_amd64.whl", hash = "sha256:f1c850792a3b25a3ad74dade3f05e4f402cdebfea27438bcadafaa1617f77bcc"}, + {file = "sqlalchemy-2.0.52-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:be8c49131665dfe2cc74c498aa1240ffb548d0fd901325dd11c2c7a18956f727"}, + {file = "sqlalchemy-2.0.52-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:1b2d9e507a458832adcfbd8af6e2036ddf069b7710b799448542ebccae2dceee"}, + {file = "sqlalchemy-2.0.52-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:8738008376d22f30f411ea3efecf39b51110b6996d80bb73786f30bcfdd5fd3b"}, + {file = "sqlalchemy-2.0.52-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:37a4d548327b6cab9c7d8cdb4e0e82feabee0110c4d150059068e2d1cfbd99ee"}, + {file = "sqlalchemy-2.0.52-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:e49f51a5d59857a7a0dcaf9469febf7197d9394bd88f00d69c2c4e848112cdbf"}, + {file = "sqlalchemy-2.0.52-cp312-cp312-win32.whl", hash = "sha256:afda3ec521d0517d0de783fc70030775841900896d832de5bbd066549290470e"}, + {file = "sqlalchemy-2.0.52-cp312-cp312-win_amd64.whl", hash = "sha256:2d5e53e36e37129fe0be8b9d08b6e4052c10a963ee6cda56c8c10dcc194b99ca"}, + {file = "sqlalchemy-2.0.52-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:2eb3c6a64b1bfe6704777cfd504e7b8ad093a5f3e03ce67663a5e6742f294e43"}, + {file = "sqlalchemy-2.0.52-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:923bb183c1dc64fdf7b717965e3d59938ec4f8b8710b419a21ce403e5da9a9e1"}, + {file = "sqlalchemy-2.0.52-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:651d6d8782e80679e6151707c7b490834d46ada526328895abf567f25e63d29c"}, + {file = "sqlalchemy-2.0.52-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:b08cddb8989775e3c88799d86704bdfc3ee6e9846118201aa5997f16f27e3a15"}, + {file = "sqlalchemy-2.0.52-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:ab66fa9618269390d4dfa222f2f2f88f7bc4bf5da13905131b818217db7e8057"}, + {file = "sqlalchemy-2.0.52-cp313-cp313-win32.whl", hash = "sha256:c63bda077685c85ca513286547a531ba57e7a68cf0a7ed3bafcc2bbd18896f4d"}, + {file = "sqlalchemy-2.0.52-cp313-cp313-win_amd64.whl", hash = "sha256:9876b09b9f1ce7398b0ffece585c0a911244c53191187341f6bcae640e133751"}, + {file = "sqlalchemy-2.0.52-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:410d52be41d17f1a236d19520fbe776257dc16516ed06bd16d433311842aefd9"}, + {file = "sqlalchemy-2.0.52-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:dfe9ce533dbe4d0a2ae1486546619bd30b76bcd670539a44d910361376175f5e"}, + {file = "sqlalchemy-2.0.52-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:812bae5138bfc0aa46fb0686da0fc7f581f68e2bbb05bc24c3713bebaedd1437"}, + {file = "sqlalchemy-2.0.52-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:50bff43b632a56fbf5ed9afdd76307e1512b62051bcd5afb341ae67205bbb6c8"}, + {file = "sqlalchemy-2.0.52-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:49565daf5af554f538e23aef1fc81a95a4e49658f152285e45c02f5fc44f04cd"}, + {file = "sqlalchemy-2.0.52-cp314-cp314-win32.whl", hash = "sha256:ab9da41e61b9979b910499d633b241df20c51ee5037e5405b11c2faac3cbe1a2"}, + {file = "sqlalchemy-2.0.52-cp314-cp314-win_amd64.whl", hash = "sha256:a593db51b3bae75db17a5738ad5f992244b3a03863f83c28117ee482c6a3f76d"}, + {file = "sqlalchemy-2.0.52-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:c1e61d08bdf4ee2f41024569e3400de7d6734ba498144766b11260936ccfa582"}, + {file = "sqlalchemy-2.0.52-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:1b92a1e23ed40022081217b40d2d1feba4f77064e69ef4f39f68bcbbd148452a"}, + {file = "sqlalchemy-2.0.52-cp38-cp38-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:77a247d3fd179f6583171e7e0e98f40dc6642ed4f655557515a5a7e25923e9a4"}, + {file = "sqlalchemy-2.0.52-cp38-cp38-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:cd9206024b8602e7518bbaf44016c29e0045722f09328d8e654941023920d0b3"}, + {file = "sqlalchemy-2.0.52-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:46f0c46f0d360d727b84660b26c62b295d82306ec2c82b701e97747d2c6dcbe1"}, + {file = "sqlalchemy-2.0.52-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:df8f213ceb485d8227b74935eb87ba0d80169a8401eba7835da6e30d6727dac4"}, + {file = "sqlalchemy-2.0.52-cp38-cp38-win32.whl", hash = "sha256:f2b09029ef6f260409eefa5dc2b8276f6c3d7b892bfb50d50e8f852257d4a6b4"}, + {file = "sqlalchemy-2.0.52-cp38-cp38-win_amd64.whl", hash = "sha256:765f439da5bc8696973bc0c8a31fae0912ac3ff1cb9d66246a6b2728ee4fbbc8"}, + {file = "sqlalchemy-2.0.52-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:4b89e93bb89eabdbea9d5d3fa2d6cc6544e733c33064339f91e5292480cf130e"}, + {file = "sqlalchemy-2.0.52-cp39-cp39-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:8cf993f065bc04caa5000b339e8d9d6f3d9d00251511f850147c516c9e07115f"}, + {file = "sqlalchemy-2.0.52-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:cce4922535db73f9dbb91e3db2b3e851ac629467fd1ebd8e354a60e369521c63"}, + {file = "sqlalchemy-2.0.52-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:2f5fa2b2aca75d2c7f36db3a8dd04717b6fbfd1a964fb32bdeae16698e475ab3"}, + {file = "sqlalchemy-2.0.52-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:f4d4f7afc682961dc567db70e00a7b5bd81ccd3743c46199b0257f0744902dde"}, + {file = "sqlalchemy-2.0.52-cp39-cp39-win32.whl", hash = "sha256:de89de5b5798cafdd7ef7b7b804acec246d6152922128fd9d156cd1701271aff"}, + {file = "sqlalchemy-2.0.52-cp39-cp39-win_amd64.whl", hash = "sha256:3c95c3044edddb65e4a2f7194ec52ca5a9736f72d33ca3a6fa4196aedcc689fd"}, + {file = "sqlalchemy-2.0.52-py3-none-any.whl", hash = "sha256:3b81b8363a919ce53453591cdb93702e6bd54ade6c4fa2f468fc053baee5ed89"}, + {file = "sqlalchemy-2.0.52.tar.gz", hash = "sha256:5e2d46356ac2ccb7d268ab6c2319ac6a2b42f1b8d5fd8bd3d46855cd82abee97"}, ] [package.dependencies] -greenlet = {version = ">=1", markers = "platform_machine == \"aarch64\" or platform_machine == \"ppc64le\" or platform_machine == \"x86_64\" or platform_machine == \"amd64\" or platform_machine == \"AMD64\" or platform_machine == \"win32\" or platform_machine == \"WIN32\""} +greenlet = {version = ">=1", optional = true, markers = "platform_machine == \"aarch64\" or platform_machine == \"ppc64le\" or platform_machine == \"x86_64\" or platform_machine == \"amd64\" or platform_machine == \"AMD64\" or platform_machine == \"win32\" or platform_machine == \"WIN32\" or extra == \"asyncio\""} typing-extensions = ">=4.6.0" [package.extras] @@ -2109,7 +2234,7 @@ aiomysql = ["aiomysql (>=0.2.0)", "greenlet (>=1)"] aioodbc = ["aioodbc", "greenlet (>=1)"] aiosqlite = ["aiosqlite", "greenlet (>=1)", "typing_extensions (!=3.10.0.1)"] asyncio = ["greenlet (>=1)"] -asyncmy = ["asyncmy (>=0.2.3,!=0.2.4,!=0.2.6)", "greenlet (>=1)"] +asyncmy = ["asyncmy (>=0.2.12)", "greenlet (>=1)"] mariadb-connector = ["mariadb (>=1.0.1,!=1.1.2,!=1.1.5,!=1.1.10)"] mssql = ["pyodbc"] mssql-pymssql = ["pymssql"] @@ -2275,4 +2400,4 @@ files = [ [metadata] lock-version = "2.1" python-versions = ">=3.13" -content-hash = "ab9787e2afb0885dd340270dcdff2b44a81cbf34bc03fc9ac1e9ffb1fdf476f4" +content-hash = "f507694d0ef7cad070da5cc13f689e93240a272af43b3dd64b1a9ec2b3bbbea4" diff --git a/pyproject.toml b/pyproject.toml index 310aa65..f1d4834 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,14 +16,15 @@ dependencies = [ "fastapi (>=0.139.1,<0.140.0)", "pydantic[email] (>=2.13.4,<3.0.0)", "pydantic-settings (>=2.14.2,<3.0.0)", - "sqlalchemy (>=2.0.51,<3.0.0)", + "sqlalchemy[asyncio] (>=2.0.52,<3.0.0)", "pandas (>=3.0.3,<4.0.0)", "bcrypt (>=5.0.0,<6.0.0)", "python-jose (>=3.5.0,<4.0.0)", "python-multipart (>=0.0.32,<0.0.33)", - "aiosqlite (>=0.22.1,<0.23.0)", "greenlet (>=3.5.4,<4.0.0)", "aiofiles (>=25.1.0,<26.0.0)", + "asyncpg (>=0.31.0,<0.32.0)", + "psycopg2-binary (>=2.9.12,<3.0.0)", ] [tool.poetry.group.dev.dependencies] diff --git a/src/logging/logger.py b/src/logging/logger.py index 77a7d70..4af530c 100644 --- a/src/logging/logger.py +++ b/src/logging/logger.py @@ -39,7 +39,11 @@ class LoggingMiddleware(BaseHTTPMiddleware): try: body = json.loads(body_bytes) - body=body.get("detail", None) + if not isinstance(body, bool): + body=body.get("detail", None) + else: + body=None + except (json.JSONDecodeError, TypeError): body = None diff --git a/src/migrations/env.py b/src/migrations/env.py index 0d0adce..ae2225a 100644 --- a/src/migrations/env.py +++ b/src/migrations/env.py @@ -6,7 +6,7 @@ from sqlalchemy import create_engine, pool from src.models.database_models import Model from src.models.database_models.model import engine -sync_url = engine.url.render_as_string(hide_password=False).replace("+aiosqlite", "") +sync_url = engine.url.render_as_string(hide_password=False).replace("+asyncpg", "") sync_engine = create_engine(sync_url, poolclass=pool.NullPool) # this is the Alembic Config object, which provides diff --git a/src/migrations/versions/23dd6d3efe4b_.py b/src/migrations/versions/23dd6d3efe4b_.py deleted file mode 100644 index 10ecfdf..0000000 --- a/src/migrations/versions/23dd6d3efe4b_.py +++ /dev/null @@ -1,32 +0,0 @@ -"""empty message - -Revision ID: 23dd6d3efe4b -Revises: 2f92088cdce4 -Create Date: 2026-07-23 13:05:12.553687 - -""" -from typing import Sequence, Union - -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision: str = '23dd6d3efe4b' -down_revision: Union[str, Sequence[str], None] = '2f92088cdce4' -branch_labels: Union[str, Sequence[str], None] = None -depends_on: Union[str, Sequence[str], None] = None - - -def upgrade() -> None: - """Upgrade schema.""" - # ### commands auto generated by Alembic - please adjust! ### - pass - # ### end Alembic commands ### - - -def downgrade() -> None: - """Downgrade schema.""" - # ### commands auto generated by Alembic - please adjust! ### - pass - # ### end Alembic commands ### diff --git a/src/migrations/versions/2f92088cdce4_.py b/src/migrations/versions/2f92088cdce4_.py deleted file mode 100644 index f063d55..0000000 --- a/src/migrations/versions/2f92088cdce4_.py +++ /dev/null @@ -1,32 +0,0 @@ -"""empty message - -Revision ID: 2f92088cdce4 -Revises: 75074097a2a3 -Create Date: 2026-07-23 11:05:02.409697 - -""" -from typing import Sequence, Union - -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision: str = '2f92088cdce4' -down_revision: Union[str, Sequence[str], None] = '75074097a2a3' -branch_labels: Union[str, Sequence[str], None] = None -depends_on: Union[str, Sequence[str], None] = None - - -def upgrade() -> None: - """Upgrade schema.""" - # ### commands auto generated by Alembic - please adjust! ### - pass - # ### end Alembic commands ### - - -def downgrade() -> None: - """Downgrade schema.""" - # ### commands auto generated by Alembic - please adjust! ### - pass - # ### end Alembic commands ### diff --git a/src/migrations/versions/385d4efec15f_.py b/src/migrations/versions/385d4efec15f_.py deleted file mode 100644 index cd11529..0000000 --- a/src/migrations/versions/385d4efec15f_.py +++ /dev/null @@ -1,50 +0,0 @@ -"""empty message - -Revision ID: 385d4efec15f -Revises: 23dd6d3efe4b -Create Date: 2026-07-23 15:03:33.582896 - -""" -from typing import Sequence, Union - -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision: str = '385d4efec15f' -down_revision: Union[str, Sequence[str], None] = '23dd6d3efe4b' -branch_labels: Union[str, Sequence[str], None] = None -depends_on: Union[str, Sequence[str], None] = None - - -def upgrade() -> None: - """Upgrade schema.""" - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('refresh_tokens', schema=None) as batch_op: - batch_op.alter_column('id', - existing_type=sa.INTEGER(), - type_=sa.Uuid(), - existing_nullable=False) - batch_op.alter_column('replaced_by', - existing_type=sa.INTEGER(), - type_=sa.Uuid(), - existing_nullable=True) - - # ### end Alembic commands ### - - -def downgrade() -> None: - """Downgrade schema.""" - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('refresh_tokens', schema=None) as batch_op: - batch_op.alter_column('replaced_by', - existing_type=sa.Uuid(), - type_=sa.INTEGER(), - existing_nullable=True) - batch_op.alter_column('id', - existing_type=sa.Uuid(), - type_=sa.INTEGER(), - existing_nullable=False) - - # ### end Alembic commands ### diff --git a/src/migrations/versions/439a77f8a4d4_.py b/src/migrations/versions/439a77f8a4d4_.py deleted file mode 100644 index 84c6829..0000000 --- a/src/migrations/versions/439a77f8a4d4_.py +++ /dev/null @@ -1,69 +0,0 @@ -"""empty message - -Revision ID: 439a77f8a4d4 -Revises: 5e60c8fbc553 -Create Date: 2026-07-22 15:19:15.853280 - -""" -from typing import Sequence, Union - -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision: str = '439a77f8a4d4' -down_revision: Union[str, Sequence[str], None] = '5e60c8fbc553' -branch_labels: Union[str, Sequence[str], None] = None -depends_on: Union[str, Sequence[str], None] = None - - -def upgrade() -> None: - """Upgrade schema.""" - # ### commands auto generated by Alembic - please adjust! ### - op.create_table('markets', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('name', sa.String(length=64), nullable=False), - sa.PrimaryKeyConstraint('id', name=op.f('pk_markets')), - sa.UniqueConstraint('name', name=op.f('uq_markets_name')) - ) - with op.batch_alter_table('markets', schema=None) as batch_op: - batch_op.create_index(batch_op.f('ix_markets_id'), ['id'], unique=False) - - with op.batch_alter_table('reports', schema=None) as batch_op: - batch_op.add_column(sa.Column('doc_id', sa.Uuid(), nullable=False)) - batch_op.add_column(sa.Column('uploaded_at', sa.TIMESTAMP(), nullable=False)) - batch_op.add_column(sa.Column('doc_date', sa.TIMESTAMP(), nullable=False)) - batch_op.add_column(sa.Column('status', sa.String(length=64), nullable=False)) - batch_op.add_column(sa.Column('user_id', sa.Uuid(), nullable=False)) - batch_op.add_column(sa.Column('market_id', sa.Integer(), nullable=False)) - batch_op.create_index(batch_op.f('ix_reports_market_id'), ['market_id'], unique=False) - batch_op.create_index(batch_op.f('ix_reports_user_id'), ['user_id'], unique=False) - batch_op.create_unique_constraint(batch_op.f('uq_reports_doc_id'), ['doc_id']) - batch_op.create_foreign_key(batch_op.f('fk_reports_user_id_users'), 'users', ['user_id'], ['id'], ondelete='CASCADE') - batch_op.create_foreign_key(batch_op.f('fk_reports_market_id_markets'), 'markets', ['market_id'], ['id'], ondelete='CASCADE') - - # ### end Alembic commands ### - - -def downgrade() -> None: - """Downgrade schema.""" - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('reports', schema=None) as batch_op: - batch_op.drop_constraint(batch_op.f('fk_reports_market_id_markets'), type_='foreignkey') - batch_op.drop_constraint(batch_op.f('fk_reports_user_id_users'), type_='foreignkey') - batch_op.drop_constraint(batch_op.f('uq_reports_doc_id'), type_='unique') - batch_op.drop_index(batch_op.f('ix_reports_user_id')) - batch_op.drop_index(batch_op.f('ix_reports_market_id')) - batch_op.drop_column('market_id') - batch_op.drop_column('user_id') - batch_op.drop_column('status') - batch_op.drop_column('doc_date') - batch_op.drop_column('uploaded_at') - batch_op.drop_column('doc_id') - - with op.batch_alter_table('markets', schema=None) as batch_op: - batch_op.drop_index(batch_op.f('ix_markets_id')) - - op.drop_table('markets') - # ### end Alembic commands ### diff --git a/src/migrations/versions/74814eb1b7f8_.py b/src/migrations/versions/74814eb1b7f8_.py deleted file mode 100644 index edc89c0..0000000 --- a/src/migrations/versions/74814eb1b7f8_.py +++ /dev/null @@ -1,32 +0,0 @@ -"""empty message - -Revision ID: 74814eb1b7f8 -Revises: 8c136ff14180 -Create Date: 2026-07-23 21:06:37.254211 - -""" -from typing import Sequence, Union - -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision: str = '74814eb1b7f8' -down_revision: Union[str, Sequence[str], None] = '8c136ff14180' -branch_labels: Union[str, Sequence[str], None] = None -depends_on: Union[str, Sequence[str], None] = None - - -def upgrade() -> None: - """Upgrade schema.""" - # ### commands auto generated by Alembic - please adjust! ### - pass - # ### end Alembic commands ### - - -def downgrade() -> None: - """Downgrade schema.""" - # ### commands auto generated by Alembic - please adjust! ### - pass - # ### end Alembic commands ### diff --git a/src/migrations/versions/75074097a2a3_.py b/src/migrations/versions/75074097a2a3_.py deleted file mode 100644 index c7d7781..0000000 --- a/src/migrations/versions/75074097a2a3_.py +++ /dev/null @@ -1,103 +0,0 @@ -"""empty message - -Revision ID: 75074097a2a3 -Revises: 8c300c4d43ea -Create Date: 2026-07-22 16:11:08.077455 - -""" -from typing import Sequence, Union - -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision: str = '75074097a2a3' -down_revision: Union[str, Sequence[str], None] = '8c300c4d43ea' -branch_labels: Union[str, Sequence[str], None] = None -depends_on: Union[str, Sequence[str], None] = None - - -def upgrade() -> None: - """Upgrade schema.""" - # ### commands auto generated by Alembic - please adjust! ### - op.create_table('accountant_settings', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('name', sa.String(length=64), nullable=False), - sa.Column('database_key', sa.Uuid(), nullable=False), - sa.PrimaryKeyConstraint('id', name=op.f('pk_accountant_settings')), - sa.UniqueConstraint('database_key', name=op.f('uq_accountant_settings_database_key')) - ) - with op.batch_alter_table('accountant_settings', schema=None) as batch_op: - batch_op.create_index(batch_op.f('ix_accountant_settings_id'), ['id'], unique=False) - batch_op.create_index(batch_op.f('ix_accountant_settings_name'), ['name'], unique=True) - - op.create_table('doc_types', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('name', sa.String(length=64), nullable=False), - sa.PrimaryKeyConstraint('id', name=op.f('pk_doc_types')) - ) - with op.batch_alter_table('doc_types', schema=None) as batch_op: - batch_op.create_index(batch_op.f('ix_doc_types_id'), ['id'], unique=False) - batch_op.create_index(batch_op.f('ix_doc_types_name'), ['name'], unique=True) - - op.create_table('fabric', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('name', sa.String(length=64), nullable=False), - sa.PrimaryKeyConstraint('id', name=op.f('pk_fabric')) - ) - with op.batch_alter_table('fabric', schema=None) as batch_op: - batch_op.create_index(batch_op.f('ix_fabric_id'), ['id'], unique=False) - batch_op.create_index(batch_op.f('ix_fabric_name'), ['name'], unique=True) - - op.create_table('goods', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('article', sa.String(length=16), nullable=False), - sa.Column('price', sa.Numeric(precision=10, scale=2), nullable=False), - sa.Column('tnvd', sa.Integer(), nullable=False), - sa.Column('doc_type_id', sa.Integer(), nullable=False), - sa.Column('fabric_id', sa.Integer(), nullable=False), - sa.Column('status', sa.Boolean(), nullable=False), - sa.ForeignKeyConstraint(['doc_type_id'], ['doc_types.id'], name=op.f('fk_goods_doc_type_id_doc_types'), ondelete='CASCADE'), - sa.ForeignKeyConstraint(['fabric_id'], ['fabric.id'], name=op.f('fk_goods_fabric_id_fabric'), ondelete='CASCADE'), - sa.PrimaryKeyConstraint('id', name=op.f('pk_goods')) - ) - with op.batch_alter_table('goods', schema=None) as batch_op: - batch_op.create_index(batch_op.f('ix_goods_article'), ['article'], unique=True) - batch_op.create_index(batch_op.f('ix_goods_doc_type_id'), ['doc_type_id'], unique=False) - batch_op.create_index(batch_op.f('ix_goods_fabric_id'), ['fabric_id'], unique=False) - batch_op.create_index(batch_op.f('ix_goods_id'), ['id'], unique=False) - batch_op.create_index(batch_op.f('ix_goods_price'), ['price'], unique=False) - batch_op.create_index(batch_op.f('ix_goods_tnvd'), ['tnvd'], unique=True) - - # ### end Alembic commands ### - - -def downgrade() -> None: - """Downgrade schema.""" - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('goods', schema=None) as batch_op: - batch_op.drop_index(batch_op.f('ix_goods_tnvd')) - batch_op.drop_index(batch_op.f('ix_goods_price')) - batch_op.drop_index(batch_op.f('ix_goods_id')) - batch_op.drop_index(batch_op.f('ix_goods_fabric_id')) - batch_op.drop_index(batch_op.f('ix_goods_doc_type_id')) - batch_op.drop_index(batch_op.f('ix_goods_article')) - - op.drop_table('goods') - with op.batch_alter_table('fabric', schema=None) as batch_op: - batch_op.drop_index(batch_op.f('ix_fabric_name')) - batch_op.drop_index(batch_op.f('ix_fabric_id')) - - op.drop_table('fabric') - with op.batch_alter_table('doc_types', schema=None) as batch_op: - batch_op.drop_index(batch_op.f('ix_doc_types_name')) - batch_op.drop_index(batch_op.f('ix_doc_types_id')) - - op.drop_table('doc_types') - with op.batch_alter_table('accountant_settings', schema=None) as batch_op: - batch_op.drop_index(batch_op.f('ix_accountant_settings_name')) - batch_op.drop_index(batch_op.f('ix_accountant_settings_id')) - - op.drop_table('accountant_settings') - # ### end Alembic commands ### diff --git a/src/migrations/versions/8c136ff14180_.py b/src/migrations/versions/8c136ff14180_.py deleted file mode 100644 index 3154207..0000000 --- a/src/migrations/versions/8c136ff14180_.py +++ /dev/null @@ -1,32 +0,0 @@ -"""empty message - -Revision ID: 8c136ff14180 -Revises: 385d4efec15f -Create Date: 2026-07-23 17:56:26.345954 - -""" -from typing import Sequence, Union - -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision: str = '8c136ff14180' -down_revision: Union[str, Sequence[str], None] = '385d4efec15f' -branch_labels: Union[str, Sequence[str], None] = None -depends_on: Union[str, Sequence[str], None] = None - - -def upgrade() -> None: - """Upgrade schema.""" - # ### commands auto generated by Alembic - please adjust! ### - pass - # ### end Alembic commands ### - - -def downgrade() -> None: - """Downgrade schema.""" - # ### commands auto generated by Alembic - please adjust! ### - pass - # ### end Alembic commands ### diff --git a/src/migrations/versions/8c300c4d43ea_.py b/src/migrations/versions/8c300c4d43ea_.py deleted file mode 100644 index a314882..0000000 --- a/src/migrations/versions/8c300c4d43ea_.py +++ /dev/null @@ -1,40 +0,0 @@ -"""empty message - -Revision ID: 8c300c4d43ea -Revises: 439a77f8a4d4 -Create Date: 2026-07-22 15:20:34.871724 - -""" -from typing import Sequence, Union - -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision: str = '8c300c4d43ea' -down_revision: Union[str, Sequence[str], None] = '439a77f8a4d4' -branch_labels: Union[str, Sequence[str], None] = None -depends_on: Union[str, Sequence[str], None] = None - - -def upgrade() -> None: - """Upgrade schema.""" - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('reports', schema=None) as batch_op: - batch_op.alter_column('uploaded_at', - existing_type=sa.TIMESTAMP(), - nullable=True) - - # ### end Alembic commands ### - - -def downgrade() -> None: - """Downgrade schema.""" - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('reports', schema=None) as batch_op: - batch_op.alter_column('uploaded_at', - existing_type=sa.TIMESTAMP(), - nullable=False) - - # ### end Alembic commands ### diff --git a/src/migrations/versions/ebe80cd28822_.py b/src/migrations/versions/ebe80cd28822_.py deleted file mode 100644 index 9ec7bdd..0000000 --- a/src/migrations/versions/ebe80cd28822_.py +++ /dev/null @@ -1,46 +0,0 @@ -"""empty message - -Revision ID: ebe80cd28822 -Revises: 74814eb1b7f8 -Create Date: 2026-08-21 13:52:49.788041 - -""" -from typing import Sequence, Union - -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision: str = 'ebe80cd28822' -down_revision: Union[str, Sequence[str], None] = '74814eb1b7f8' -branch_labels: Union[str, Sequence[str], None] = None -depends_on: Union[str, Sequence[str], None] = None - - -def upgrade() -> None: - """Upgrade schema.""" - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('user_direct_permissions', schema=None) as batch_op: - batch_op.drop_constraint(batch_op.f('fk_user_direct_permissions_user_id_users'), type_='foreignkey') - batch_op.create_foreign_key(batch_op.f('fk_user_direct_permissions_user_id_users'), 'users', ['user_id'], ['id'], ondelete='CASCADE') - - with op.batch_alter_table('user_group', schema=None) as batch_op: - batch_op.drop_constraint(batch_op.f('fk_user_group_user_id_users'), type_='foreignkey') - batch_op.create_foreign_key(batch_op.f('fk_user_group_user_id_users'), 'users', ['user_id'], ['id'], ondelete='CASCADE') - - # ### end Alembic commands ### - - -def downgrade() -> None: - """Downgrade schema.""" - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('user_group', schema=None) as batch_op: - batch_op.drop_constraint(batch_op.f('fk_user_group_user_id_users'), type_='foreignkey') - batch_op.create_foreign_key(batch_op.f('fk_user_group_user_id_users'), 'users', ['user_id'], ['id']) - - with op.batch_alter_table('user_direct_permissions', schema=None) as batch_op: - batch_op.drop_constraint(batch_op.f('fk_user_direct_permissions_user_id_users'), type_='foreignkey') - batch_op.create_foreign_key(batch_op.f('fk_user_direct_permissions_user_id_users'), 'users', ['user_id'], ['id']) - - # ### end Alembic commands ### diff --git a/src/migrations/versions/5e60c8fbc553_.py b/src/migrations/versions/f4018d3509eb_.py similarity index 52% rename from src/migrations/versions/5e60c8fbc553_.py rename to src/migrations/versions/f4018d3509eb_.py index e26773e..e061a2e 100644 --- a/src/migrations/versions/5e60c8fbc553_.py +++ b/src/migrations/versions/f4018d3509eb_.py @@ -1,18 +1,18 @@ """empty message -Revision ID: 5e60c8fbc553 +Revision ID: f4018d3509eb Revises: -Create Date: 2026-07-17 20:02:01.237457 +Create Date: 2026-08-28 12:45:18.014540 """ from typing import Sequence, Union from alembic import op import sqlalchemy as sa -from sqlalchemy.sql import text + # revision identifiers, used by Alembic. -revision: str = '5e60c8fbc553' +revision: str = 'f4018d3509eb' down_revision: Union[str, Sequence[str], None] = None branch_labels: Union[str, Sequence[str], None] = None depends_on: Union[str, Sequence[str], None] = None @@ -21,6 +21,35 @@ depends_on: Union[str, Sequence[str], None] = None def upgrade() -> None: """Upgrade schema.""" # ### commands auto generated by Alembic - please adjust! ### + op.create_table('accountant_settings', + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('name', sa.String(length=64), nullable=False), + sa.Column('database_key', sa.Uuid(), nullable=False), + sa.PrimaryKeyConstraint('id', name=op.f('pk_accountant_settings')), + sa.UniqueConstraint('database_key', name=op.f('uq_accountant_settings_database_key')) + ) + with op.batch_alter_table('accountant_settings', schema=None) as batch_op: + batch_op.create_index(batch_op.f('ix_accountant_settings_id'), ['id'], unique=False) + batch_op.create_index(batch_op.f('ix_accountant_settings_name'), ['name'], unique=True) + + op.create_table('doc_types', + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('name', sa.String(length=64), nullable=False), + sa.PrimaryKeyConstraint('id', name=op.f('pk_doc_types')) + ) + with op.batch_alter_table('doc_types', schema=None) as batch_op: + batch_op.create_index(batch_op.f('ix_doc_types_id'), ['id'], unique=False) + batch_op.create_index(batch_op.f('ix_doc_types_name'), ['name'], unique=True) + + op.create_table('fabric', + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('name', sa.String(length=64), nullable=False), + sa.PrimaryKeyConstraint('id', name=op.f('pk_fabric')) + ) + with op.batch_alter_table('fabric', schema=None) as batch_op: + batch_op.create_index(batch_op.f('ix_fabric_id'), ['id'], unique=False) + batch_op.create_index(batch_op.f('ix_fabric_name'), ['name'], unique=True) + op.create_table('groups_of_permissions', sa.Column('id', sa.Integer(), nullable=False), sa.Column('group', sa.String(length=255), nullable=False), @@ -30,6 +59,15 @@ def upgrade() -> None: with op.batch_alter_table('groups_of_permissions', schema=None) as batch_op: batch_op.create_index(batch_op.f('ix_groups_of_permissions_id'), ['id'], unique=False) + op.create_table('markets', + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('name', sa.String(length=64), nullable=False), + sa.PrimaryKeyConstraint('id', name=op.f('pk_markets')), + sa.UniqueConstraint('name', name=op.f('uq_markets_name')) + ) + with op.batch_alter_table('markets', schema=None) as batch_op: + batch_op.create_index(batch_op.f('ix_markets_id'), ['id'], unique=False) + op.create_table('permissions', sa.Column('id', sa.Integer(), nullable=False), sa.Column('permission', sa.String(length=255), nullable=False), @@ -38,17 +76,6 @@ def upgrade() -> None: ) with op.batch_alter_table('permissions', schema=None) as batch_op: batch_op.create_index(batch_op.f('ix_permissions_id'), ['id'], unique=False) - op.execute(text("INSERT INTO permissions (permission) VALUES ('admin');")) - - op.create_table('reports', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('filename', sa.String(length=255), nullable=False), - sa.Column('created_at', sa.TIMESTAMP(), server_default=sa.text('(CURRENT_TIMESTAMP)'), nullable=False), - sa.PrimaryKeyConstraint('id', name=op.f('pk_reports')) - ) - with op.batch_alter_table('reports', schema=None) as batch_op: - batch_op.create_index(batch_op.f('ix_reports_filename'), ['filename'], unique=False) - batch_op.create_index(batch_op.f('ix_reports_id'), ['id'], unique=False) op.create_table('users', sa.Column('id', sa.Uuid(), nullable=False), @@ -66,6 +93,26 @@ def upgrade() -> None: batch_op.create_index(batch_op.f('ix_users_last_name'), ['last_name'], unique=False) batch_op.create_index(batch_op.f('ix_users_middle_name'), ['middle_name'], unique=False) + op.create_table('goods', + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('article', sa.String(length=16), nullable=False), + sa.Column('price', sa.Numeric(precision=10, scale=2), nullable=False), + sa.Column('tnvd', sa.Integer(), nullable=False), + sa.Column('doc_type_id', sa.Integer(), nullable=False), + sa.Column('fabric_id', sa.Integer(), nullable=False), + sa.Column('status', sa.Boolean(), nullable=False), + sa.ForeignKeyConstraint(['doc_type_id'], ['doc_types.id'], name=op.f('fk_goods_doc_type_id_doc_types'), ondelete='CASCADE'), + sa.ForeignKeyConstraint(['fabric_id'], ['fabric.id'], name=op.f('fk_goods_fabric_id_fabric'), ondelete='CASCADE'), + sa.PrimaryKeyConstraint('id', name=op.f('pk_goods')) + ) + with op.batch_alter_table('goods', schema=None) as batch_op: + batch_op.create_index(batch_op.f('ix_goods_article'), ['article'], unique=True) + batch_op.create_index(batch_op.f('ix_goods_doc_type_id'), ['doc_type_id'], unique=False) + batch_op.create_index(batch_op.f('ix_goods_fabric_id'), ['fabric_id'], unique=False) + batch_op.create_index(batch_op.f('ix_goods_id'), ['id'], unique=False) + batch_op.create_index(batch_op.f('ix_goods_price'), ['price'], unique=False) + batch_op.create_index(batch_op.f('ix_goods_tnvd'), ['tnvd'], unique=True) + op.create_table('group_permission', sa.Column('group_id', sa.Integer(), nullable=False), sa.Column('permission_id', sa.Integer(), nullable=False), @@ -74,15 +121,15 @@ def upgrade() -> None: sa.PrimaryKeyConstraint('group_id', 'permission_id', name=op.f('pk_group_permission')) ) op.create_table('refresh_tokens', - sa.Column('id', sa.Integer(), nullable=False), + sa.Column('id', sa.Uuid(), nullable=False), sa.Column('user_id', sa.Uuid(), nullable=False), sa.Column('token_hash', sa.String(length=255), nullable=False), sa.Column('device_info', sa.String(length=255), nullable=False), sa.Column('ip_address', sa.String(length=45), nullable=False), sa.Column('is_revoked', sa.Boolean(), nullable=False), - sa.Column('expires_at', sa.TIMESTAMP(), nullable=False), - sa.Column('created_at', sa.TIMESTAMP(), server_default=sa.text('(CURRENT_TIMESTAMP)'), nullable=False), - sa.Column('replaced_by', sa.Integer(), nullable=True), + sa.Column('expires_at', sa.TIMESTAMP(timezone=True), nullable=False), + sa.Column('created_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('now()'), nullable=False), + sa.Column('replaced_by', sa.Uuid(), nullable=True), sa.ForeignKeyConstraint(['replaced_by'], ['refresh_tokens.id'], name=op.f('fk_refresh_tokens_replaced_by_refresh_tokens')), sa.ForeignKeyConstraint(['user_id'], ['users.id'], name=op.f('fk_refresh_tokens_user_id_users'), ondelete='CASCADE'), sa.PrimaryKeyConstraint('id', name=op.f('pk_refresh_tokens')), @@ -92,18 +139,39 @@ def upgrade() -> None: batch_op.create_index(batch_op.f('ix_refresh_tokens_id'), ['id'], unique=False) batch_op.create_index(batch_op.f('ix_refresh_tokens_user_id'), ['user_id'], unique=False) + op.create_table('reports', + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('doc_id', sa.Uuid(), nullable=False), + sa.Column('filename', sa.String(length=255), nullable=False), + sa.Column('created_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('now()'), nullable=False), + sa.Column('uploaded_at', sa.TIMESTAMP(timezone=True), nullable=True), + sa.Column('doc_date', sa.TIMESTAMP(timezone=True), nullable=False), + sa.Column('status', sa.String(length=64), nullable=False), + sa.Column('user_id', sa.Uuid(), nullable=False), + sa.Column('market_id', sa.Integer(), nullable=False), + sa.ForeignKeyConstraint(['market_id'], ['markets.id'], name=op.f('fk_reports_market_id_markets'), ondelete='CASCADE'), + sa.ForeignKeyConstraint(['user_id'], ['users.id'], name=op.f('fk_reports_user_id_users'), ondelete='CASCADE'), + sa.PrimaryKeyConstraint('id', name=op.f('pk_reports')), + sa.UniqueConstraint('doc_id', name=op.f('uq_reports_doc_id')) + ) + with op.batch_alter_table('reports', schema=None) as batch_op: + batch_op.create_index(batch_op.f('ix_reports_filename'), ['filename'], unique=False) + batch_op.create_index(batch_op.f('ix_reports_id'), ['id'], unique=False) + batch_op.create_index(batch_op.f('ix_reports_market_id'), ['market_id'], unique=False) + batch_op.create_index(batch_op.f('ix_reports_user_id'), ['user_id'], unique=False) + op.create_table('user_direct_permissions', sa.Column('user_id', sa.Uuid(), nullable=False), sa.Column('permission_id', sa.Integer(), nullable=False), sa.ForeignKeyConstraint(['permission_id'], ['permissions.id'], name=op.f('fk_user_direct_permissions_permission_id_permissions')), - sa.ForeignKeyConstraint(['user_id'], ['users.id'], name=op.f('fk_user_direct_permissions_user_id_users')), + sa.ForeignKeyConstraint(['user_id'], ['users.id'], name=op.f('fk_user_direct_permissions_user_id_users'), ondelete='CASCADE'), sa.PrimaryKeyConstraint('user_id', 'permission_id', name=op.f('pk_user_direct_permissions')) ) op.create_table('user_group', sa.Column('user_id', sa.Uuid(), nullable=False), sa.Column('permission_group_id', sa.Integer(), nullable=False), sa.ForeignKeyConstraint(['permission_group_id'], ['groups_of_permissions.id'], name=op.f('fk_user_group_permission_group_id_groups_of_permissions')), - sa.ForeignKeyConstraint(['user_id'], ['users.id'], name=op.f('fk_user_group_user_id_users')), + sa.ForeignKeyConstraint(['user_id'], ['users.id'], name=op.f('fk_user_group_user_id_users'), ondelete='CASCADE'), sa.PrimaryKeyConstraint('user_id', 'permission_group_id', name=op.f('pk_user_group')) ) # ### end Alembic commands ### @@ -114,12 +182,28 @@ def downgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### op.drop_table('user_group') op.drop_table('user_direct_permissions') + with op.batch_alter_table('reports', schema=None) as batch_op: + batch_op.drop_index(batch_op.f('ix_reports_user_id')) + batch_op.drop_index(batch_op.f('ix_reports_market_id')) + batch_op.drop_index(batch_op.f('ix_reports_id')) + batch_op.drop_index(batch_op.f('ix_reports_filename')) + + op.drop_table('reports') with op.batch_alter_table('refresh_tokens', schema=None) as batch_op: batch_op.drop_index(batch_op.f('ix_refresh_tokens_user_id')) batch_op.drop_index(batch_op.f('ix_refresh_tokens_id')) op.drop_table('refresh_tokens') op.drop_table('group_permission') + with op.batch_alter_table('goods', schema=None) as batch_op: + batch_op.drop_index(batch_op.f('ix_goods_tnvd')) + batch_op.drop_index(batch_op.f('ix_goods_price')) + batch_op.drop_index(batch_op.f('ix_goods_id')) + batch_op.drop_index(batch_op.f('ix_goods_fabric_id')) + batch_op.drop_index(batch_op.f('ix_goods_doc_type_id')) + batch_op.drop_index(batch_op.f('ix_goods_article')) + + op.drop_table('goods') with op.batch_alter_table('users', schema=None) as batch_op: batch_op.drop_index(batch_op.f('ix_users_middle_name')) batch_op.drop_index(batch_op.f('ix_users_last_name')) @@ -127,17 +211,31 @@ def downgrade() -> None: batch_op.drop_index(batch_op.f('ix_users_email')) op.drop_table('users') - with op.batch_alter_table('reports', schema=None) as batch_op: - batch_op.drop_index(batch_op.f('ix_reports_id')) - batch_op.drop_index(batch_op.f('ix_reports_filename')) - - op.drop_table('reports') with op.batch_alter_table('permissions', schema=None) as batch_op: batch_op.drop_index(batch_op.f('ix_permissions_id')) op.drop_table('permissions') + with op.batch_alter_table('markets', schema=None) as batch_op: + batch_op.drop_index(batch_op.f('ix_markets_id')) + + op.drop_table('markets') with op.batch_alter_table('groups_of_permissions', schema=None) as batch_op: batch_op.drop_index(batch_op.f('ix_groups_of_permissions_id')) op.drop_table('groups_of_permissions') + with op.batch_alter_table('fabric', schema=None) as batch_op: + batch_op.drop_index(batch_op.f('ix_fabric_name')) + batch_op.drop_index(batch_op.f('ix_fabric_id')) + + op.drop_table('fabric') + with op.batch_alter_table('doc_types', schema=None) as batch_op: + batch_op.drop_index(batch_op.f('ix_doc_types_name')) + batch_op.drop_index(batch_op.f('ix_doc_types_id')) + + op.drop_table('doc_types') + with op.batch_alter_table('accountant_settings', schema=None) as batch_op: + batch_op.drop_index(batch_op.f('ix_accountant_settings_name')) + batch_op.drop_index(batch_op.f('ix_accountant_settings_id')) + + op.drop_table('accountant_settings') # ### end Alembic commands ### diff --git a/src/models/configs_read/env.py b/src/models/configs_read/env.py index 3c9eea1..cf57372 100644 --- a/src/models/configs_read/env.py +++ b/src/models/configs_read/env.py @@ -10,6 +10,12 @@ class Env(Base): ACCESS_TOKEN_EXPIRE_MINUTES:int REFRESH_TOKEN_EXPIRE_DAYS:int + DB_USER:str + DB_PASSWORD:str + DB_POSTGRESS:str + DB_HOST:str + DB_PORT:str + model_config=SettingsConfigDict(env_file="configs/.env", extra=None) env_settings=Env() # type: ignore[call-arg] \ No newline at end of file diff --git a/src/models/database_models/model.py b/src/models/database_models/model.py index a894999..ad27682 100644 --- a/src/models/database_models/model.py +++ b/src/models/database_models/model.py @@ -15,7 +15,9 @@ from sqlalchemy import ( from sqlalchemy.ext.asyncio import create_async_engine from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column, relationship -engine = create_async_engine("sqlite+aiosqlite:///DB/database.db") +from src.models.configs_read.env import env_settings + +engine = create_async_engine(f"postgresql+asyncpg://{env_settings.DB_USER}:{env_settings.DB_PASSWORD}@{env_settings.DB_HOST}:{env_settings.DB_PORT}/{env_settings.DB_POSTGRESS}") '''remember as a boilerplate, or just cp/pst''' class Model(DeclarativeBase):