Adding indexes in descending order in Lead entity

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Prathyush Shetty
    Junior Member
    • Oct 2023
    • 22

    Adding indexes in descending order in Lead entity

    This is an sql query for adding an index in descending order in the lead table.
    HTML Code:
    create index UNIQ_CREATED_AT_ID_DESC on `lead` (created_at desc, id desc);
    How do I create the same index using lead's entityDefs?

    I tried like this, but no success.
    HTML Code:
    {
      "indexes": {
        "createdAtAndIdDesc": {
          "unique": true,
          "columns": ["createdAt","id"],
          "asc": false
        }
      }
    }​
    Also, does Espo delete the indexes that are created manually in the database when you rebuild the system?
  • yuri
    Member
    • Mar 2014
    • 8455

    #2
    Index order is not currently supported. Note that they usually do not bring a big performance improvement. Check with JSON schema to know what parameters are supported. Random parameters will almost always not work.

    All not defined indexes are deleted on rebuild.
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    • Prathyush Shetty
      Junior Member
      • Oct 2023
      • 22

      #3
      Thanks Yuri for responding. Can you please tell me where can I find this JSON schema to know what parameters are supported?

      Comment

      • yuri
        Member
        • Mar 2014
        • 8455

        #4
        If you use PHPStorm or VSCode and working on the cloned Espo repository or a repository cloned from the ext-template, the JSON schema should be automatically applied. When you editing metadata, it should autocomplete parameters and show docs for them.

        Schema is available in the schema directory https://github.com/espocrm/espocrm/tree/master/schema. Metadata docs is here: https://docs.espocrm.com/development/metadata/.
        If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

        Comment

        Working...