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

Allow to optionally build default keys using table aliases #116

Open
yhabteab opened this issue Sep 4, 2023 · 1 comment
Open

Allow to optionally build default keys using table aliases #116

yhabteab opened this issue Sep 4, 2023 · 1 comment
Labels
enhancement New feature or request TBD To be defined - We aren't certain about this yet

Comments

@yhabteab
Copy link
Member

yhabteab commented Sep 4, 2023

Currently the default keys are created based on the table names, we should also provide the ability to optionally specify whether to use the table alias (if any) instead.

@yhabteab yhabteab added enhancement New feature or request TBD To be defined - We aren't certain about this yet labels Sep 4, 2023
@nilmerg
Copy link
Member

nilmerg commented Sep 6, 2023

This deviates from our current design where we expect that if no explicit foreign key or candidate key is defined for a relation, the default is inferred from the the related table's name. (host.id -> host_id)

If we change this, so that the default is inferred from the alias instead, this will be broken for anyone who relies on that and wants to use the alias for the sole purpose of having nice relation paths in filters.

$tableName = 'prefix_actual_name';
$tableAlias = 'actual_name';

CREATE TABLE prefix_related_name (
  prefix_actual_name_id int,
  ..
);

At this time, I'd rather require from anyone who's schema uses mixed naming (prefix in the table name, but not in foreign keys or no prefix in the table name, but in foreign keys) should be required to be explicit when defining relations, as it is now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request TBD To be defined - We aren't certain about this yet
Projects
None yet
Development

No branches or pull requests

2 participants