Skip to content

Commit fd62c02

Browse files
revert: drop foreign_key_action_clause abstraction
ON UPDATE CASCADE ON DELETE RESTRICT is standard SQL supported by both MySQL and PostgreSQL. No need to abstract it — premature generalization for backends we don't support. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent fda5119 commit fd62c02

File tree

2 files changed

+1
-12
lines changed

2 files changed

+1
-12
lines changed

src/datajoint/adapters/base.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -259,17 +259,6 @@ def make_full_table_name(self, database: str, table_name: str) -> str:
259259
"""
260260
return f"{self.quote_identifier(database)}.{self.quote_identifier(table_name)}"
261261

262-
@property
263-
def foreign_key_action_clause(self) -> str:
264-
"""
265-
Referential action clause appended to FOREIGN KEY declarations.
266-
267-
Default: ``ON UPDATE CASCADE ON DELETE RESTRICT`` (MySQL/PostgreSQL).
268-
Backends that don't support referential actions can override to
269-
return ``""``.
270-
"""
271-
return " ON UPDATE CASCADE ON DELETE RESTRICT"
272-
273262
# =========================================================================
274263
# Type Mapping
275264
# =========================================================================

src/datajoint/declare.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ def compile_foreign_key(
299299
ref_table_name = adapter.make_full_table_name(parts[0], parts[1])
300300

301301
foreign_key_sql.append(
302-
f"FOREIGN KEY ({fk_cols}) REFERENCES {ref_table_name} ({pk_cols}){adapter.foreign_key_action_clause}"
302+
f"FOREIGN KEY ({fk_cols}) REFERENCES {ref_table_name} ({pk_cols}) ON UPDATE CASCADE ON DELETE RESTRICT"
303303
)
304304

305305
# declare unique index

0 commit comments

Comments
 (0)