Replies: 1 comment 3 replies
-
Hmm, interesting - I'm not sure why there are two The reason these tables get generated is for foreign keys. So something like this (the from piccolo.apps.migrations.auto import MigrationManager
from piccolo.columns import ForeignKey
from piccolo.columns.base import OnDelete
from piccolo.columns.base import OnUpdate
from piccolo.table import Table
class TaskCategory(Table, tablename="task_category"):
pass
ID = "2025-05-10T11:26:44:292246"
VERSION = "X.X.X"
async def forwards():
manager = MigrationManager(migration_id=ID, app_name="home")
manager.add_column(
table_class_name="Task",
tablename="task",
column_name="category",
column_class_name="ForeignKey",
column_class_name=ForeignKey,
params={
"references": TaskCategory,
"on_delete": OnDelete.cascade,
"on_update": OnUpdate.cascade,
"default": None,
"null": True,
"primary": False,
"key": False,
"unique": False,
"index": False,
},
)
return manager Is there anything in your schema which you think might be causing it? |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
After running
piccolo migrations new --auto myapp
, inspecting the generated python file I see these classes after the imports and before the ID etc metadata:Is this normal? What's the purpose, and why does
id
appear twice in each class?There are more tables defined in
myapp/tables.py
, but only the two above have those autogenerated artifacts in the migration file.Beta Was this translation helpful? Give feedback.
All reactions