Announcement

Collapse
No announcement yet.

Adding indexes in descending order in Lead entity

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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?

  • #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.

    Comment


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

      Comment


      • #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/.

        Comment

        Working...
        X