How to create unique index in two columns

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • l1king
    Junior Member
    • Jun 2015
    • 6

    How to create unique index in two columns

    Hi. Same title.

    I tried two cases:
    1. "indexes": {
    "type": "index", // maybe different values???
    "index_name": {
    "columns": ["column_1", "column_2"]
    }
    }
    2."column_1": {
    ...
    "unique": "1_same_value_2"
    },
    "column_2": {
    ...
    "unique": "1_same_value_2"
    },

    Case 1: index type : Normal
    Case 2: Three unique indexes are created:
    - column_1
    - column_2
    - column_1, column_2
    --> seems there was an error???

    Can you help me?
  • yuri
    Member
    • Mar 2014
    • 8467

    #2
    application/Espo/Modules/Crm/Resources/metadata/entityDefs/Account.json

    no under_score, use camelCase
    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

    • l1king
      Junior Member
      • Jun 2015
      • 6

      #3
      Hi. I saw that using under_score and camelCase are the same results (but I will use camelCase in future)
      However, I want to ask is how to create unique index in two columns.

      Ex: in mysql, indexes in table account is
      IDX_ACCOUNT_ASSIGNED_USER assigned_user_id, deleted Normal

      --> I want index type of (assigned_user_id, deleted) is UNIQUE

      How to do it?


      Comment

      • yuri
        Member
        • Mar 2014
        • 8467

        #4
        Try

        "unique" => true
        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

        • l1king
          Junior Member
          • Jun 2015
          • 6

          #5
          It's not right. My solution is create unique index manual by install script.
          Thank you

          Comment

          Working...