]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/commitdiff
update the fk_names req
authorMike Bayer <mike_mp@zzzcomputing.com>
Sat, 1 Nov 2025 03:39:37 +0000 (23:39 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 1 Nov 2025 03:40:32 +0000 (23:40 -0400)
This is not a limitation this is just a bug in sqlalchemy,
being fixed by #12954.    we dont have a system in place
to cross-check gerrits right now so just merge this and then
merge the SQLAlchemy fix

Change-Id: I9c074c0edb9f55d2400e59a9b2b02603458e8f0b

alembic/testing/suite/test_autogen_fks.py
tests/requirements.py

index 0240b98d3872bad0d123493a97ccb4b30dbbb709..355e244c73d1ca82fad590ef22fae23b639d1b10 100644 (file)
@@ -199,6 +199,7 @@ class AutogenerateForeignKeysTest(AutogenFixtureTest, TestBase):
 
         eq_(diffs, [])
 
+    @config.requirements.fk_names
     def test_casing_convention_changed_so_put_drops_first(self):
         m1 = MetaData()
         m2 = MetaData()
@@ -247,7 +248,7 @@ class AutogenerateForeignKeysTest(AutogenFixtureTest, TestBase):
             ["test2"],
             "some_table",
             ["test"],
-            name="MyFK" if config.requirements.fk_names.enabled else None,
+            name="MyFK",
         )
 
         self._assert_fk_diff(
index 4db5579edbdd40565b8a72571a49f770d83d519a..b8c8a680838a5b5b46714ba968299c3ea18feba3 100644 (file)
@@ -62,8 +62,13 @@ class DefaultRequirements(SuiteRequirements):
 
     @property
     def fk_names(self):
-        """foreign key constraints always have names in the DB"""
-        return exclusions.fails_on("sqlite")
+        """backend can reflect foreign key names"""
+
+        # issue here was fixed in SQLAlchemy #12954 for sqlite, 2.0
+        # release
+        return exclusions.fails_if(
+            lambda config: not sqla_compat.sqla_2 and config.against("sqlite")
+        )
 
     @property
     def reflects_fk_options(self):