From 3fb2053705a2b72d21e6d08231e4bf98be30f51d Mon Sep 17 00:00:00 2001 From: brusnitsyn Date: Sun, 14 Jun 2026 22:51:46 +0900 Subject: [PATCH] v2026.06.3 --- Dockerfile | 8 +- app/migrator.py | 77 +++++-- app/queue.py | 2 +- docker/openssl.cnf | 400 ++++++++++++++++++++++++++++++++++++ docs/replication.md | 136 ++++++++++++ errors_in_server_docker.log | 1 - 6 files changed, 603 insertions(+), 21 deletions(-) create mode 100644 docker/openssl.cnf create mode 100644 docs/replication.md delete mode 100644 errors_in_server_docker.log diff --git a/Dockerfile b/Dockerfile index 92e11d0..0fa99d4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,9 +11,7 @@ RUN apk add --no-cache \ freetds \ freetds-dev \ linux-headers \ - postgresql-dev \ - python3-dev \ - tzdata + postgresql-dev COPY req.txt . RUN pip install --upgrade pip \ @@ -40,7 +38,9 @@ RUN pip install --upgrade pip \ COPY app ./app COPY main.py . -COPY sql ./sql + +# Фикс OpenSSL 3 совместимости с SQL Server 2016 +COPY docker/openssl.cnf /etc/ssl/openssl.cnf RUN mkdir -p logs diff --git a/app/migrator.py b/app/migrator.py index b8058ac..bfb7f11 100644 --- a/app/migrator.py +++ b/app/migrator.py @@ -856,6 +856,20 @@ class DatabaseMigrator: else: conflict_action = "DO NOTHING" + try: + target_types = { + col['name']: str(col['type']) + for col in inspect(self.dst_engine).get_columns(table_name) + } + except Exception: + target_types = {} + + select_expr = ', '.join( + f'CAST({self.quote_identifier(col)} AS {target_types[col]})' + if col in target_types else self.quote_identifier(col) + for col in columns + ) + try: if self.table_exists(staging): with self.dst_engine.connect() as conn: @@ -869,7 +883,7 @@ class DatabaseMigrator: self.write_dataframe_batch_without_sqlalchemy(chunk, staging) sql = f""" INSERT INTO {self.quote_identifier(table_name)} ({quoted_columns}) - SELECT {quoted_columns} + SELECT {select_expr} FROM {self.quote_identifier(staging)} ON CONFLICT ({conflict_columns}) {conflict_action} """ @@ -1403,9 +1417,37 @@ class DatabaseMigrator: self.logger.log_table_success(table_name, 0) return True + if ( + last_watermark['last_x_datetime'] is None + and target_exists + and table_config.primary_key + and table_config.life_table + ): + pg_count = self._get_pg_row_count(pg_table) + if pg_count > 0: + self.logger.log_info( + f"Таблица {pg_table} содержит {pg_count} строк без watermark — " + f"автоопределение watermark из {table_config.life_table}" + ) + detected = self._get_watermark_for_pg_data(table_config, find_min=True) + if detected['last_x_datetime'] is not None: + self.save_watermark( + pg_table, + detected['last_x_datetime'], + detected['last_sequence_value'], + pg_count, + 'success', + ) + last_watermark = detected + self.logger.log_info(f"Watermark установлен автоматически: {last_watermark}") + else: + self.logger.log_warning( + f"Не удалось определить watermark для {pg_table} из существующих данных, " + f"начинаем инкрементальную миграцию с нуля" + ) + if ( table_config.initial_load_mode == 'full_then_incremental' - and not target_exists and last_watermark['last_x_datetime'] is None ): self.logger.log_info( @@ -1641,11 +1683,11 @@ class DatabaseMigrator: return '0x' + value.hex() return "'" + str(value).replace("'", "''") + "'" - def _get_watermark_for_pg_data(self, table_config: TableMigrationConfig) -> Dict[str, Any]: + def _get_watermark_for_pg_data(self, table_config: TableMigrationConfig, find_min: bool = False) -> Dict[str, Any]: """Поиск watermark в MSSQL Life_ для строк, уже имеющихся в PostgreSQL. Читает PK из PG потоком (без загрузки всей таблицы в память), батчами - запрашивает MSSQL Life_ и находит максимальную (datetime, sequence) пару + запрашивает MSSQL Life_ и находит минимальную или максимальную (datetime, sequence) пару среди событий, относящихся к уже реплицированным строкам. """ empty: Dict[str, Any] = {'last_x_datetime': None, 'last_sequence_value': None} @@ -1656,9 +1698,10 @@ class DatabaseMigrator: LOOKUP_BATCH = 500 - order_parts = [f"{self.quote_mssql_identifier(table_config.datetime_column)} DESC"] + direction = 'ASC' if find_min else 'DESC' + order_parts = [f"{self.quote_mssql_identifier(table_config.datetime_column)} {direction}"] if table_config.sequence_column: - order_parts.append(f"{self.quote_mssql_identifier(table_config.sequence_column)} DESC") + order_parts.append(f"{self.quote_mssql_identifier(table_config.sequence_column)} {direction}") order_clause = ', '.join(order_parts) select_parts = [ @@ -1722,15 +1765,18 @@ class DatabaseMigrator: batch_dt = row['max_dt'] batch_seq = row['max_seq'] if table_config.sequence_column else None - if ( + is_better = ( max_datetime is None - or batch_dt > max_datetime - or ( - batch_dt == max_datetime - and batch_seq is not None - and (max_sequence is None or batch_seq > max_sequence) - ) - ): + or (find_min and ( + batch_dt < max_datetime + or (batch_dt == max_datetime and batch_seq is not None and (max_sequence is None or batch_seq < max_sequence)) + )) + or (not find_min and ( + batch_dt > max_datetime + or (batch_dt == max_datetime and batch_seq is not None and (max_sequence is None or batch_seq > max_sequence)) + )) + ) + if is_better: max_datetime = batch_dt max_sequence = batch_seq @@ -1740,9 +1786,10 @@ class DatabaseMigrator: f"(строки {total_rows - len(batch) + 1}–{total_rows}): {e}" ) + direction_label = 'минимальный' if find_min else 'максимальный' self.logger.log_info( f"Обработано {total_rows} PK из {table_config.pg_table} " - f"в {batch_num} батчах, watermark: {max_datetime}" + f"в {batch_num} батчах, {direction_label} watermark: {max_datetime}" ) return {'last_x_datetime': max_datetime, 'last_sequence_value': max_sequence} diff --git a/app/queue.py b/app/queue.py index d6f56f2..3fa67b4 100644 --- a/app/queue.py +++ b/app/queue.py @@ -494,7 +494,7 @@ class MigrationJobQueue: def _materialize_due_schedules(self): now = datetime.now() - grace_cutoff = now - timedelta(seconds=Config.SCHEDULE_GRACE_SECONDS) + grace_cutoff = now - timedelta(seconds=max(Config.SCHEDULE_GRACE_SECONDS, Config.QUEUE_POLL_SECONDS)) with self._get_engine().connect() as conn: due_rows = conn.execute(self._text(f""" SELECT * diff --git a/docker/openssl.cnf b/docker/openssl.cnf new file mode 100644 index 0000000..b495d7c --- /dev/null +++ b/docker/openssl.cnf @@ -0,0 +1,400 @@ +# +# OpenSSL example configuration file. +# See doc/man5/config.pod for more info. +# +# This is mostly being used for generation of certificate requests, +# but may be used for auto loading of providers + +# Note that you can include other files from the main configuration +# file using the .include directive. +#.include filename + +# This definition stops the following lines choking if HOME isn't +# defined. +HOME = . + +# Use this in order to automatically load providers. +openssl_conf = default_conf + +# Comment out the next line to ignore configuration errors +config_diagnostics = 1 + +# Extra OBJECT IDENTIFIER info: +# oid_file = $ENV::HOME/.oid +oid_section = new_oids + +# To use this configuration file with the "-extfile" option of the +# "openssl x509" utility, name here the section containing the +# X.509v3 extensions to use: +# extensions = +# (Alternatively, use a configuration file that has only +# X.509v3 extensions in its main [= default] section.) + +[ new_oids ] +# We can add new OIDs in here for use by 'ca', 'req' and 'ts'. +# Add a simple OID like this: +# testoid1=1.2.3.4 +# Or use config file substitution like this: +# testoid2=${testoid1}.5.6 + +# Policies used by the TSA examples. +tsa_policy1 = 1.2.3.4.1 +tsa_policy2 = 1.2.3.4.5.6 +tsa_policy3 = 1.2.3.4.5.7 + +# For FIPS +# Optionally include a file that is generated by the OpenSSL fipsinstall +# application. This file contains configuration data required by the OpenSSL +# fips provider. It contains a named section e.g. [fips_sect] which is +# referenced from the [provider_sect] below. +# Refer to the OpenSSL security policy for more information. +# .include fipsmodule.cnf + +[openssl_init] +providers = provider_sect + +# List of providers to load +[provider_sect] +default = default_sect +# The fips section name should match the section name inside the +# included fipsmodule.cnf. +# fips = fips_sect + +# If no providers are activated explicitly, the default one is activated implicitly. +# See man 7 OSSL_PROVIDER-default for more details. +# +# If you add a section explicitly activating any other provider(s), you most +# probably need to explicitly activate the default provider, otherwise it +# becomes unavailable in openssl. As a consequence applications depending on +# OpenSSL may not work correctly which could lead to significant system +# problems including inability to remotely access the system. +[default_sect] +# activate = 1 + + +#################################################################### +[ ca ] +default_ca = CA_default # The default ca section + +#################################################################### +[ CA_default ] + +dir = ./demoCA # Where everything is kept +certs = $dir/certs # Where the issued certs are kept +crl_dir = $dir/crl # Where the issued crl are kept +database = $dir/index.txt # database index file. +#unique_subject = no # Set to 'no' to allow creation of + # several certs with same subject. +new_certs_dir = $dir/newcerts # default place for new certs. + +certificate = $dir/cacert.pem # The CA certificate +serial = $dir/serial # The current serial number +crlnumber = $dir/crlnumber # the current crl number + # must be commented out to leave a V1 CRL +crl = $dir/crl.pem # The current CRL +private_key = $dir/private/cakey.pem # The private key + +x509_extensions = usr_cert # The extensions to add to the cert + +# Comment out the following two lines for the "traditional" +# (and highly broken) format. +name_opt = ca_default # Subject Name options +cert_opt = ca_default # Certificate field options + +# Extension copying option: use with caution. +# copy_extensions = copy + +# Extensions to add to a CRL. Note: Netscape communicator chokes on V2 CRLs +# so this is commented out by default to leave a V1 CRL. +# crlnumber must also be commented out to leave a V1 CRL. +# crl_extensions = crl_ext + +default_days = 365 # how long to certify for +default_crl_days= 30 # how long before next CRL +default_md = default # use public key default MD +preserve = no # keep passed DN ordering + +# A few difference way of specifying how similar the request should look +# For type CA, the listed attributes must be the same, and the optional5A5A5A5A +# and supplied fields are just that :-) +policy = policy_match + +# For the CA policy +[ policy_match ] +countryName = match +stateOrProvinceName = match +organizationName = match +organizationalUnitName = optional +commonName = supplied +emailAddress = optional + +# For the 'anything' policy +# At this point in time, you must list all acceptable 'object' +# types. +[ policy_anything ] +countryName = optional +stateOrProvinceName = optional +localityName = optional +organizationName = optional +organizationalUnitName = optional +commonName = supplied +emailAddress = optional + +#################################################################### +[ req ] +default_bits = 2048 +default_keyfile = privkey.pem +distinguished_name = req_distinguished_name +attributes = req_attributes +x509_extensions = v3_ca # The extensions to add to the self signed cert + +# Passwords for private keys if not present they will be prompted for +# input_password = secret +# output_password = secret + +# This sets a mask for permitted string types. There are several options. +# default: PrintableString, T61String, BMPString. +# pkix : PrintableString, BMPString (PKIX recommendation before 2004) +# utf8only: only UTF8Strings (PKIX recommendation after 2004). +# nombstr : PrintableString, T61String (no BMPStrings or UTF8Strings). +# MASK:XXXX a literal mask value. +# WARNING: ancient versions of Netscape crash on BMPStrings or UTF8Strings. +string_mask = utf8only + +# req_extensions = v3_req # The extensions to add to a certificate request + +[ req_distinguished_name ] +countryName = Country Name (2 letter code) +countryName_default = AU +countryName_min = 2 +countryName_max = 2 + +stateOrProvinceName = State or Province Name (full name) +stateOrProvinceName_default = Some-State + +localityName = Locality Name (eg, city) + +0.organizationName = Organization Name (eg, company) +0.organizationName_default = Internet Widgits Pty Ltd + +# we can do this but it is not needed normally :-) +#1.organizationName = Second Organization Name (eg, company) +#1.organizationName_default = World Wide Web Pty Ltd + +organizationalUnitName = Organizational Unit Name (eg, section) +#organizationalUnitName_default = + +commonName = Common Name (e.g. server FQDN or YOUR name) +commonName_max = 64 + +emailAddress = Email Address +emailAddress_max = 64 + +# SET-ex3 = SET extension number 3 + +[ req_attributes ] +challengePassword = A challenge password +challengePassword_min = 4 +challengePassword_max = 20 + +unstructuredName = An optional company name + +[ usr_cert ] + +# These extensions are added when 'ca' signs a request. + +# This goes against PKIX guidelines but some CAs do it and some software +# requires this to avoid interpreting an end user certificate as a CA. + +basicConstraints=CA:FALSE + +# This is typical in keyUsage for a client certificate. +# keyUsage = nonRepudiation, digitalSignature, keyEncipherment + +# PKIX recommendations harmless if included in all certificates. +subjectKeyIdentifier=hash +authorityKeyIdentifier=keyid,issuer + +# This stuff is for subjectAltName and issuerAltname. +# Import the email address. +# subjectAltName=email:copy +# An alternative to produce certificates that aren't +# deprecated according to PKIX. +# subjectAltName=email:move + +# Copy subject details +# issuerAltName=issuer:copy + +# This is required for TSA certificates. +# extendedKeyUsage = critical,timeStamping + +[ v3_req ] + +# Extensions to add to a certificate request + +basicConstraints = CA:FALSE +keyUsage = nonRepudiation, digitalSignature, keyEncipherment + +[ v3_ca ] + + +# Extensions for a typical CA + + +# PKIX recommendation. + +subjectKeyIdentifier=hash + +authorityKeyIdentifier=keyid:always,issuer + +basicConstraints = critical,CA:true + +# Key usage: this is typical for a CA certificate. However since it will +# prevent it being used as an test self-signed certificate it is best +# left out by default. +# keyUsage = cRLSign, keyCertSign + +# Include email address in subject alt name: another PKIX recommendation +# subjectAltName=email:copy +# Copy issuer details +# issuerAltName=issuer:copy + +# DER hex encoding of an extension: beware experts only! +# obj=DER:02:03 +# Where 'obj' is a standard or added object +# You can even override a supported extension: +# basicConstraints= critical, DER:30:03:01:01:FF + +[ crl_ext ] + +# CRL extensions. +# Only issuerAltName and authorityKeyIdentifier make any sense in a CRL. + +# issuerAltName=issuer:copy +authorityKeyIdentifier=keyid:always + +[ proxy_cert_ext ] +# These extensions should be added when creating a proxy certificate + +# This goes against PKIX guidelines but some CAs do it and some software +# requires this to avoid interpreting an end user certificate as a CA. + +basicConstraints=CA:FALSE + +# This is typical in keyUsage for a client certificate. +# keyUsage = nonRepudiation, digitalSignature, keyEncipherment + +# PKIX recommendations harmless if included in all certificates. +subjectKeyIdentifier=hash +authorityKeyIdentifier=keyid,issuer + +# This stuff is for subjectAltName and issuerAltname. +# Import the email address. +# subjectAltName=email:copy +# An alternative to produce certificates that aren't +# deprecated according to PKIX. +# subjectAltName=email:move + +# Copy subject details +# issuerAltName=issuer:copy + +# This really needs to be in place for it to be a proxy certificate. +proxyCertInfo=critical,language:id-ppl-anyLanguage,pathlen:3,policy:foo + +#################################################################### +[ tsa ] + +default_tsa = tsa_config1 # the default TSA section + +[ tsa_config1 ] + +# These are used by the TSA reply generation only. +dir = ./demoCA # TSA root directory +serial = $dir/tsaserial # The current serial number (mandatory) +crypto_device = builtin # OpenSSL engine to use for signing +signer_cert = $dir/tsacert.pem # The TSA signing certificate + # (optional) +certs = $dir/cacert.pem # Certificate chain to include in reply + # (optional) +signer_key = $dir/private/tsakey.pem # The TSA private key (optional) +signer_digest = sha256 # Signing digest to use. (Optional) +default_policy = tsa_policy1 # Policy if request did not specify it + # (optional) +other_policies = tsa_policy2, tsa_policy3 # acceptable policies (optional) +digests = sha1, sha256, sha384, sha512 # Acceptable message digests (mandatory) +accuracy = secs:1, millisecs:500, microsecs:100 # (optional) +clock_precision_digits = 0 # number of digits after dot. (optional) +ordering = yes # Is ordering defined for timestamps? + # (optional, default: no) +tsa_name = yes # Must the TSA name be included in the reply? + # (optional, default: no) +ess_cert_id_chain = no # Must the ESS cert id chain be included? + # (optional, default: no) +ess_cert_id_alg = sha256 # algorithm to compute certificate + # identifier (optional, default: sha256) + +[insta] # CMP using Insta Demo CA +# Message transfer +server = pki.certificate.fi:8700 +# proxy = # set this as far as needed, e.g., http://192.168.1.1:8080 +# tls_use = 0 +path = pkix/ + +# Server authentication +recipient = "/C=FI/O=Insta Demo/CN=Insta Demo CA" # or set srvcert or issuer +ignore_keyusage = 1 # quirk needed to accept Insta CA cert not including digitalsignature +unprotected_errors = 1 # quirk needed to accept negative responses possibly not protected +extracertsout = insta.extracerts.pem + +# Client authentication +ref = 3078 # user identification +secret = pass:insta # can be used for both client and server side + +# Generic message options +cmd = ir # default operation, can be overridden on cmd line with, e.g., kur + +# Certificate enrollment +subject = "/CN=openssl-cmp-test" +newkey = insta.priv.pem +out_trusted = apps/insta.ca.crt # does not include keyUsage digitalSignature +certout = insta.cert.pem + +[pbm] # Password-based protection for Insta CA +# Server and client authentication +ref = $insta::ref # 3078 +secret = $insta::secret # pass:insta + +[signature] # Signature-based protection for Insta CA +# Server authentication +trusted = $insta::out_trusted # apps/insta.ca.crt + +# Client authentication +secret = # disable PBM +key = $insta::newkey # insta.priv.pem +cert = $insta::certout # insta.cert.pem + +[ir] +cmd = ir + +[cr] +cmd = cr + +[kur] +# Certificate update +cmd = kur" +oldcert = $insta::certout # insta.cert.pem + +[rr] +# Certificate revocation +cmd = rr +oldcert = $insta::certout # insta.cert.pem + +[default_conf] +ssl_conf = ssl_sect + +[ssl_sect] +system_default = system_default_sect + +[system_default_sect] +MinProtocol = TLSv1.2 +CipherString = DEFAULT@SECLEVEL=0 diff --git a/docs/replication.md b/docs/replication.md new file mode 100644 index 0000000..7ffe310 --- /dev/null +++ b/docs/replication.md @@ -0,0 +1,136 @@ +# Схемы репликации + +## Конфигурация таблиц в БД + +Хранится в `replicator.migration_tables`. Заполняется автоматически из `DEFAULT_TABLE_MIGRATIONS` при первом запуске, если таблица пуста. + +### Поля таблицы `replicator.migration_tables` + +| Поле | Тип | Описание | +|---|---|---| +| `source_table` | text PK | Имя таблицы в MSSQL | +| `target_table` | text | Имя таблицы в PostgreSQL (если `NULL` — берётся `source_table`) | +| `mode` | text | Схема репликации: `full` или `incremental` | +| `initial_load_mode` | text | Режим первого запуска: `full_then_incremental` | +| `life_table` | text | Имя Life_-таблицы в MSSQL (только для `incremental`) | +| `datetime_column` | text | Колонка даты в Life_-таблице (обычно `x_DateTime`) | +| `sequence_column` | text | Колонка последовательности в Life_-таблице (например `LPULifeID`) | +| `order_columns_json` | jsonb | Порядок сортировки при инкрементальном чтении, например `["x_DateTime","LPULifeID"]` | +| `operation_column` | text | Колонка типа операции в Life_-таблице (обычно `x_Operation`) | +| `delete_operations_json` | jsonb | Значения operation_column, означающие удаление (по умолчанию `["d"]`) | +| `upsert_operations_json` | jsonb | Значения operation_column, означающие вставку/обновление (по умолчанию `["i","u"]`) | +| `primary_key_json` | jsonb | Первичный ключ целевой таблицы, например `["LPUID"]` | +| `exclude_columns_json` | jsonb | Колонки Life_-таблицы, которые не нужно реплицировать (например служебные `x_DateTime`, `x_Operation`, `LPULifeID`) | +| `timescale` | boolean | Использовать TimescaleDB hypertable | +| `timescale_time_column` | text | Колонка времени для TimescaleDB | +| `enabled` | boolean | Включена ли репликация данной таблицы | + +### Состояние репликации `replicator.migration_state` + +| Поле | Описание | +|---|---| +| `table_name` | Имя таблицы PostgreSQL | +| `last_x_datetime` | Последняя обработанная дата из Life_ | +| `last_sequence_value` | Последнее обработанное значение sequence | +| `last_run_at` | Время последнего запуска | +| `rows_copied` | Количество скопированных строк | +| `status` | `success` / `failed` | +| `error` | Текст ошибки если `status = failed` | + +--- + +## Схема 1: `mode = 'full'` + +Полная перезапись таблицы при каждом запуске. Нет watermark, нет состояния. + +**Когда использовать:** небольшие справочники, которые меняются редко и не имеют Life_-таблицы. + +**Пример записи в БД:** +```sql +INSERT INTO replicator.migration_tables ( + source_table, mode, initial_load_mode, + datetime_column, enabled +) VALUES ( + 'oms_LPU', 'full', 'full_then_incremental', + 'x_DateTime', true +); +``` + +**Поведение каждого запуска:** +1. Читает всю таблицу из MSSQL +2. Перезаписывает в PostgreSQL + +--- + +## Схема 2: `mode = 'incremental'` + +Инкрементальная репликация через Life_-таблицу. Отслеживает watermark `(last_x_datetime, last_sequence_value)`. + +**Когда использовать:** большие таблицы с журналом изменений (Life_). + +**Пример записи в БД:** +```sql +INSERT INTO replicator.migration_tables ( + source_table, target_table, mode, initial_load_mode, + life_table, datetime_column, sequence_column, + order_columns_json, operation_column, + delete_operations_json, upsert_operations_json, + primary_key_json, exclude_columns_json, + enabled +) VALUES ( + 'Oms_LPU', 'oms_lpu', 'incremental', 'full_then_incremental', + 'Life_oms_LPU', 'x_DateTime', 'LPULifeID', + '["x_DateTime","LPULifeID"]', 'x_Operation', + '["d"]', '["i","u"]', + '["LPUID"]', '["LPULifeID","x_Operation","x_DateTime","x_Seance","x_User"]', + true +); +``` + +### Поведение каждого запуска + +``` +1. В Life_ нет новых данных (upper_bound = NULL) + → Ничего не делать, watermark сохраняется как есть + +2. Watermark NULL + таблица существует с данными + → Автодетекция: ищет МИНИМАЛЬНЫЙ (x_DateTime, sequence) + в Life_ для всех PK уже имеющихся в PostgreSQL + → Сохраняет как watermark + → Переходит к шагу 4 + +3. Watermark всё ещё NULL + initial_load_mode = 'full_then_incremental' + → Полная загрузка из source_table (не из Life_) + → После успеха сохраняет upper_bound как watermark + +4. Watermark есть → инкрементальная миграция + → Читает из Life_: x_DateTime > watermark AND x_DateTime <= upper_bound + → Разбивает на upsert (операции из upsert_operations) и delete (из delete_operations) + → Применяет через staging-таблицу в PostgreSQL + → Обновляет watermark до максимального обработанного значения +``` + +--- + +## Принудительная перезагрузка (`force_full`) + +Запускается через API или вручную. Игнорирует watermark. + +| Условие | Поведение | +|---|---| +| Первый `force_full` для `full_then_incremental` таблицы без watermark и без целевой таблицы | Быстрая загрузка через `COPY` без SQLAlchemy | +| Все остальные случаи | Обычная полная загрузка | +| После успеха на `incremental` таблице | Сохраняет `upper_bound` как watermark | + +--- + +## Сводная матрица поведения + +| Ситуация | Поведение | +|---|---| +| `mode = full` | Всегда полная перезапись | +| `mode = incremental`, нет данных в Life_ | Пропуск | +| `mode = incremental`, нет watermark, таблица с данными | Автодетекция min watermark → инкрементальная | +| `mode = incremental`, нет watermark, таблица пустая или отсутствует | Полная загрузка → watermark = upper_bound | +| `mode = incremental`, watermark есть | Инкрементальная от watermark до upper_bound | +| `force_full` | Полная перезагрузка → watermark = upper_bound | diff --git a/errors_in_server_docker.log b/errors_in_server_docker.log deleted file mode 100644 index 38e61b6..0000000 --- a/errors_in_server_docker.log +++ /dev/null @@ -1 +0,0 @@ -{"errors": [{"message": "Ошибка при создании внешнего ключа fk_hlt_disp_card_rf_CitizenCategoryID", "exception": "(psycopg2.errors.UndefinedTable) relation \"oms_citizencategory\" does not exist\n\n[SQL: \n ALTER TABLE \"hlt_disp_card\" \n ADD CONSTRAINT \"fk_hlt_disp_card_rf_CitizenCategoryID\" \n FOREIGN KEY (\"rf_CitizenCategoryID\") \n REFERENCES \"oms_citizencategory\" (\"CitizenCategoryID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)", "timestamp": "2026-04-16T00:03:13.750908", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.UndefinedTable: relation \"oms_citizencategory\" does not exist\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 843, in create_pg_foreign_keys\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation \"oms_citizencategory\" does not exist\n\n[SQL: \n ALTER TABLE \"hlt_disp_card\" \n ADD CONSTRAINT \"fk_hlt_disp_card_rf_CitizenCategoryID\" \n FOREIGN KEY (\"rf_CitizenCategoryID\") \n REFERENCES \"oms_citizencategory\" (\"CitizenCategoryID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)\n"}, {"message": "Ошибка при создании внешнего ключа fk_hlt_disp_card_rf_DogovorPatientID", "exception": "(psycopg2.errors.UndefinedTable) relation \"hlt_dogovorpatient\" does not exist\n\n[SQL: \n ALTER TABLE \"hlt_disp_card\" \n ADD CONSTRAINT \"fk_hlt_disp_card_rf_DogovorPatientID\" \n FOREIGN KEY (\"rf_DogovorPatientID\") \n REFERENCES \"hlt_dogovorpatient\" (\"DogovorPatientID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)", "timestamp": "2026-04-16T00:03:13.752966", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.UndefinedTable: relation \"hlt_dogovorpatient\" does not exist\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 843, in create_pg_foreign_keys\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation \"hlt_dogovorpatient\" does not exist\n\n[SQL: \n ALTER TABLE \"hlt_disp_card\" \n ADD CONSTRAINT \"fk_hlt_disp_card_rf_DogovorPatientID\" \n FOREIGN KEY (\"rf_DogovorPatientID\") \n REFERENCES \"hlt_dogovorpatient\" (\"DogovorPatientID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)\n"}, {"message": "Ошибка при создании внешнего ключа fk_hlt_disp_patientmodel_rf_kl_OrphanAgeGroupID", "exception": "(psycopg2.errors.UndefinedTable) relation \"oms_kl_orphanagegroup\" does not exist\n\n[SQL: \n ALTER TABLE \"hlt_disp_patientmodel\" \n ADD CONSTRAINT \"fk_hlt_disp_patientmodel_rf_kl_OrphanAgeGroupID\" \n FOREIGN KEY (\"rf_kl_OrphanAgeGroupID\") \n REFERENCES \"oms_kl_orphanagegroup\" (\"kl_OrphanAgeGroupID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)", "timestamp": "2026-04-16T00:17:28.835112", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.UndefinedTable: relation \"oms_kl_orphanagegroup\" does not exist\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 843, in create_pg_foreign_keys\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation \"oms_kl_orphanagegroup\" does not exist\n\n[SQL: \n ALTER TABLE \"hlt_disp_patientmodel\" \n ADD CONSTRAINT \"fk_hlt_disp_patientmodel_rf_kl_OrphanAgeGroupID\" \n FOREIGN KEY (\"rf_kl_OrphanAgeGroupID\") \n REFERENCES \"oms_kl_orphanagegroup\" (\"kl_OrphanAgeGroupID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)\n"}, {"message": "Ошибка при создании внешнего ключа fk_hlt_docprvd_rf_kl_SubComissionTypeID", "exception": "(psycopg2.errors.UndefinedTable) relation \"oms_kl_subcomissiontype\" does not exist\n\n[SQL: \n ALTER TABLE \"hlt_docprvd\" \n ADD CONSTRAINT \"fk_hlt_docprvd_rf_kl_SubComissionTypeID\" \n FOREIGN KEY (\"rf_kl_SubComissionTypeID\") \n REFERENCES \"oms_kl_subcomissiontype\" (\"kl_SubComissionTypeID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)", "timestamp": "2026-04-16T00:18:04.153710", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.UndefinedTable: relation \"oms_kl_subcomissiontype\" does not exist\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 843, in create_pg_foreign_keys\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation \"oms_kl_subcomissiontype\" does not exist\n\n[SQL: \n ALTER TABLE \"hlt_docprvd\" \n ADD CONSTRAINT \"fk_hlt_docprvd_rf_kl_SubComissionTypeID\" \n FOREIGN KEY (\"rf_kl_SubComissionTypeID\") \n REFERENCES \"oms_kl_subcomissiontype\" (\"kl_SubComissionTypeID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)\n"}, {"message": "Ошибка при создании внешнего ключа fk_hlt_docprvd_rf_KV_KATID", "exception": "(psycopg2.errors.UndefinedTable) relation \"oms_kv_kat\" does not exist\n\n[SQL: \n ALTER TABLE \"hlt_docprvd\" \n ADD CONSTRAINT \"fk_hlt_docprvd_rf_KV_KATID\" \n FOREIGN KEY (\"rf_KV_KATID\") \n REFERENCES \"oms_kv_kat\" (\"KV_KATID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)", "timestamp": "2026-04-16T00:18:04.155836", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.UndefinedTable: relation \"oms_kv_kat\" does not exist\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 843, in create_pg_foreign_keys\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation \"oms_kv_kat\" does not exist\n\n[SQL: \n ALTER TABLE \"hlt_docprvd\" \n ADD CONSTRAINT \"fk_hlt_docprvd_rf_KV_KATID\" \n FOREIGN KEY (\"rf_KV_KATID\") \n REFERENCES \"oms_kv_kat\" (\"KV_KATID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)\n"}, {"message": "Ошибка при создании внешнего ключа fk_hlt_invoice_rf_InvoiceTypeID", "exception": "(psycopg2.errors.UndefinedTable) relation \"hlt_invoicetype\" does not exist\n\n[SQL: \n ALTER TABLE \"hlt_invoice\" \n ADD CONSTRAINT \"fk_hlt_invoice_rf_InvoiceTypeID\" \n FOREIGN KEY (\"rf_InvoiceTypeID\") \n REFERENCES \"hlt_invoicetype\" (\"InvoiceTypeID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)", "timestamp": "2026-04-16T00:18:40.611170", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.UndefinedTable: relation \"hlt_invoicetype\" does not exist\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 843, in create_pg_foreign_keys\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation \"hlt_invoicetype\" does not exist\n\n[SQL: \n ALTER TABLE \"hlt_invoice\" \n ADD CONSTRAINT \"fk_hlt_invoice_rf_InvoiceTypeID\" \n FOREIGN KEY (\"rf_InvoiceTypeID\") \n REFERENCES \"hlt_invoicetype\" (\"InvoiceTypeID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)\n"}, {"message": "Ошибка при создании внешнего ключа fk_hlt_invoice_rf_PaymentTypeID", "exception": "(psycopg2.errors.UndefinedTable) relation \"hlt_paymenttype\" does not exist\n\n[SQL: \n ALTER TABLE \"hlt_invoice\" \n ADD CONSTRAINT \"fk_hlt_invoice_rf_PaymentTypeID\" \n FOREIGN KEY (\"rf_PaymentTypeID\") \n REFERENCES \"hlt_paymenttype\" (\"PaymentTypeID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)", "timestamp": "2026-04-16T00:18:40.613150", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.UndefinedTable: relation \"hlt_paymenttype\" does not exist\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 843, in create_pg_foreign_keys\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation \"hlt_paymenttype\" does not exist\n\n[SQL: \n ALTER TABLE \"hlt_invoice\" \n ADD CONSTRAINT \"fk_hlt_invoice_rf_PaymentTypeID\" \n FOREIGN KEY (\"rf_PaymentTypeID\") \n REFERENCES \"hlt_paymenttype\" (\"PaymentTypeID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)\n"}, {"message": "Ошибка при создании внешнего ключа fk_hlt_lpudoctor_rf_kl_SexID", "exception": "(psycopg2.errors.UndefinedTable) relation \"oms_kl_sex\" does not exist\n\n[SQL: \n ALTER TABLE \"hlt_lpudoctor\" \n ADD CONSTRAINT \"fk_hlt_lpudoctor_rf_kl_SexID\" \n FOREIGN KEY (\"rf_kl_SexID\") \n REFERENCES \"oms_kl_sex\" (\"kl_SexID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)", "timestamp": "2026-04-16T00:18:44.900986", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.UndefinedTable: relation \"oms_kl_sex\" does not exist\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 843, in create_pg_foreign_keys\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation \"oms_kl_sex\" does not exist\n\n[SQL: \n ALTER TABLE \"hlt_lpudoctor\" \n ADD CONSTRAINT \"fk_hlt_lpudoctor_rf_kl_SexID\" \n FOREIGN KEY (\"rf_kl_SexID\") \n REFERENCES \"oms_kl_sex\" (\"kl_SexID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)\n"}, {"message": "Ошибка при создании внешнего ключа fk_hlt_lpudoctor_rf_TypeDocID", "exception": "(psycopg2.errors.UndefinedTable) relation \"oms_typedoc\" does not exist\n\n[SQL: \n ALTER TABLE \"hlt_lpudoctor\" \n ADD CONSTRAINT \"fk_hlt_lpudoctor_rf_TypeDocID\" \n FOREIGN KEY (\"rf_TypeDocID\") \n REFERENCES \"oms_typedoc\" (\"TYPEDOCID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)", "timestamp": "2026-04-16T00:18:44.902873", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.UndefinedTable: relation \"oms_typedoc\" does not exist\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 843, in create_pg_foreign_keys\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation \"oms_typedoc\" does not exist\n\n[SQL: \n ALTER TABLE \"hlt_lpudoctor\" \n ADD CONSTRAINT \"fk_hlt_lpudoctor_rf_TypeDocID\" \n FOREIGN KEY (\"rf_TypeDocID\") \n REFERENCES \"oms_typedoc\" (\"TYPEDOCID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)\n"}, {"message": "Ошибка при создании внешнего ключа fk_hlt_mkb_tap_rf_kl_DiagnosisCredibilityID", "exception": "(psycopg2.errors.UndefinedTable) relation \"oms_kl_diagnosiscredibility\" does not exist\n\n[SQL: \n ALTER TABLE \"hlt_mkb_tap\" \n ADD CONSTRAINT \"fk_hlt_mkb_tap_rf_kl_DiagnosisCredibilityID\" \n FOREIGN KEY (\"rf_kl_DiagnosisCredibilityID\") \n REFERENCES \"oms_kl_diagnosiscredibility\" (\"kl_DiagnosisCredibilityID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)", "timestamp": "2026-04-16T01:04:58.681267", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.UndefinedTable: relation \"oms_kl_diagnosiscredibility\" does not exist\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 843, in create_pg_foreign_keys\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation \"oms_kl_diagnosiscredibility\" does not exist\n\n[SQL: \n ALTER TABLE \"hlt_mkb_tap\" \n ADD CONSTRAINT \"fk_hlt_mkb_tap_rf_kl_DiagnosisCredibilityID\" \n FOREIGN KEY (\"rf_kl_DiagnosisCredibilityID\") \n REFERENCES \"oms_kl_diagnosiscredibility\" (\"kl_DiagnosisCredibilityID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)\n"}, {"message": "Ошибка при создании внешнего ключа fk_hlt_mkb_tap_rf_kl_DiagnosisValidityID", "exception": "(psycopg2.errors.UndefinedTable) relation \"oms_kl_diagnosisvalidity\" does not exist\n\n[SQL: \n ALTER TABLE \"hlt_mkb_tap\" \n ADD CONSTRAINT \"fk_hlt_mkb_tap_rf_kl_DiagnosisValidityID\" \n FOREIGN KEY (\"rf_kl_DiagnosisValidityID\") \n REFERENCES \"oms_kl_diagnosisvalidity\" (\"kl_DiagnosisValidityID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)", "timestamp": "2026-04-16T01:04:58.683315", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.UndefinedTable: relation \"oms_kl_diagnosisvalidity\" does not exist\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 843, in create_pg_foreign_keys\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation \"oms_kl_diagnosisvalidity\" does not exist\n\n[SQL: \n ALTER TABLE \"hlt_mkb_tap\" \n ADD CONSTRAINT \"fk_hlt_mkb_tap_rf_kl_DiagnosisValidityID\" \n FOREIGN KEY (\"rf_kl_DiagnosisValidityID\") \n REFERENCES \"oms_kl_diagnosisvalidity\" (\"kl_DiagnosisValidityID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)\n"}, {"message": "Ошибка при выполнении VACUUM ANALYZE для таблицы hlt_mkb_tap", "exception": "(psycopg2.errors.ActiveSqlTransaction) VACUUM cannot run inside a transaction block\n\n[SQL: VACUUM ANALYZE \"hlt_mkb_tap\"]\n(Background on this error at: https://sqlalche.me/e/20/2j85)", "timestamp": "2026-04-16T01:04:58.685529", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.ActiveSqlTransaction: VACUUM cannot run inside a transaction block\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 871, in vacuum_analyze_table\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.InternalError: (psycopg2.errors.ActiveSqlTransaction) VACUUM cannot run inside a transaction block\n\n[SQL: VACUUM ANALYZE \"hlt_mkb_tap\"]\n(Background on this error at: https://sqlalche.me/e/20/2j85)\n"}, {"message": "Ошибка при выполнении VACUUM ANALYZE для таблицы hlt_reestridcase", "exception": "(psycopg2.errors.ActiveSqlTransaction) VACUUM cannot run inside a transaction block\n\n[SQL: VACUUM ANALYZE \"hlt_reestridcase\"]\n(Background on this error at: https://sqlalche.me/e/20/2j85)", "timestamp": "2026-04-16T01:18:44.293369", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.ActiveSqlTransaction: VACUUM cannot run inside a transaction block\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 871, in vacuum_analyze_table\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.InternalError: (psycopg2.errors.ActiveSqlTransaction) VACUUM cannot run inside a transaction block\n\n[SQL: VACUUM ANALYZE \"hlt_reestridcase\"]\n(Background on this error at: https://sqlalche.me/e/20/2j85)\n"}, {"message": "Ошибка при создании внешнего ключа fk_hlt_regmedicalcheck_rf_kl_OncoSocialGroupID", "exception": "(psycopg2.errors.UndefinedTable) relation \"oms_kl_oncosocialgroup\" does not exist\n\n[SQL: \n ALTER TABLE \"hlt_regmedicalcheck\" \n ADD CONSTRAINT \"fk_hlt_regmedicalcheck_rf_kl_OncoSocialGroupID\" \n FOREIGN KEY (\"rf_kl_OncoSocialGroupID\") \n REFERENCES \"oms_kl_oncosocialgroup\" (\"kl_OncoSocialGroupID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)", "timestamp": "2026-04-16T01:28:31.283306", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.UndefinedTable: relation \"oms_kl_oncosocialgroup\" does not exist\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 843, in create_pg_foreign_keys\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation \"oms_kl_oncosocialgroup\" does not exist\n\n[SQL: \n ALTER TABLE \"hlt_regmedicalcheck\" \n ADD CONSTRAINT \"fk_hlt_regmedicalcheck_rf_kl_OncoSocialGroupID\" \n FOREIGN KEY (\"rf_kl_OncoSocialGroupID\") \n REFERENCES \"oms_kl_oncosocialgroup\" (\"kl_OncoSocialGroupID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)\n"}, {"message": "Ошибка при создании индекса idx_hlt_smtap_rf_omsservicemedicalid__smtapid__x_edition__x_status", "exception": "(psycopg2.errors.TooManyColumns) cannot use more than 32 columns in an index\n\n[SQL: CREATE INDEX IF NOT EXISTS \"idx_hlt_smtap_rf_omsservicemedicalid__smtapid__x_edition__x_status\" ON \"hlt_smtap\" (\"SMTAPID\", \"x_Edition\", \"x_Status\", \"rf_TAPID\", \"REG_S\", \"SMTAPGuid\", \"IsFake\", \"rf_LPUDoctorID\", \"Count\", \"DATE_P\", \"rf_DoctorVisitTableID\", \"FLAGS\", \"rf_LPUID\", \"rf_MKBID\", \"Description\", \"rf_TariffID\", \"rf_DepartmentID\", \"CreateUserName\", \"EditUserName\", \"FlagBill\", \"FlagComplete\", \"FlagPay\", \"FlagStatist\", \"rf_CreateUserID\", \"rf_EditUserID\", \"rf_InvoiceID\", \"rf_DocPRVDID\", \"Sum_Opl\", \"Sum_V\", \"DATE_E\", \"rf_kl_VisitPlaceID\", \"rf_LPUDoctor_SID\", \"rf_BillServiceID\", \"rf_RootSMTAPID\", \"rf_OperationID\", \"rf_kl_TeethID\", \"rf_kl_ActionTeethID\", \"rf_usl_ProfitTypeID\", \"rf_omsServiceMedicalID\")]\n(Background on this error at: https://sqlalche.me/e/20/e3q8)", "timestamp": "2026-04-16T02:00:34.922886", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.TooManyColumns: cannot use more than 32 columns in an index\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 710, in create_pg_indexes\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.OperationalError: (psycopg2.errors.TooManyColumns) cannot use more than 32 columns in an index\n\n[SQL: CREATE INDEX IF NOT EXISTS \"idx_hlt_smtap_rf_omsservicemedicalid__smtapid__x_edition__x_status\" ON \"hlt_smtap\" (\"SMTAPID\", \"x_Edition\", \"x_Status\", \"rf_TAPID\", \"REG_S\", \"SMTAPGuid\", \"IsFake\", \"rf_LPUDoctorID\", \"Count\", \"DATE_P\", \"rf_DoctorVisitTableID\", \"FLAGS\", \"rf_LPUID\", \"rf_MKBID\", \"Description\", \"rf_TariffID\", \"rf_DepartmentID\", \"CreateUserName\", \"EditUserName\", \"FlagBill\", \"FlagComplete\", \"FlagPay\", \"FlagStatist\", \"rf_CreateUserID\", \"rf_EditUserID\", \"rf_InvoiceID\", \"rf_DocPRVDID\", \"Sum_Opl\", \"Sum_V\", \"DATE_E\", \"rf_kl_VisitPlaceID\", \"rf_LPUDoctor_SID\", \"rf_BillServiceID\", \"rf_RootSMTAPID\", \"rf_OperationID\", \"rf_kl_TeethID\", \"rf_kl_ActionTeethID\", \"rf_usl_ProfitTypeID\", \"rf_omsServiceMedicalID\")]\n(Background on this error at: https://sqlalche.me/e/20/e3q8)\n"}, {"message": "Ошибка при создании внешнего ключа fk_hlt_smtap_rf_DogovorPayingID", "exception": "(psycopg2.errors.UndefinedTable) relation \"hlt_dogovorpaying\" does not exist\n\n[SQL: \n ALTER TABLE \"hlt_smtap\" \n ADD CONSTRAINT \"fk_hlt_smtap_rf_DogovorPayingID\" \n FOREIGN KEY (\"rf_DogovorPayingID\") \n REFERENCES \"hlt_dogovorpaying\" (\"DogovorPayingID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)", "timestamp": "2026-04-16T02:00:41.569485", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.UndefinedTable: relation \"hlt_dogovorpaying\" does not exist\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 843, in create_pg_foreign_keys\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation \"hlt_dogovorpaying\" does not exist\n\n[SQL: \n ALTER TABLE \"hlt_smtap\" \n ADD CONSTRAINT \"fk_hlt_smtap_rf_DogovorPayingID\" \n FOREIGN KEY (\"rf_DogovorPayingID\") \n REFERENCES \"hlt_dogovorpaying\" (\"DogovorPayingID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)\n"}, {"message": "Ошибка при выполнении VACUUM ANALYZE для таблицы hlt_smtap", "exception": "(psycopg2.errors.ActiveSqlTransaction) VACUUM cannot run inside a transaction block\n\n[SQL: VACUUM ANALYZE \"hlt_smtap\"]\n(Background on this error at: https://sqlalche.me/e/20/2j85)", "timestamp": "2026-04-16T02:00:41.571359", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.ActiveSqlTransaction: VACUUM cannot run inside a transaction block\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 871, in vacuum_analyze_table\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.InternalError: (psycopg2.errors.ActiveSqlTransaction) VACUUM cannot run inside a transaction block\n\n[SQL: VACUUM ANALYZE \"hlt_smtap\"]\n(Background on this error at: https://sqlalche.me/e/20/2j85)\n"}, {"message": "Ошибка при создании внешнего ключа fk_hlt_tap_rf_FomsRegMedicalCheckStatusID", "exception": "(psycopg2.errors.UndefinedTable) relation \"hlt_fomsregmedicalcheckstatus\" does not exist\n\n[SQL: \n ALTER TABLE \"hlt_tap\" \n ADD CONSTRAINT \"fk_hlt_tap_rf_FomsRegMedicalCheckStatusID\" \n FOREIGN KEY (\"rf_FomsRegMedicalCheckStatusID\") \n REFERENCES \"hlt_fomsregmedicalcheckstatus\" (\"FomsRegMedicalCheckStatusID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)", "timestamp": "2026-04-16T03:10:24.249339", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.UndefinedTable: relation \"hlt_fomsregmedicalcheckstatus\" does not exist\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 843, in create_pg_foreign_keys\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation \"hlt_fomsregmedicalcheckstatus\" does not exist\n\n[SQL: \n ALTER TABLE \"hlt_tap\" \n ADD CONSTRAINT \"fk_hlt_tap_rf_FomsRegMedicalCheckStatusID\" \n FOREIGN KEY (\"rf_FomsRegMedicalCheckStatusID\") \n REFERENCES \"hlt_fomsregmedicalcheckstatus\" (\"FomsRegMedicalCheckStatusID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)\n"}, {"message": "Ошибка при создании внешнего ключа fk_hlt_tap_rf_StatusGisOmsID", "exception": "(psycopg2.errors.UndefinedTable) relation \"oms_statusgisoms\" does not exist\n\n[SQL: \n ALTER TABLE \"hlt_tap\" \n ADD CONSTRAINT \"fk_hlt_tap_rf_StatusGisOmsID\" \n FOREIGN KEY (\"rf_StatusGisOmsID\") \n REFERENCES \"oms_statusgisoms\" (\"StatusGisOmsID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)", "timestamp": "2026-04-16T03:10:24.462757", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.UndefinedTable: relation \"oms_statusgisoms\" does not exist\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 843, in create_pg_foreign_keys\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation \"oms_statusgisoms\" does not exist\n\n[SQL: \n ALTER TABLE \"hlt_tap\" \n ADD CONSTRAINT \"fk_hlt_tap_rf_StatusGisOmsID\" \n FOREIGN KEY (\"rf_StatusGisOmsID\") \n REFERENCES \"oms_statusgisoms\" (\"StatusGisOmsID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)\n"}, {"message": "Ошибка при выполнении VACUUM ANALYZE для таблицы hlt_tap", "exception": "(psycopg2.errors.ActiveSqlTransaction) VACUUM cannot run inside a transaction block\n\n[SQL: VACUUM ANALYZE \"hlt_tap\"]\n(Background on this error at: https://sqlalche.me/e/20/2j85)", "timestamp": "2026-04-16T03:10:24.464868", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.ActiveSqlTransaction: VACUUM cannot run inside a transaction block\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 871, in vacuum_analyze_table\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.InternalError: (psycopg2.errors.ActiveSqlTransaction) VACUUM cannot run inside a transaction block\n\n[SQL: VACUUM ANALYZE \"hlt_tap\"]\n(Background on this error at: https://sqlalche.me/e/20/2j85)\n"}, {"message": "Ошибка при создании внешнего ключа fk_oms_lpu_rf_AddressID", "exception": "(psycopg2.errors.UndefinedTable) relation \"kla_address\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_lpu\" \n ADD CONSTRAINT \"fk_oms_lpu_rf_AddressID\" \n FOREIGN KEY (\"rf_AddressID\") \n REFERENCES \"kla_address\" (\"AddressID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)", "timestamp": "2026-04-16T03:10:42.836713", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.UndefinedTable: relation \"kla_address\" does not exist\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 843, in create_pg_foreign_keys\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation \"kla_address\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_lpu\" \n ADD CONSTRAINT \"fk_oms_lpu_rf_AddressID\" \n FOREIGN KEY (\"rf_AddressID\") \n REFERENCES \"kla_address\" (\"AddressID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)\n"}, {"message": "Ошибка при создании внешнего ключа fk_oms_lpu_rf_kl_AgeGroupID", "exception": "(psycopg2.errors.UndefinedTable) relation \"oms_kl_agegroup\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_lpu\" \n ADD CONSTRAINT \"fk_oms_lpu_rf_kl_AgeGroupID\" \n FOREIGN KEY (\"rf_kl_AgeGroupID\") \n REFERENCES \"oms_kl_agegroup\" (\"kl_AgeGroupID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)", "timestamp": "2026-04-16T03:10:42.838673", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.UndefinedTable: relation \"oms_kl_agegroup\" does not exist\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 843, in create_pg_foreign_keys\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation \"oms_kl_agegroup\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_lpu\" \n ADD CONSTRAINT \"fk_oms_lpu_rf_kl_AgeGroupID\" \n FOREIGN KEY (\"rf_kl_AgeGroupID\") \n REFERENCES \"oms_kl_agegroup\" (\"kl_AgeGroupID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)\n"}, {"message": "Ошибка при создании внешнего ключа fk_oms_lpu_rf_kl_CategoryID", "exception": "(psycopg2.errors.UndefinedTable) relation \"oms_kl_category\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_lpu\" \n ADD CONSTRAINT \"fk_oms_lpu_rf_kl_CategoryID\" \n FOREIGN KEY (\"rf_kl_CategoryID\") \n REFERENCES \"oms_kl_category\" (\"kl_CategoryID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)", "timestamp": "2026-04-16T03:10:42.840597", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.UndefinedTable: relation \"oms_kl_category\" does not exist\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 843, in create_pg_foreign_keys\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation \"oms_kl_category\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_lpu\" \n ADD CONSTRAINT \"fk_oms_lpu_rf_kl_CategoryID\" \n FOREIGN KEY (\"rf_kl_CategoryID\") \n REFERENCES \"oms_kl_category\" (\"kl_CategoryID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)\n"}, {"message": "Ошибка при создании внешнего ключа fk_oms_lpu_rf_kl_LpuMedTypeID", "exception": "(psycopg2.errors.UndefinedTable) relation \"oms_kl_lpumedtype\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_lpu\" \n ADD CONSTRAINT \"fk_oms_lpu_rf_kl_LpuMedTypeID\" \n FOREIGN KEY (\"rf_kl_LpuMedTypeID\") \n REFERENCES \"oms_kl_lpumedtype\" (\"kl_LpuMedTypeID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)", "timestamp": "2026-04-16T03:10:42.842477", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.UndefinedTable: relation \"oms_kl_lpumedtype\" does not exist\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 843, in create_pg_foreign_keys\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation \"oms_kl_lpumedtype\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_lpu\" \n ADD CONSTRAINT \"fk_oms_lpu_rf_kl_LpuMedTypeID\" \n FOREIGN KEY (\"rf_kl_LpuMedTypeID\") \n REFERENCES \"oms_kl_lpumedtype\" (\"kl_LpuMedTypeID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)\n"}, {"message": "Ошибка при создании внешнего ключа fk_oms_lpu_rf_kl_MedCareTypeID", "exception": "(psycopg2.errors.UndefinedTable) relation \"oms_kl_medcaretype\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_lpu\" \n ADD CONSTRAINT \"fk_oms_lpu_rf_kl_MedCareTypeID\" \n FOREIGN KEY (\"rf_kl_MedCareTypeID\") \n REFERENCES \"oms_kl_medcaretype\" (\"kl_MedCareTypeID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)", "timestamp": "2026-04-16T03:10:42.844486", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.UndefinedTable: relation \"oms_kl_medcaretype\" does not exist\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 843, in create_pg_foreign_keys\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation \"oms_kl_medcaretype\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_lpu\" \n ADD CONSTRAINT \"fk_oms_lpu_rf_kl_MedCareTypeID\" \n FOREIGN KEY (\"rf_kl_MedCareTypeID\") \n REFERENCES \"oms_kl_medcaretype\" (\"kl_MedCareTypeID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)\n"}, {"message": "Ошибка при создании внешнего ключа fk_oms_lpu_rf_kl_TariffTypeID", "exception": "(psycopg2.errors.UndefinedTable) relation \"oms_kl_tarifftype\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_lpu\" \n ADD CONSTRAINT \"fk_oms_lpu_rf_kl_TariffTypeID\" \n FOREIGN KEY (\"rf_kl_TariffTypeID\") \n REFERENCES \"oms_kl_tarifftype\" (\"kl_TariffTypeID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)", "timestamp": "2026-04-16T03:10:42.846319", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.UndefinedTable: relation \"oms_kl_tarifftype\" does not exist\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 843, in create_pg_foreign_keys\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation \"oms_kl_tarifftype\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_lpu\" \n ADD CONSTRAINT \"fk_oms_lpu_rf_kl_TariffTypeID\" \n FOREIGN KEY (\"rf_kl_TariffTypeID\") \n REFERENCES \"oms_kl_tarifftype\" (\"kl_TariffTypeID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)\n"}, {"message": "Ошибка при создании внешнего ключа fk_oms_lpu_rf_kl_Type_LPUID", "exception": "(psycopg2.errors.UndefinedTable) relation \"oms_kl_type_lpu\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_lpu\" \n ADD CONSTRAINT \"fk_oms_lpu_rf_kl_Type_LPUID\" \n FOREIGN KEY (\"rf_kl_Type_LPUID\") \n REFERENCES \"oms_kl_type_lpu\" (\"kl_Type_LPUID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)", "timestamp": "2026-04-16T03:10:42.848564", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.UndefinedTable: relation \"oms_kl_type_lpu\" does not exist\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 843, in create_pg_foreign_keys\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation \"oms_kl_type_lpu\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_lpu\" \n ADD CONSTRAINT \"fk_oms_lpu_rf_kl_Type_LPUID\" \n FOREIGN KEY (\"rf_kl_Type_LPUID\") \n REFERENCES \"oms_kl_type_lpu\" (\"kl_Type_LPUID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)\n"}, {"message": "Ошибка при создании внешнего ключа fk_oms_lpu_rf_OKATOID", "exception": "(psycopg2.errors.UndefinedTable) relation \"oms_okato\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_lpu\" \n ADD CONSTRAINT \"fk_oms_lpu_rf_OKATOID\" \n FOREIGN KEY (\"rf_OKATOID\") \n REFERENCES \"oms_okato\" (\"OKATOID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)", "timestamp": "2026-04-16T03:10:42.855167", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.UndefinedTable: relation \"oms_okato\" does not exist\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 843, in create_pg_foreign_keys\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation \"oms_okato\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_lpu\" \n ADD CONSTRAINT \"fk_oms_lpu_rf_OKATOID\" \n FOREIGN KEY (\"rf_OKATOID\") \n REFERENCES \"oms_okato\" (\"OKATOID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)\n"}, {"message": "Ошибка при создании внешнего ключа fk_oms_lpu_rf_OrganisationID", "exception": "(psycopg2.errors.UndefinedTable) relation \"oms_organisation\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_lpu\" \n ADD CONSTRAINT \"fk_oms_lpu_rf_OrganisationID\" \n FOREIGN KEY (\"rf_OrganisationID\") \n REFERENCES \"oms_organisation\" (\"OrganisationID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)", "timestamp": "2026-04-16T03:10:42.857247", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.UndefinedTable: relation \"oms_organisation\" does not exist\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 843, in create_pg_foreign_keys\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation \"oms_organisation\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_lpu\" \n ADD CONSTRAINT \"fk_oms_lpu_rf_OrganisationID\" \n FOREIGN KEY (\"rf_OrganisationID\") \n REFERENCES \"oms_organisation\" (\"OrganisationID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)\n"}, {"message": "Ошибка при создании внешнего ключа fk_oms_lpu_rf_TariffTargetID", "exception": "(psycopg2.errors.UndefinedTable) relation \"oms_tarifftarget\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_lpu\" \n ADD CONSTRAINT \"fk_oms_lpu_rf_TariffTargetID\" \n FOREIGN KEY (\"rf_TariffTargetID\") \n REFERENCES \"oms_tarifftarget\" (\"TariffTargetID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)", "timestamp": "2026-04-16T03:10:42.865005", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.UndefinedTable: relation \"oms_tarifftarget\" does not exist\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 843, in create_pg_foreign_keys\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation \"oms_tarifftarget\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_lpu\" \n ADD CONSTRAINT \"fk_oms_lpu_rf_TariffTargetID\" \n FOREIGN KEY (\"rf_TariffTargetID\") \n REFERENCES \"oms_tarifftarget\" (\"TariffTargetID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)\n"}, {"message": "Ошибка при создании индекса idx_oms_paramvalue_idx_pramavalue_datevaluerf_paramid", "exception": "(psycopg2.errors.ProgramLimitExceeded) index row requires 10128 bytes, maximum size is 8191\nCONTEXT: parallel worker\n\n[SQL: CREATE INDEX IF NOT EXISTS \"idx_oms_paramvalue_idx_pramavalue_datevaluerf_paramid\" ON \"oms_paramvalue\" (\"Date\", \"Value\", \"rf_ParamID\", \"PatientGUID\")]\n(Background on this error at: https://sqlalche.me/e/20/e3q8)", "timestamp": "2026-04-16T07:51:25.356176", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.ProgramLimitExceeded: index row requires 10128 bytes, maximum size is 8191\nCONTEXT: parallel worker\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 710, in create_pg_indexes\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.OperationalError: (psycopg2.errors.ProgramLimitExceeded) index row requires 10128 bytes, maximum size is 8191\nCONTEXT: parallel worker\n\n[SQL: CREATE INDEX IF NOT EXISTS \"idx_oms_paramvalue_idx_pramavalue_datevaluerf_paramid\" ON \"oms_paramvalue\" (\"Date\", \"Value\", \"rf_ParamID\", \"PatientGUID\")]\n(Background on this error at: https://sqlalche.me/e/20/e3q8)\n"}, {"message": "Ошибка при создании внешнего ключа fk_oms_paramvalue_rf_mn_DocLPUID", "exception": "(psycopg2.errors.UndefinedTable) relation \"oms_mn_doclpu\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_paramvalue\" \n ADD CONSTRAINT \"fk_oms_paramvalue_rf_mn_DocLPUID\" \n FOREIGN KEY (\"rf_mn_DocLPUID\") \n REFERENCES \"oms_mn_doclpu\" (\"mn_DocLPUID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)", "timestamp": "2026-04-16T07:52:14.115262", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.UndefinedTable: relation \"oms_mn_doclpu\" does not exist\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 843, in create_pg_foreign_keys\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation \"oms_mn_doclpu\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_paramvalue\" \n ADD CONSTRAINT \"fk_oms_paramvalue_rf_mn_DocLPUID\" \n FOREIGN KEY (\"rf_mn_DocLPUID\") \n REFERENCES \"oms_mn_doclpu\" (\"mn_DocLPUID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)\n"}, {"message": "Ошибка при создании внешнего ключа fk_oms_paramvalue_rf_mn_PersonID", "exception": "(psycopg2.errors.UndefinedTable) relation \"oms_mn_person\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_paramvalue\" \n ADD CONSTRAINT \"fk_oms_paramvalue_rf_mn_PersonID\" \n FOREIGN KEY (\"rf_mn_PersonID\") \n REFERENCES \"oms_mn_person\" (\"mn_PersonID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)", "timestamp": "2026-04-16T07:52:14.117917", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.UndefinedTable: relation \"oms_mn_person\" does not exist\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 843, in create_pg_foreign_keys\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation \"oms_mn_person\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_paramvalue\" \n ADD CONSTRAINT \"fk_oms_paramvalue_rf_mn_PersonID\" \n FOREIGN KEY (\"rf_mn_PersonID\") \n REFERENCES \"oms_mn_person\" (\"mn_PersonID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)\n"}, {"message": "Ошибка при создании внешнего ключа fk_oms_paramvalue_rf_ParamID", "exception": "(psycopg2.errors.UndefinedTable) relation \"oms_param\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_paramvalue\" \n ADD CONSTRAINT \"fk_oms_paramvalue_rf_ParamID\" \n FOREIGN KEY (\"rf_ParamID\") \n REFERENCES \"oms_param\" (\"ParamID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)", "timestamp": "2026-04-16T07:52:14.121537", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.UndefinedTable: relation \"oms_param\" does not exist\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 843, in create_pg_foreign_keys\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation \"oms_param\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_paramvalue\" \n ADD CONSTRAINT \"fk_oms_paramvalue_rf_ParamID\" \n FOREIGN KEY (\"rf_ParamID\") \n REFERENCES \"oms_param\" (\"ParamID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)\n"}, {"message": "Ошибка при создании внешнего ключа fk_oms_paramvalue_rf_ParamVarID", "exception": "(psycopg2.errors.UndefinedTable) relation \"oms_paramvar\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_paramvalue\" \n ADD CONSTRAINT \"fk_oms_paramvalue_rf_ParamVarID\" \n FOREIGN KEY (\"rf_ParamVarID\") \n REFERENCES \"oms_paramvar\" (\"ParamVarID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)", "timestamp": "2026-04-16T07:52:14.123917", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.UndefinedTable: relation \"oms_paramvar\" does not exist\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 843, in create_pg_foreign_keys\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation \"oms_paramvar\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_paramvalue\" \n ADD CONSTRAINT \"fk_oms_paramvalue_rf_ParamVarID\" \n FOREIGN KEY (\"rf_ParamVarID\") \n REFERENCES \"oms_paramvar\" (\"ParamVarID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)\n"}, {"message": "Ошибка при выполнении VACUUM ANALYZE для таблицы oms_paramvalue", "exception": "(psycopg2.errors.ActiveSqlTransaction) VACUUM cannot run inside a transaction block\n\n[SQL: VACUUM ANALYZE \"oms_paramvalue\"]\n(Background on this error at: https://sqlalche.me/e/20/2j85)", "timestamp": "2026-04-16T07:52:14.126357", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.ActiveSqlTransaction: VACUUM cannot run inside a transaction block\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 871, in vacuum_analyze_table\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.InternalError: (psycopg2.errors.ActiveSqlTransaction) VACUUM cannot run inside a transaction block\n\n[SQL: VACUUM ANALYZE \"oms_paramvalue\"]\n(Background on this error at: https://sqlalche.me/e/20/2j85)\n"}, {"message": "Ошибка при создании внешнего ключа fk_oms_prvd_rf_kl_ProfitTypeID", "exception": "(psycopg2.errors.UndefinedTable) relation \"oms_kl_profittype\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_prvd\" \n ADD CONSTRAINT \"fk_oms_prvd_rf_kl_ProfitTypeID\" \n FOREIGN KEY (\"rf_kl_ProfitTypeID\") \n REFERENCES \"oms_kl_profittype\" (\"kl_ProfitTypeID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)", "timestamp": "2026-04-16T07:52:18.716558", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.UndefinedTable: relation \"oms_kl_profittype\" does not exist\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 843, in create_pg_foreign_keys\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation \"oms_kl_profittype\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_prvd\" \n ADD CONSTRAINT \"fk_oms_prvd_rf_kl_ProfitTypeID\" \n FOREIGN KEY (\"rf_kl_ProfitTypeID\") \n REFERENCES \"oms_kl_profittype\" (\"kl_ProfitTypeID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)\n"}, {"message": "Ошибка при создании внешнего ключа fk_oms_servicemedical_rf_kl_ActionTeethID", "exception": "(psycopg2.errors.UndefinedTable) relation \"oms_kl_actionteeth\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_servicemedical\" \n ADD CONSTRAINT \"fk_oms_servicemedical_rf_kl_ActionTeethID\" \n FOREIGN KEY (\"rf_kl_ActionTeethID\") \n REFERENCES \"oms_kl_actionteeth\" (\"kl_ActionTeethID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)", "timestamp": "2026-04-16T07:53:01.891610", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.UndefinedTable: relation \"oms_kl_actionteeth\" does not exist\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 843, in create_pg_foreign_keys\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation \"oms_kl_actionteeth\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_servicemedical\" \n ADD CONSTRAINT \"fk_oms_servicemedical_rf_kl_ActionTeethID\" \n FOREIGN KEY (\"rf_kl_ActionTeethID\") \n REFERENCES \"oms_kl_actionteeth\" (\"kl_ActionTeethID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)\n"}, {"message": "Ошибка при создании внешнего ключа fk_oms_servicemedical_rf_kl_AgeGroupID", "exception": "(psycopg2.errors.UndefinedTable) relation \"oms_kl_agegroup\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_servicemedical\" \n ADD CONSTRAINT \"fk_oms_servicemedical_rf_kl_AgeGroupID\" \n FOREIGN KEY (\"rf_kl_AgeGroupID\") \n REFERENCES \"oms_kl_agegroup\" (\"kl_AgeGroupID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)", "timestamp": "2026-04-16T07:53:01.893773", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.UndefinedTable: relation \"oms_kl_agegroup\" does not exist\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 843, in create_pg_foreign_keys\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation \"oms_kl_agegroup\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_servicemedical\" \n ADD CONSTRAINT \"fk_oms_servicemedical_rf_kl_AgeGroupID\" \n FOREIGN KEY (\"rf_kl_AgeGroupID\") \n REFERENCES \"oms_kl_agegroup\" (\"kl_AgeGroupID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)\n"}, {"message": "Ошибка при создании внешнего ключа fk_oms_servicemedical_rf_kl_DepartmentProfileID", "exception": "(psycopg2.errors.UndefinedTable) relation \"oms_kl_departmentprofile\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_servicemedical\" \n ADD CONSTRAINT \"fk_oms_servicemedical_rf_kl_DepartmentProfileID\" \n FOREIGN KEY (\"rf_kl_DepartmentProfileID\") \n REFERENCES \"oms_kl_departmentprofile\" (\"kl_DepartmentProfileID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)", "timestamp": "2026-04-16T07:53:01.909094", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.UndefinedTable: relation \"oms_kl_departmentprofile\" does not exist\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 843, in create_pg_foreign_keys\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation \"oms_kl_departmentprofile\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_servicemedical\" \n ADD CONSTRAINT \"fk_oms_servicemedical_rf_kl_DepartmentProfileID\" \n FOREIGN KEY (\"rf_kl_DepartmentProfileID\") \n REFERENCES \"oms_kl_departmentprofile\" (\"kl_DepartmentProfileID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)\n"}, {"message": "Ошибка при создании внешнего ключа fk_oms_servicemedical_rf_kl_DepartmentTypeID", "exception": "(psycopg2.errors.UndefinedTable) relation \"oms_kl_departmenttype\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_servicemedical\" \n ADD CONSTRAINT \"fk_oms_servicemedical_rf_kl_DepartmentTypeID\" \n FOREIGN KEY (\"rf_kl_DepartmentTypeID\") \n REFERENCES \"oms_kl_departmenttype\" (\"kl_DepartmentTypeID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)", "timestamp": "2026-04-16T07:53:01.911260", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.UndefinedTable: relation \"oms_kl_departmenttype\" does not exist\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 843, in create_pg_foreign_keys\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation \"oms_kl_departmenttype\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_servicemedical\" \n ADD CONSTRAINT \"fk_oms_servicemedical_rf_kl_DepartmentTypeID\" \n FOREIGN KEY (\"rf_kl_DepartmentTypeID\") \n REFERENCES \"oms_kl_departmenttype\" (\"kl_DepartmentTypeID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)\n"}, {"message": "Ошибка при создании внешнего ключа fk_oms_servicemedical_rf_kl_MedCareLicenceID", "exception": "(psycopg2.errors.UndefinedTable) relation \"oms_kl_medcarelicence\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_servicemedical\" \n ADD CONSTRAINT \"fk_oms_servicemedical_rf_kl_MedCareLicenceID\" \n FOREIGN KEY (\"rf_kl_MedCareLicenceID\") \n REFERENCES \"oms_kl_medcarelicence\" (\"kl_MedCareLicenceID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)", "timestamp": "2026-04-16T07:53:01.913090", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.UndefinedTable: relation \"oms_kl_medcarelicence\" does not exist\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 843, in create_pg_foreign_keys\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation \"oms_kl_medcarelicence\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_servicemedical\" \n ADD CONSTRAINT \"fk_oms_servicemedical_rf_kl_MedCareLicenceID\" \n FOREIGN KEY (\"rf_kl_MedCareLicenceID\") \n REFERENCES \"oms_kl_medcarelicence\" (\"kl_MedCareLicenceID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)\n"}, {"message": "Ошибка при создании внешнего ключа fk_oms_servicemedical_rf_kl_MedCareTypeID", "exception": "(psycopg2.errors.UndefinedTable) relation \"oms_kl_medcaretype\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_servicemedical\" \n ADD CONSTRAINT \"fk_oms_servicemedical_rf_kl_MedCareTypeID\" \n FOREIGN KEY (\"rf_kl_MedCareTypeID\") \n REFERENCES \"oms_kl_medcaretype\" (\"kl_MedCareTypeID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)", "timestamp": "2026-04-16T07:53:01.914992", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.UndefinedTable: relation \"oms_kl_medcaretype\" does not exist\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 843, in create_pg_foreign_keys\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation \"oms_kl_medcaretype\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_servicemedical\" \n ADD CONSTRAINT \"fk_oms_servicemedical_rf_kl_MedCareTypeID\" \n FOREIGN KEY (\"rf_kl_MedCareTypeID\") \n REFERENCES \"oms_kl_medcaretype\" (\"kl_MedCareTypeID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)\n"}, {"message": "Ошибка при создании внешнего ключа fk_oms_servicemedical_rf_kl_MedCareUnitID", "exception": "(psycopg2.errors.UndefinedTable) relation \"oms_kl_medcareunit\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_servicemedical\" \n ADD CONSTRAINT \"fk_oms_servicemedical_rf_kl_MedCareUnitID\" \n FOREIGN KEY (\"rf_kl_MedCareUnitID\") \n REFERENCES \"oms_kl_medcareunit\" (\"kl_MedCareUnitID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)", "timestamp": "2026-04-16T07:53:01.916851", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.UndefinedTable: relation \"oms_kl_medcareunit\" does not exist\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 843, in create_pg_foreign_keys\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation \"oms_kl_medcareunit\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_servicemedical\" \n ADD CONSTRAINT \"fk_oms_servicemedical_rf_kl_MedCareUnitID\" \n FOREIGN KEY (\"rf_kl_MedCareUnitID\") \n REFERENCES \"oms_kl_medcareunit\" (\"kl_MedCareUnitID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)\n"}, {"message": "Ошибка при создании внешнего ключа fk_oms_servicemedical_rf_kl_MetodHMPID", "exception": "(psycopg2.errors.UndefinedTable) relation \"oms_kl_metodhmp\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_servicemedical\" \n ADD CONSTRAINT \"fk_oms_servicemedical_rf_kl_MetodHMPID\" \n FOREIGN KEY (\"rf_kl_MetodHMPID\") \n REFERENCES \"oms_kl_metodhmp\" (\"kl_MetodHMPID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)", "timestamp": "2026-04-16T07:53:01.918876", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.UndefinedTable: relation \"oms_kl_metodhmp\" does not exist\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 843, in create_pg_foreign_keys\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation \"oms_kl_metodhmp\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_servicemedical\" \n ADD CONSTRAINT \"fk_oms_servicemedical_rf_kl_MetodHMPID\" \n FOREIGN KEY (\"rf_kl_MetodHMPID\") \n REFERENCES \"oms_kl_metodhmp\" (\"kl_MetodHMPID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)\n"}, {"message": "Ошибка при создании внешнего ключа fk_oms_servicemedical_rf_kl_NomServiceID", "exception": "(psycopg2.errors.UndefinedTable) relation \"oms_kl_nomservice\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_servicemedical\" \n ADD CONSTRAINT \"fk_oms_servicemedical_rf_kl_NomServiceID\" \n FOREIGN KEY (\"rf_kl_NomServiceID\") \n REFERENCES \"oms_kl_nomservice\" (\"kl_NomServiceID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)", "timestamp": "2026-04-16T07:53:01.920623", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.UndefinedTable: relation \"oms_kl_nomservice\" does not exist\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 843, in create_pg_foreign_keys\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation \"oms_kl_nomservice\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_servicemedical\" \n ADD CONSTRAINT \"fk_oms_servicemedical_rf_kl_NomServiceID\" \n FOREIGN KEY (\"rf_kl_NomServiceID\") \n REFERENCES \"oms_kl_nomservice\" (\"kl_NomServiceID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)\n"}, {"message": "Ошибка при создании внешнего ключа fk_oms_servicemedical_rf_kl_OperationTypeID", "exception": "(psycopg2.errors.UndefinedTable) relation \"oms_kl_operationtype\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_servicemedical\" \n ADD CONSTRAINT \"fk_oms_servicemedical_rf_kl_OperationTypeID\" \n FOREIGN KEY (\"rf_kl_OperationTypeID\") \n REFERENCES \"oms_kl_operationtype\" (\"kl_OperationTypeID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)", "timestamp": "2026-04-16T07:53:01.922569", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.UndefinedTable: relation \"oms_kl_operationtype\" does not exist\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 843, in create_pg_foreign_keys\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation \"oms_kl_operationtype\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_servicemedical\" \n ADD CONSTRAINT \"fk_oms_servicemedical_rf_kl_OperationTypeID\" \n FOREIGN KEY (\"rf_kl_OperationTypeID\") \n REFERENCES \"oms_kl_operationtype\" (\"kl_OperationTypeID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)\n"}, {"message": "Ошибка при создании внешнего ключа fk_oms_servicemedical_rf_kl_ProfitTypeID", "exception": "(psycopg2.errors.UndefinedTable) relation \"oms_kl_profittype\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_servicemedical\" \n ADD CONSTRAINT \"fk_oms_servicemedical_rf_kl_ProfitTypeID\" \n FOREIGN KEY (\"rf_kl_ProfitTypeID\") \n REFERENCES \"oms_kl_profittype\" (\"kl_ProfitTypeID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)", "timestamp": "2026-04-16T07:53:01.924434", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.UndefinedTable: relation \"oms_kl_profittype\" does not exist\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 843, in create_pg_foreign_keys\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation \"oms_kl_profittype\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_servicemedical\" \n ADD CONSTRAINT \"fk_oms_servicemedical_rf_kl_ProfitTypeID\" \n FOREIGN KEY (\"rf_kl_ProfitTypeID\") \n REFERENCES \"oms_kl_profittype\" (\"kl_ProfitTypeID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)\n"}, {"message": "Ошибка при создании внешнего ключа fk_oms_servicemedical_rf_kl_SexID", "exception": "(psycopg2.errors.UndefinedTable) relation \"oms_kl_sex\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_servicemedical\" \n ADD CONSTRAINT \"fk_oms_servicemedical_rf_kl_SexID\" \n FOREIGN KEY (\"rf_kl_SexID\") \n REFERENCES \"oms_kl_sex\" (\"kl_SexID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)", "timestamp": "2026-04-16T07:53:01.926144", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.UndefinedTable: relation \"oms_kl_sex\" does not exist\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 843, in create_pg_foreign_keys\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation \"oms_kl_sex\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_servicemedical\" \n ADD CONSTRAINT \"fk_oms_servicemedical_rf_kl_SexID\" \n FOREIGN KEY (\"rf_kl_SexID\") \n REFERENCES \"oms_kl_sex\" (\"kl_SexID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)\n"}, {"message": "Ошибка при создании внешнего ключа fk_oms_servicemedical_rf_kl_VisitTypeID", "exception": "(psycopg2.errors.UndefinedTable) relation \"oms_kl_visittype\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_servicemedical\" \n ADD CONSTRAINT \"fk_oms_servicemedical_rf_kl_VisitTypeID\" \n FOREIGN KEY (\"rf_kl_VisitTypeID\") \n REFERENCES \"oms_kl_visittype\" (\"kl_VisitTypeID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)", "timestamp": "2026-04-16T07:53:01.927896", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.UndefinedTable: relation \"oms_kl_visittype\" does not exist\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 843, in create_pg_foreign_keys\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation \"oms_kl_visittype\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_servicemedical\" \n ADD CONSTRAINT \"fk_oms_servicemedical_rf_kl_VisitTypeID\" \n FOREIGN KEY (\"rf_kl_VisitTypeID\") \n REFERENCES \"oms_kl_visittype\" (\"kl_VisitTypeID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)\n"}, {"message": "Ошибка при создании внешнего ключа fk_oms_servicemedical_rf_PRVSID", "exception": "(psycopg2.errors.UndefinedTable) relation \"oms_prvs\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_servicemedical\" \n ADD CONSTRAINT \"fk_oms_servicemedical_rf_PRVSID\" \n FOREIGN KEY (\"rf_PRVSID\") \n REFERENCES \"oms_prvs\" (\"PRVSID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)", "timestamp": "2026-04-16T07:53:01.938385", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.UndefinedTable: relation \"oms_prvs\" does not exist\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 843, in create_pg_foreign_keys\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation \"oms_prvs\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_servicemedical\" \n ADD CONSTRAINT \"fk_oms_servicemedical_rf_PRVSID\" \n FOREIGN KEY (\"rf_PRVSID\") \n REFERENCES \"oms_prvs\" (\"PRVSID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)\n"}, {"message": "Ошибка при создании внешнего ключа fk_oms_servicemedical_rf_sc_StandartCureID", "exception": "(psycopg2.errors.UndefinedTable) relation \"oms_sc_standartcure\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_servicemedical\" \n ADD CONSTRAINT \"fk_oms_servicemedical_rf_sc_StandartCureID\" \n FOREIGN KEY (\"rf_sc_StandartCureID\") \n REFERENCES \"oms_sc_standartcure\" (\"sc_StandartCureID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)", "timestamp": "2026-04-16T07:53:01.940286", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.UndefinedTable: relation \"oms_sc_standartcure\" does not exist\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 843, in create_pg_foreign_keys\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation \"oms_sc_standartcure\" does not exist\n\n[SQL: \n ALTER TABLE \"oms_servicemedical\" \n ADD CONSTRAINT \"fk_oms_servicemedical_rf_sc_StandartCureID\" \n FOREIGN KEY (\"rf_sc_StandartCureID\") \n REFERENCES \"oms_sc_standartcure\" (\"sc_StandartCureID\")\n ]\n(Background on this error at: https://sqlalche.me/e/20/f405)\n"}, {"message": "Ошибка при создании индекса idx_stt_diagnos_ix_rf_migrationpatientid_rf_diagnostypeid", "exception": "(psycopg2.errors.ProgramLimitExceeded) index row size 2832 exceeds btree version 4 maximum 2704 for index \"idx_stt_diagnos_ix_rf_migrationpatientid_rf_diagnostypeid\"\nDETAIL: Index row references tuple (27367,11) in relation \"stt_diagnos\".\nHINT: Values larger than 1/3 of a buffer page cannot be indexed.\nConsider a function index of an MD5 hash of the value, or use full text indexing.\n\n[SQL: CREATE INDEX IF NOT EXISTS \"idx_stt_diagnos_ix_rf_migrationpatientid_rf_diagnostypeid\" ON \"stt_diagnos\" (\"rf_MKBID\", \"Description\", \"DiagnosID\", \"rf_MigrationPatientID\", \"rf_DiagnosTypeID\", \"Date\")]\n(Background on this error at: https://sqlalche.me/e/20/e3q8)", "timestamp": "2026-04-16T08:02:13.317979", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\npsycopg2.errors.ProgramLimitExceeded: index row size 2832 exceeds btree version 4 maximum 2704 for index \"idx_stt_diagnos_ix_rf_migrationpatientid_rf_diagnostypeid\"\nDETAIL: Index row references tuple (27367,11) in relation \"stt_diagnos\".\nHINT: Values larger than 1/3 of a buffer page cannot be indexed.\nConsider a function index of an MD5 hash of the value, or use full text indexing.\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/migrator.py\", line 710, in create_pg_indexes\n conn.execute(text(sql))\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1419, in execute\n return meth(\n ^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py\", line 527, in _execute_on_connection\n return connection._execute_clauseelement(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1641, in _execute_clauseelement\n ret = self._execute_context(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 2363, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n File \"/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py\", line 952, in do_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.OperationalError: (psycopg2.errors.ProgramLimitExceeded) index row size 2832 exceeds btree version 4 maximum 2704 for index \"idx_stt_diagnos_ix_rf_migrationpatientid_rf_diagnostypeid\"\nDETAIL: Index row references tuple (27367,11) in relation \"stt_diagnos\".\nHINT: Values larger than 1/3 of a buffer page cannot be indexed.\nConsider a function index of an MD5 hash of the value, or use full text indexing.\n\n[SQL: CREATE INDEX IF NOT EXISTS \"idx_stt_diagnos_ix_rf_migrationpatientid_rf_diagnostypeid\" ON \"stt_diagnos\" (\"rf_MKBID\", \"Description\", \"DiagnosID\", \"rf_MigrationPatientID\", \"rf_DiagnosTypeID\", \"Date\")]\n(Background on this error at: https://sqlalche.me/e/20/e3q8)\n"}], "summary": {"duration": "8:47:38.222537", "end_time": "2026-04-16T08:47:39.407498", "start_time": "2026-04-16T00:00:01.184961", "total_rows": 40198631, "success_rate": 98.0, "total_tables": 50, "failed_tables": 1, "successful_tables": 49}, "failed_tables": [{"name": "hlt_MKAB", "error": "(pymssql.exceptions.OperationalError) (20047, b'DB-Lib error message 20047, severity 9:\\nDBPROCESS is dead or not enabled\\n')\n(Background on this error at: https://sqlalche.me/e/20/e3q8)"}], "successful_tables": [{"name": "die_Card", "rows": 8553}, {"name": "die_Certificate", "rows": 11536}, {"name": "die_Mkb", "rows": 46358}, {"name": "hlt_BillService", "rows": 9858}, {"name": "hlt_dent_tech_OrderSM", "rows": 1}, {"name": "hlt_disp_Card", "rows": 42030}, {"name": "hlt_disp_CardPlan", "rows": 783}, {"name": "hlt_disp_Exam", "rows": 912329}, {"name": "hlt_disp_PatientModel", "rows": 3283}, {"name": "hlt_disp_ServicePM", "rows": 62714}, {"name": "hlt_disp_Type", "rows": 23}, {"name": "hlt_DocPRVD", "rows": 3608}, {"name": "hlt_DUVisit", "rows": 77127}, {"name": "hlt_Invoice", "rows": 9691}, {"name": "hlt_LPUDoctor", "rows": 2154}, {"name": "hlt_MKB_TAP", "rows": 1391150}, {"name": "hlt_PolisMKAB", "rows": 527789}, {"name": "hlt_ReestrIdCase", "rows": 1878134}, {"name": "hlt_ReestrMH", "rows": 182}, {"name": "hlt_ReestrMHSMTAP", "rows": 610236}, {"name": "hlt_ReestrTAPMH", "rows": 372890}, {"name": "hlt_RegMedicalCheck", "rows": 49962}, {"name": "hlt_SMTAP", "rows": 1534142}, {"name": "hlt_TAP", "rows": 1727450}, {"name": "oms_DocumentStatus", "rows": 4}, {"name": "oms_kl_DDService", "rows": 17}, {"name": "Oms_LPU", "rows": 2610}, {"name": "Oms_mkb", "rows": 16418}, {"name": "oms_ParamValue", "rows": 28229554}, {"name": "Oms_PRVD", "rows": 329}, {"name": "oms_ServiceMedical", "rows": 19846}, {"name": "oms_StateBirth", "rows": 5}, {"name": "smp_MedService", "rows": 1007}, {"name": "stt_Bed", "rows": 1584}, {"name": "stt_BedAction", "rows": 69516}, {"name": "stt_Dead", "rows": 1479}, {"name": "stt_Diagnos", "rows": 918098}, {"name": "stt_EmerSign", "rows": 4}, {"name": "stt_MedicalHistory", "rows": 241760}, {"name": "stt_MedServicePatient", "rows": 258671}, {"name": "stt_MigrationPatient", "rows": 869917}, {"name": "stt_NewbornHistory", "rows": 6616}, {"name": "stt_OperationPurpose", "rows": 76091}, {"name": "stt_ProcedureList", "rows": 58}, {"name": "stt_Reanimation", "rows": 12408}, {"name": "stt_ReestrMKSB", "rows": 90102}, {"name": "stt_ReestrOccasion", "rows": 39859}, {"name": "stt_StationarBranch", "rows": 139}, {"name": "stt_SurgicalOperation", "rows": 60556}]} \ No newline at end of file