Keep address migration identifiers PostgreSQL-safe
This commit is contained in:
@@ -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'}"
|
||||
|
||||
Reference in New Issue
Block a user