-
-
Notifications
You must be signed in to change notification settings - Fork 41
Open
Description
I have a model which refers to another through the ForeignKey<> type:
#[model]
pub struct Posts {
#[model(primary_key)]
pub id: Auto<i64>,
pub tag: ForeignKey<Tags>,
}
And the model it refers to:
#[model]
pub struct Tags {
#[model(primary_key)]
pub id: Auto<i64>,
}
I created a migration through cot migration make. When running, the following error is obtained:
failed to run the Cot project: ErrorImpl { inner: WithStatusCode(ErrorImpl { inner: MigrationError(MigrationSortError(CycleDetected(CycleDetected))), status_code: Some(500), .. }), status_code: None, .. }
The migration file contained the following, and setting it to an empty array solved the issue:
const DEPENDENCIES: &'static [::cot::db::migrations::MigrationDependency] = &[
::cot::db::migrations::MigrationDependency::model(
<crate::Tags::Tags as ::cot::db::Model>::APP_NAME,
<crate::Tags::Tags as ::cot::db::Model>::TABLE_NAME,
),
];
https://git.alexbissessur.dev/alex/alexbissessur.dev/src/branch/main/src/models The repo link, if that can give some extra context
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels