Answer the question
In order to leave comments, you need to log in
How to properly build a query in Yii2?
I have a query and I want to remake it in a query builder so that I don't send a direct query and I don't understand how to build it
CREATE UNIQUE INDEX tag_unique ON tags (entity_id, entity_type, alias_id)
WHERE deleted_at IS NULL;
Answer the question
In order to leave comments, you need to log in
A regular index can be created via:
(new Query()) // or Yii::$app->db (depends on your needs)
->createCommand()
->createIndex('tag_unique', 'tags', ['entity_id', 'entity_type', 'alias_id'], true)
->execute();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question