Cyclic migration dependencies

Đang mở
#503 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
rust
Lĩnh vực
database

Hướng nghiên cứu

Start by reading the migration generation and dependency-sorting entry points in Cot; the issue does not name specific files or tests. Reproduce with the shown Posts and Tags models and inspect why the generated dependency forms a cycle. Done means cot migration make produces migrations that run without the reported cycle error for this case.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
Rust
Star
1.1k
Fork
57
Merge trung bình
17 giờ 39 phút
Pull request đã merge (30 ngày)
12

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của cot-rs/cot

Tất cả issue của cot-rs/cot

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.