I know the syntax to create table via ‘InstallSchema’ in magento2 but don’t know how to add UNIQUE Constraint on two columns of my table. here is the syntax of my table – $ table_mediatype = $ setup->getConnection()->newTable($ setup->getTable(‘mediatype’)); $ table_mediatype->addColumn( ‘id’, \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, array(‘identity’ => true,’nullable’ => false,’primary’ => true), ‘Entity ID’ ); $Read more