Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Поддержа полей с внешними ключами в качестве перичного ключа #125

Open
rybalchenkoserg opened this issue Apr 17, 2024 · 0 comments

Comments

@rybalchenkoserg
Copy link
Collaborator

rybalchenkoserg commented Apr 17, 2024

Например, если модели описаны такими дескрипторами, то первичный ключ в таблице Port для ports_address не будет создан:

host_desc.name = 'Host'
host_desc.kind = Host
host_desc.setChildren(
    [
        MAStringDescription(
            name='address', label='Ip Address', required=True, accessor=MAAttrAccessor('address'),
            sa_isPrimaryKey=True
        ),
        MAToManyRelationDescription(
            name='ports', label='Ports', required=True,
            accessor=MAAttrAccessor('ports'), classes=[Port],
            reference=port_desc
        ),
    ]
)

port_desc.name = 'Port'
port_desc.kind = Port
port_desc.setChildren(
    [
        MAToOneRelationDescription(
            name='ip4_addr', label='Host', required=True,
            accessor=MAAttrAccessor('ip4_addr'), classes=[Host],
            reference=host_desc, sa_isPrimaryKey=True
        ),
        MAIntDescription(
            name='port_num', label='Port number', required=True, accessor=MAAttrAccessor('port_num'),
            sa_isPrimaryKey=True
        )
    ]
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant