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

Add Index on a query using JSON_GET or other methods #92

Open
alexander-schranz opened this issue Jul 27, 2023 · 0 comments
Open

Add Index on a query using JSON_GET or other methods #92

alexander-schranz opened this issue Jul 27, 2023 · 0 comments

Comments

@alexander-schranz
Copy link

alexander-schranz commented Jul 27, 2023

More a question. I want to add a index on a specific JSON query I know its possible via PostgreSQL the query looks like this:

$queryBuilder->leftJoin(
    Contact::class,
    'contact',
    Join::WITH,
    'CAST(JSON_GET(JSON_GET(visit.data, \'code\'), \'contactId\') AS INT) = contact.id',
)

It is a third party entity and I wanted to use Events::loadClassMetadata to add a index but the following:

$builder = new ClassMetadataBuilder($metadata);
$builder->addIndex(['CAST(JSON_GET(JSON_GET(visit.data, \'code\'), \'contactId\') AS INT)'], 'data_code_contactId_idx');

because it is not a column maybe somebody achieved something like this, without that the ORM is throwing the index away on the next migration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant