public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
    {
        $installer = $setup;
        $installer->startSetup();
        $connection = $installer->getConnection();

        /**
         * Create table 'faonni_catalog_product_index_sale'
         */
        if (!$installer->tableExists('faonni_catalog_product_index_sale')) {
			$table = $connection
				->newTable($installer->getTable('faonni_catalog_product_index_sale'))
				->addColumn(
					'entity_id',
					Table::TYPE_INTEGER,
					null,
					['unsigned' => true, 'nullable' => false, 'primary' => true],
					'Entity Id'
				)
				->addColumn(
					'website_id',
					Table::TYPE_SMALLINT,
					null,
					['unsigned' => true, 'nullable' => false, 'primary' => true],
					'Website ID'
				)				
				->addIndex(
					$installer->getIdxName('faonni_catalog_product_index_sale', ['website_id']),
					['website_id']
				)				
				->addForeignKey(
					$installer->getFkName('faonni_catalog_product_index_sale', 'website_id', 'store_website', 'website_id'),
					'website_id',
					$installer->getTable('store_website'),
					'website_id',
					Table::ACTION_CASCADE
				)
				->addForeignKey(
					$installer->getFkName('faonni_catalog_product_index_sale', 'entity_id', 'catalog_product_entity', 'entity_id'),
					'entity_id',
					$installer->getTable('catalog_product_entity'),
					'entity_id',
					Table::ACTION_CASCADE
				)
				->setComment('Catalog Product Sale Index Table');

			$connection->createTable($table);		
		} 

        $installer->endSetup();
    }
public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
    {
        $installer = $setup;
        $installer->startSetup();
        $connection = $installer->getConnection();

        /**
         * Create table 'faonni_catalog_product_index_sale'
         */
        if (!$installer->tableExists('faonni_catalog_product_index_sale')) {
			$table = $connection
				->newTable($installer->getTable('faonni_catalog_product_index_sale'))
				->addColumn(
					'entity_id',
					Table::TYPE_INTEGER,
					null,
					['unsigned' => true, 'nullable' => false, 'primary' => true],
					'Entity Id'
				)
				->addColumn(
					'website_id',
					Table::TYPE_SMALLINT,
					null,
					['unsigned' => true, 'nullable' => false, 'primary' => true],
					'Website ID'
				)				
				->addIndex(
					$installer->getIdxName('faonni_catalog_product_index_sale', ['website_id']),
					['website_id']
				)				
				->addForeignKey(
					$installer->getFkName('faonni_catalog_product_index_sale', 'website_id', 'store_website', 'website_id'),
					'website_id',
					$installer->getTable('store_website'),
					'website_id',
					Table::ACTION_CASCADE
				)
				->addForeignKey(
					$installer->getFkName('faonni_catalog_product_index_sale', 'entity_id', 'catalog_product_entity', 'entity_id'),
					'entity_id',
					$installer->getTable('catalog_product_entity'),
					'entity_id',
					Table::ACTION_CASCADE
				)
				->setComment('Catalog Product Sale Index Table');

			$connection->createTable($table);		
		} 

        $installer->endSetup();
    }
public function install ( SchemaSetupInterface $ setup , ModuleContextInterface $ context ) { $ installer = $ setup ; $ installer -> startSetup ( ) ; $ connection = $ installer -> getConnection ( ) ; /**
         * Create table 'faonni_catalog_product_index_sale'
         */ if ( ! $ installer -> tableExists ( 'faonni_catalog_product_index_sale' ) ) { $ table = $ connection -> newTable ( $ installer -> getTable ( 'faonni_catalog_product_index_sale' ) ) -> addColumn ( 'entity_id' , Table :: TYPE_INTEGER , null , [ 'unsigned' => true , 'nullable' => false , 'primary' => true ] , 'Entity Id' ) -> addColumn ( 'website_id' , Table :: TYPE_SMALLINT , null , [ 'unsigned' => true , 'nullable' => false , 'primary' => true ] , 'Website ID' ) -> addIndex ( $ installer -> getIdxName ( 'faonni_catalog_product_index_sale' , [ 'website_id' ] ) , [ 'website_id' ] ) -> addForeignKey ( $ installer -> getFkName ( 'faonni_catalog_product_index_sale' , 'website_id' , 'store_website' , 'website_id' ) , 'website_id' , $ installer -> getTable ( 'store_website' ) , 'website_id' , Table :: ACTION_CASCADE ) -> addForeignKey ( $ installer -> getFkName ( 'faonni_catalog_product_index_sale' , 'entity_id' , 'catalog_product_entity' , 'entity_id' ) , 'entity_id' , $ installer -> getTable ( 'catalog_product_entity' ) , 'entity_id' , Table :: ACTION_CASCADE ) -> setComment ( 'Catalog Product Sale Index Table' ) ; $ connection -> createTable ( $ table ) ; } $ installer -> endSetup ( ) ; }
Installs DB schema for a module Faonni_ProductSaleIndexer

@param SchemaSetupInterface $setup
@param ModuleContextInterface $context
@return void
Installs DB schema for a module Faonni_ProductSaleIndexer