Skip to content

After upgrading to CI4 v4.3.0, the generated schema is broken and can't be used with relations. #43

@jozefrebjak

Description

@jozefrebjak

It appears to be a foreign key issue.

For example schema generated with Shield installed before anad after 4.3.0 upgrade.

CleanShot 2023-01-10 at 14 57 02

My troubleshooting:

in vendor/tatter/schemas/src/Structures/ForeignKey.php

I added dd to the end of __contstruct method and in before 4.3.0 it returns

Tatter\Schemas\Structures\ForeignKey (5) (
    public 'constraint_name' -> string (33) "auth_groups_users_user_id_foreign"
    public 'table_name' -> string (17) "auth_groups_users"
    public 'column_name' -> string (7) "user_id"
    public 'foreign_table_name' -> string (5) "users"
    public 'foreign_column_name' -> string (2) "id"
)

and after

Tatter\Schemas\Structures\ForeignKey#170 (8) (
    public 'constraint_name' -> string (33) "auth_groups_users_user_id_foreign"
    public 'table_name' -> string (17) "auth_groups_users"
    public 'column_name' -> array (1) [
        0 => string (7) "user_id"
    ]
    public 'foreign_table_name' -> string (5) "users"
    public 'foreign_column_name' -> array (1) [
        0 => string (2) "id"
    ]
    public 'on_delete' -> string (7) "CASCADE"
    public 'on_update' -> string (8) "RESTRICT"
    public 'match' -> string (4) "NONE"
)

This issue is there because of

Foreign Key Data

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions