Keep address migration identifiers PostgreSQL-safe

This commit is contained in:
2026-08-03 14:16:45 +02:00
parent f9a7185ce3
commit 4f6b223e44
3 changed files with 14 additions and 2 deletions
+11
View File
@@ -7,11 +7,22 @@ from pathlib import Path
from alembic.runtime.migration import MigrationContext
from sqlalchemy import create_engine, inspect
from govoplan_addresses.backend.db.models import Base
from govoplan_addresses.backend.manifest import get_manifest
from govoplan_core.db.migrations import migrate_database
class AddressesMigrationTests(unittest.TestCase):
def test_schema_identifiers_fit_postgresql_limit(self) -> None:
overlong_indexes = sorted(
index.name
for table in Base.metadata.tables.values()
if table.name.startswith("addresses_")
for index in table.indexes
if index.name and len(index.name) > 63
)
self.assertEqual([], overlong_indexes)
def test_fresh_database_reaches_import_profile_head(self) -> None:
with tempfile.TemporaryDirectory(prefix="govoplan-addresses-migration-") as directory:
url = f"sqlite:///{Path(directory) / 'addresses.db'}"