Skip to content

Commit 7dae161

Browse files
committed
add extra imports if foreign keys are present
1 parent 6bd0c6a commit 7dae161

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

piccolo/apps/schema/commands/generate.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,9 @@ class Schema(Table, db=engine):
285285
):
286286
column_type = ForeignKey
287287
kwargs["references"] = ForeignKeyPlaceholder
288+
imports.add(
289+
"from piccolo.columns.base import OnDelete, OnUpdate"
290+
)
288291

289292
imports.add(
290293
"from piccolo.column_types import " + column_type.__name__

0 commit comments

Comments
 (0)