0

is there any way to create 2 auto increment id in same table?When im trying to create using db_schema, error showing that only primary key id can get this auto increment.is there any other ways?

1

1 Answer 1

0

try below code

<table name="declarative_table">
        <column xsi:type="int" name="id_column1" padding="10" unsigned="true" nullable="false" comment="Entity Id"/>
        <column xsi:type="int" name="id_column2" padding="10" unsigned="true" nullable="false" comment="Entity Id"/>
        <column xsi:type="int" name="severity" padding="10" unsigned="true" nullable="false" comment="Severity code"/>
        <column xsi:type="varchar" name="title" nullable="false" length="255" comment="Title"/>
        <column xsi:type="timestamp" name="time_occurred"  comment="Time of event"/>
        <constraint xsi:type="primary" referenceId="PRIMARY">
            <column name="id_column1"/>
            <column name="id_column2"/>
        </constraint>
   </table>

it's working fine. check the screenshot

enter image description here

2
  • no,its not working for me.
    – mage
    Jun 24, 2021 at 16:12
  • update your schema code in question
    – Devidas
    Jun 25, 2021 at 5:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.