当前位置: 首页>>代码示例>>PHP>>正文


PHP SchemaSetupInterface::getFkName方法代码示例

本文整理汇总了PHP中Magento\Framework\Setup\SchemaSetupInterface::getFkName方法的典型用法代码示例。如果您正苦于以下问题:PHP SchemaSetupInterface::getFkName方法的具体用法?PHP SchemaSetupInterface::getFkName怎么用?PHP SchemaSetupInterface::getFkName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Framework\Setup\SchemaSetupInterface的用法示例。


在下文中一共展示了SchemaSetupInterface::getFkName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: install

 public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     $entityTypeModel = $this->_entityTypeModel;
     $catalogAttributeModel = $this->_catalogAttribute;
     $installer = $this->_eavSetup;
     $setup->startSetup();
     /**
      * Drop table if exists
      */
     $setup->getConnection()->dropTable($setup->getTable('ves_brand_group'));
     $setup->getConnection()->dropTable($setup->getTable('ves_brand'));
     $setup->getConnection()->dropTable($setup->getTable('ves_brand_store'));
     /**
      * Create table 'ves_brand_group'
      */
     $table = $setup->getConnection()->newTable($setup->getTable('ves_brand_group'))->addColumn('group_id', Table::TYPE_INTEGER, 11, ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], 'Group ID')->addColumn('name', Table::TYPE_TEXT, 255, ['nullable' => false], 'Group Name')->addColumn('url_key', Table::TYPE_TEXT, 255, ['nullable' => false], 'Group Url Key')->addColumn('position', Table::TYPE_INTEGER, null, ['nullable' => false, 'default' => '0'], 'Position')->addColumn('status', Table::TYPE_SMALLINT, null, ['nullable' => false, 'default' => '1'], 'Status')->addColumn('shown_in_sidebar', Table::TYPE_SMALLINT, null, ['nullable' => false, 'default' => '1'], 'Show In Sidebar')->setComment('Brand Group');
     $setup->getConnection()->createTable($table);
     /**
      * Create table 'ves_brand'
      */
     $table = $setup->getConnection()->newTable($setup->getTable('ves_brand'))->addColumn('brand_id', Table::TYPE_INTEGER, null, ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], 'Brand ID')->addColumn('name', Table::TYPE_TEXT, 255, ['nullable' => false], 'Brand Name')->addColumn('url_key', Table::TYPE_TEXT, 255, ['nullable' => false], 'Brand Url Key')->addColumn('description', Table::TYPE_TEXT, '64k', ['nullable' => false], 'Brand Description')->addColumn('group_id', Table::TYPE_INTEGER, 11, ['unsigned' => true, 'nullable' => false], 'Group ID')->addColumn('image', Table::TYPE_TEXT, 255, ['nullable' => false], 'Brand Image')->addColumn('thumbnail', Table::TYPE_TEXT, 255, ['nullable' => false], 'Brand Thumbnail')->addColumn('page_title', Table::TYPE_TEXT, 255, ['nullable' => false], 'Brand Page Title')->addColumn('meta_keywords', Table::TYPE_TEXT, '64k', ['nullable' => false], 'Meta Keywords')->addColumn('meta_description', Table::TYPE_TEXT, '64k', ['nullable' => false], 'Meta Description')->addColumn('creation_time', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, [], 'Brand Creation Time')->addColumn('update_time', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, [], 'Brand Modification Time')->addColumn('page_layout', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 255, ['nullable' => true], 'Page Layout')->addColumn('layout_update_xml', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, '64k', ['nullable' => true], 'Page Layout Update Content')->addColumn('status', Table::TYPE_SMALLINT, null, ['nullable' => false, 'default' => '1'], 'Status')->addColumn('position', Table::TYPE_INTEGER, null, ['nullable' => false, 'default' => '0'], 'Position')->addIndex($setup->getIdxName('ves_brand', ['group_id']), ['group_id'])->addForeignKey($setup->getFkName('ves_brand', 'group_id', 'ves_brand', 'group_id'), 'group_id', $setup->getTable('ves_brand_group'), 'group_id', Table::ACTION_CASCADE)->setComment('Brand Information');
     $setup->getConnection()->createTable($table);
     /**
      * Create table 'ves_brand_store'
      */
     $table = $setup->getConnection()->newTable($setup->getTable('ves_brand_store'))->addColumn('brand_id', Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false, 'primary' => true], 'Brand Id')->addColumn('store_id', Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false, 'primary' => true], 'Store Id')->addIndex($setup->getIdxName('ves_brand_store', ['store_id']), ['store_id'])->addForeignKey($setup->getFkName('ves_brand_store', 'brand_id', 'ves_brand', 'brand_id'), 'brand_id', $setup->getTable('ves_brand'), 'brand_id', Table::ACTION_CASCADE)->addForeignKey($setup->getFkName('ves_brand_store', 'store_id', 'store', 'store_id'), 'store_id', $setup->getTable('store'), 'store_id', Table::ACTION_CASCADE)->setComment('Brand Store');
     $setup->getConnection()->createTable($table);
     $installer->removeAttribute($entityTypeModel->loadByCode('catalog_product')->getData('entity_type_id'), 'product_brand');
     $data = array('group' => 'General', 'type' => 'varchar', 'input' => 'select', 'default' => 1, 'label' => 'Product Brand', 'backend' => 'Magento\\Eav\\Model\\Entity\\Attribute\\Backend\\ArrayBackend', 'frontend' => '', 'source' => 'Ves\\Brand\\Model\\Brandlist', 'visible' => 1, 'required' => 1, 'user_defined' => 1, 'used_for_price_rules' => 1, 'position' => 2, 'unique' => 0, 'default' => '', 'sort_order' => 100, 'is_global' => \Magento\Catalog\Model\ResourceModel\Eav\Attribute::SCOPE_STORE, 'is_required' => 0, 'is_configurable' => 1, 'is_searchable' => 0, 'is_visible_in_advanced_search' => 0, 'is_comparable' => 0, 'is_filterable' => 0, 'is_filterable_in_search' => 1, 'is_used_for_promo_rules' => 1, 'is_html_allowed_on_front' => 0, 'is_visible_on_front' => 1, 'used_in_product_listing' => 1, 'used_for_sort_by' => 0);
     $installer->addAttribute($entityTypeModel->loadByCode('catalog_product')->getData('entity_type_id'), 'product_brand', $data);
     $brandIds = $catalogAttributeModel->loadByCode('catalog_product', 'product_brand');
     $brandIds->addData($data)->save();
     $setup->endSetup();
 }
开发者ID:vasuscoin,项目名称:brand,代码行数:34,代码来源:InstallSchema.php

示例2: upgrade

 /**
  * {@inheritdoc}
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     $installer = $setup;
     $setup->startSetup();
     $version = $context->getVersion();
     $connection = $setup->getConnection();
     if (version_compare($version, '2.0.1') < 0) {
         foreach (['magefan_blog_post_relatedpost', 'magefan_blog_post_relatedproduct'] as $tableName) {
             // Get module table
             $tableName = $setup->getTable($tableName);
             // Check if the table already exists
             if ($connection->isTableExists($tableName) == true) {
                 $columns = ['position' => ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, 'nullable' => false, 'comment' => 'Position']];
                 foreach ($columns as $name => $definition) {
                     $connection->addColumn($tableName, $name, $definition);
                 }
             }
         }
         $connection->addColumn($setup->getTable('magefan_blog_post'), 'featured_img', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'length' => 255, 'nullable' => true, 'comment' => 'Thumbnail Image']);
     }
     if (version_compare($version, '2.2.0') < 0) {
         /* Add author field to posts tabel */
         $connection->addColumn($setup->getTable('magefan_blog_post'), 'author_id', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, 'nullable' => true, 'comment' => 'Author ID']);
         $connection->addIndex($setup->getTable('magefan_blog_post'), $setup->getIdxName($setup->getTable('magefan_blog_post'), ['author_id']), ['author_id']);
     }
     if (version_compare($version, '2.2.5') < 0) {
         /* Add layout field to posts and category tabels */
         foreach (['magefan_blog_post', 'magefan_blog_category'] as $table) {
             $table = $setup->getTable($table);
             $connection->addColumn($setup->getTable($table), 'page_layout', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'length' => 255, 'nullable' => true, 'comment' => 'Post Layout']);
             $connection->addColumn($setup->getTable($table), 'layout_update_xml', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'length' => '64k', 'nullable' => true, 'comment' => 'Post Layout Update Content']);
             $connection->addColumn($setup->getTable($table), 'custom_theme', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'length' => 100, 'nullable' => true, 'comment' => 'Post Custom Theme']);
             $connection->addColumn($setup->getTable($table), 'custom_layout', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'length' => 255, 'nullable' => true, 'comment' => 'Post Custom Template']);
             $connection->addColumn($setup->getTable($table), 'custom_layout_update_xml', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'length' => '64k', 'nullable' => true, 'comment' => 'Post Custom Layout Update Content']);
             $connection->addColumn($setup->getTable($table), 'custom_theme_from', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_DATE, 'nullable' => true, 'comment' => 'Post Custom Theme Active From Date']);
             $connection->addColumn($setup->getTable($table), 'custom_theme_to', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_DATE, 'nullable' => true, 'comment' => 'Post Custom Theme Active To Date']);
         }
     }
     if (version_compare($version, '2.3.0') < 0) {
         /* Add meta title field to posts tabel */
         $connection->addColumn($setup->getTable('magefan_blog_post'), 'meta_title', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'length' => 255, 'nullable' => true, 'comment' => 'Post Meta Title', 'after' => 'title']);
         /* Add og tags fields to post tabel */
         foreach (['type', 'img', 'description', 'title'] as $type) {
             $connection->addColumn($setup->getTable('magefan_blog_post'), 'og_' . $type, ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'length' => 255, 'nullable' => true, 'comment' => 'Post OG ' . ucfirst($type), 'after' => 'identifier']);
         }
         /* Add meta title field to category tabel */
         $connection->addColumn($setup->getTable('magefan_blog_category'), 'meta_title', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'length' => 255, 'nullable' => true, 'comment' => 'Category Meta Title', 'after' => 'title']);
         /**
          * Create table 'magefan_blog_tag'
          */
         $table = $setup->getConnection()->newTable($setup->getTable('magefan_blog_tag'))->addColumn('tag_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['identity' => true, 'nullable' => false, 'primary' => true], 'Tag ID')->addColumn('title', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 255, ['nullable' => true], 'Tag Title')->addColumn('identifier', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 100, ['nullable' => true, 'default' => null], 'Tag String Identifier')->addIndex($setup->getIdxName('magefan_blog_tag', ['identifier']), ['identifier'])->setComment('Magefan Blog Tag Table');
         $setup->getConnection()->createTable($table);
         /**
          * Create table 'magefan_blog_post_tag'
          */
         $table = $setup->getConnection()->newTable($setup->getTable('magefan_blog_post_tag'))->addColumn('post_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['nullable' => false, 'primary' => true], 'Post ID')->addColumn('tag_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['nullable' => false, 'primary' => true], 'Tag ID')->addIndex($setup->getIdxName('magefan_blog_post_tag', ['tag_id']), ['tag_id'])->addForeignKey($setup->getFkName('magefan_blog_post_tag', 'post_id', 'magefan_blog_post', 'post_id'), 'post_id', $setup->getTable('magefan_blog_post'), 'post_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->addForeignKey($setup->getFkName('magefan_blog_post_tag', 'tag_id', 'magefan_blog_tag', 'tag_id'), 'tag_id', $setup->getTable('magefan_blog_tag'), 'tag_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->setComment('Magefan Blog Post To Category Linkage Table');
         $setup->getConnection()->createTable($table);
     }
     $setup->endSetup();
 }
开发者ID:magefan,项目名称:module-blog,代码行数:64,代码来源:UpgradeSchema.php

示例3: install

 /**
  * @inheritdoc
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  * @throws \Zend_Db_Exception
  */
 public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     $table = $setup->startSetup()->getConnection()->newTable($setup->getTable(self::PAYMENT_TOKEN_TABLE))->addColumn(InstallSchema::ID_FILED_NAME, Table::TYPE_INTEGER, null, ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], 'Entity Id')->addColumn('customer_id', Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => true], 'Customer Id')->addColumn('public_hash', Table::TYPE_TEXT, 128, ['nullable' => false], 'Hash code for using on frontend')->addColumn('payment_method_code', Table::TYPE_TEXT, 128, ['nullable' => false], 'Payment method code')->addColumn('type', Table::TYPE_TEXT, 128, ['nullable' => false], 'Type')->addColumn('created_at', Table::TYPE_TIMESTAMP, null, ['nullable' => false, 'default' => Table::TIMESTAMP_INIT], 'Created At')->addColumn('expires_at', Table::TYPE_TIMESTAMP, null, ['nullable' => true], 'Expires At')->addColumn('gateway_token', Table::TYPE_TEXT, 255, ['nullable' => false], 'Gateway Token')->addColumn('details', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, '64k', ['nullable' => true], 'Details')->addColumn('is_active', Table::TYPE_BOOLEAN, null, ['nullable' => false, 'dafault' => true], 'Is active flag')->addColumn('is_visible', Table::TYPE_BOOLEAN, null, ['nullable' => false, 'dafault' => true], 'Is visible flag')->addIndex($setup->getIdxName('vault_payment_token_unique_index', ['payment_method_code', 'customer_id', 'gateway_token'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE), ['payment_method_code', 'customer_id', 'gateway_token'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE])->addIndex($setup->getIdxName('vault_payment_token_hash_unique_index', ['public_hash'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE), ['public_hash'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE])->addForeignKey($setup->getFkName($setup->getTable(self::PAYMENT_TOKEN_TABLE), 'customer_id', $setup->getTable('customer_entity'), 'entity_id'), 'customer_id', $setup->getTable('customer_entity'), 'entity_id', Table::ACTION_CASCADE)->setComment('Vault tokens of payment');
     $setup->getConnection()->createTable($table);
     $table = $setup->startSetup()->getConnection()->newTable($setup->getTable(self::ORDER_PAYMENT_TO_PAYMENT_TOKEN_TABLE))->addColumn('order_payment_id', Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false, 'primary' => true], 'Order payment Id')->addColumn('payment_token_id', Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false, 'primary' => true], 'Payment token Id')->addForeignKey($setup->getFkName($setup->getTable(self::ORDER_PAYMENT_TO_PAYMENT_TOKEN_TABLE), 'order_payment_id', $setup->getTable('sales_order_payment'), 'entity_id'), 'order_payment_id', $setup->getTable('sales_order_payment'), 'entity_id', Table::ACTION_CASCADE)->addForeignKey($setup->getFkName($setup->getTable(self::ORDER_PAYMENT_TO_PAYMENT_TOKEN_TABLE), 'payment_token_id', $setup->getTable(self::PAYMENT_TOKEN_TABLE), 'entity_id'), 'payment_token_id', $setup->getTable(self::PAYMENT_TOKEN_TABLE), 'entity_id', Table::ACTION_CASCADE)->setComment('Order payments to vault token');
     $setup->getConnection()->createTable($table);
     $setup->endSetup();
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:13,代码来源:InstallSchema.php

示例4: addForeignKeys

 /**
  *
  * @param SchemaSetupInterface $setup
  * @return void
  */
 protected function addForeignKeys(SchemaSetupInterface $setup)
 {
     /**
      * Add foreign keys again
      */
     $setup->getConnection()->addForeignKey($setup->getFkName(Media::GALLERY_VALUE_TABLE, 'value_id', Media::GALLERY_TABLE, 'value_id'), $setup->getTable(Media::GALLERY_VALUE_TABLE), 'value_id', $setup->getTable(Media::GALLERY_TABLE), 'value_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE);
     $setup->getConnection()->addForeignKey($setup->getFkName(Media::GALLERY_VALUE_TABLE, 'store_id', $setup->getTable('store'), 'store_id'), $setup->getTable(Media::GALLERY_VALUE_TABLE), 'store_id', $setup->getTable('store'), 'store_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:13,代码来源:UpgradeSchema.php

示例5: install

 /**
  * {@inheritdoc}
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     /**
      * Create table 'weee_tax'
      */
     $table = $setup->getConnection()->newTable($setup->getTable('weee_tax'))->addColumn('value_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['identity' => true, 'nullable' => false, 'primary' => true], 'Value Id')->addColumn('website_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false, 'default' => '0'], 'Website Id')->addColumn('entity_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false, 'default' => '0'], 'Entity Id')->addColumn('country', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 2, ['nullable' => true], 'Country')->addColumn('value', \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, '12,4', ['nullable' => false, 'default' => '0.0000'], 'Value')->addColumn('state', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['nullable' => false, 'default' => '0'], 'State')->addColumn('attribute_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false], 'Attribute Id')->addIndex($setup->getIdxName('weee_tax', ['website_id']), ['website_id'])->addIndex($setup->getIdxName('weee_tax', ['entity_id']), ['entity_id'])->addIndex($setup->getIdxName('weee_tax', ['country']), ['country'])->addIndex($setup->getIdxName('weee_tax', ['attribute_id']), ['attribute_id'])->addForeignKey($setup->getFkName('weee_tax', 'country', 'directory_country', 'country_id'), 'country', $setup->getTable('directory_country'), 'country_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->addForeignKey($setup->getFkName('weee_tax', 'entity_id', 'catalog_product_entity', 'entity_id'), 'entity_id', $setup->getTable('catalog_product_entity'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->addForeignKey($setup->getFkName('weee_tax', 'website_id', 'store_website', 'website_id'), 'website_id', $setup->getTable('store_website'), 'website_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->addForeignKey($setup->getFkName('weee_tax', 'attribute_id', 'eav_attribute', 'attribute_id'), 'attribute_id', $setup->getTable('eav_attribute'), 'attribute_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->setComment('Weee Tax');
     $setup->getConnection()->createTable($table);
     $setup->endSetup();
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:14,代码来源:InstallSchema.php

示例6: install

 /**
  * {@inheritdoc}
  */
 public function install(SchemaSetupInterface $setup, ModuleContextInterface $contextInterface)
 {
     $setup->startSetup();
     /**
      * Create table 'catalog_product_entity_media_gallery_value_video'
      */
     $table = $setup->getConnection()->newTable($setup->getTable(self::GALLERY_VALUE_VIDEO_TABLE))->addColumn('value_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false], 'Media Entity ID')->addColumn('store_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false, 'default' => '0'], 'Store ID')->addColumn('provider', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 32, ['nullable' => true, 'default' => null], 'Video provider ID')->addColumn('url', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, null, ['nullable' => true, 'default' => null], 'Video URL')->addColumn('title', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 255, ['nullable' => true, 'default' => null], 'Title')->addColumn('description', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, null, ['nullable' => true, 'default' => null], 'Page Meta Description')->addColumn('metadata', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, null, ['nullable' => true, 'default' => null], 'Video meta data')->addIndex($setup->getIdxName(self::GALLERY_VALUE_VIDEO_TABLE, ['value_id', 'store_id'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE), ['value_id', 'store_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE])->addForeignKey($setup->getFkName(self::GALLERY_VALUE_VIDEO_TABLE, 'value_id', Gallery::GALLERY_TABLE, 'value_id'), 'value_id', $setup->getTable(Gallery::GALLERY_TABLE), 'value_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->addForeignKey($setup->getFkName(self::GALLERY_VALUE_VIDEO_TABLE, 'store_id', $setup->getTable('store'), 'store_id'), 'store_id', $setup->getTable('store'), 'store_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->setComment('Catalog Product Video Table');
     $setup->getConnection()->createTable($table);
     $setup->endSetup();
 }
开发者ID:koliaGI,项目名称:magento2,代码行数:13,代码来源:InstallSchema.php

示例7: install

 /**
  * Installs DB schema for the module
  *
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  *
  * @param SchemaSetupInterface   $setup   The setup interface
  * @param ModuleContextInterface $context The module Context
  *
  * @return void
  */
 public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     /**
      * Create table 'smile_virtualcategory_catalog_category_product_position'
      */
     $tableName = 'smile_virtualcategory_catalog_category_product_position';
     $table = $setup->getConnection()->newTable($setup->getTable($tableName))->addColumn('category_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], 'Category ID')->addColumn('product_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], 'Product ID')->addColumn('position', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['nullable' => false, 'default' => '0'], 'Position')->addIndex($setup->getIdxName($tableName, ['product_id']), ['product_id'])->addForeignKey($setup->getFkName($tableName, 'category_id', 'catalog_category_entity', 'entity_id'), 'category_id', $setup->getTable('catalog_category_entity'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->addForeignKey($setup->getFkName($tableName, 'product_id', 'catalog_product_entity', 'entity_id'), 'product_id', $setup->getTable('catalog_product_entity'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->setComment('Catalog product position for the virtual categories module.');
     $setup->getConnection()->createTable($table);
     $setup->endSetup();
 }
开发者ID:smile-sa,项目名称:elasticsuite,代码行数:21,代码来源:InstallSchema.php

示例8: install

 /**
  * {@inheritdoc}
  */
 public function install(SchemaSetupInterface $setup, ModuleContextInterface $contextInterface)
 {
     $setup->startSetup();
     $swatchTable = $setup->getTable('eav_attribute_option_swatch');
     /** Creating the main_table 'eav_attribute_option_swatch' */
     $table = $setup->getConnection()->newTable($swatchTable)->addColumn('swatch_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], 'Swatch ID')->addColumn('option_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['identity' => false, 'unsigned' => true, 'nullable' => false, 'primary' => false], 'Option ID')->addColumn('store_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['identity' => false, 'unsigned' => true, 'nullable' => false, 'primary' => false], 'Store ID')->addColumn('type', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['identity' => false, 'unsigned' => true, 'nullable' => false, 'primary' => false], 'Swatch type: 0 - text, 1 - visual color, 2 - visual image')->addColumn('value', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 255, ['identity' => false, 'unsigned' => false, 'nullable' => true, 'primary' => false], 'Swatch Value')->addIndex($setup->getIdxName($swatchTable, ['swatch_id']), ['swatch_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX])->addIndex($setup->getIdxName($swatchTable, ['store_id', 'option_id'], true), ['store_id', 'option_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE])->addForeignKey($setup->getFkName($swatchTable, 'store_id', 'store', 'store_id'), 'store_id', $setup->getTable('store'), 'store_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->addForeignKey($setup->getFkName($swatchTable, 'option_id', 'eav_attribute_option', 'option_id'), 'option_id', $setup->getTable('eav_attribute_option'), 'option_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->setComment('Magento Swatches table');
     if (!$setup->getConnection()->tableColumnExists($setup->getTable('catalog_eav_attribute'), 'additional_data')) {
         $setup->getConnection()->addColumn($setup->getTable('catalog_eav_attribute'), 'additional_data', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'default' => null, 'nullable' => true, 'comment' => 'Additional swatch attributes data']);
     }
     $setup->getConnection()->createTable($table);
     $setup->endSetup();
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:15,代码来源:InstallSchema.php

示例9: addForeignKeys

 /**
  * Add foreign keys to entity table
  *
  * @return void
  */
 protected function addForeignKeys()
 {
     $foreignKeys = $this->setup->getConnection()->getForeignKeys(
         $this->setup->getTable($this->entityTable)
     );
     $foreignKeys = array_filter(
         $foreignKeys,
         function ($key) {
             return $key['COLUMN_NAME'] == $this->entityColumn;
         }
     );
     foreach ($foreignKeys as $foreignKeyInfo) {
         if (!count($this->getForeignKeys(
             $this->externalTable,
             $this->externalColumn,
             $this->setup->getTablePlaceholder($foreignKeyInfo['REF_TABLE_NAME']),
             $foreignKeyInfo['REF_COLUMN_NAME']
         ))) {
             $this->setup->getConnection()->addForeignKey(
                 $this->setup->getFkName(
                     $this->externalTable,
                     $this->externalColumn,
                     $this->setup->getTablePlaceholder($foreignKeyInfo['REF_TABLE_NAME']),
                     $foreignKeyInfo['REF_COLUMN_NAME']
                 ),
                 $this->setup->getTable($this->externalTable),
                 $this->externalColumn,
                 $foreignKeyInfo['REF_TABLE_NAME'],
                 $foreignKeyInfo['REF_COLUMN_NAME'],
                 $this->onDelete
             );
         }
     }
 }
开发者ID:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:39,代码来源:ExternalFKSetup.php

示例10: upgrade

 public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     $employeeEntityTable = \Foggyline\Office\Model\Employee::ENTITY . '_entity';
     $departmentEntityTable = 'foggyline_office_department';
     $setup->getConnection()->addForeignKey($setup->getFkName($employeeEntityTable, 'department_id', $departmentEntityTable, 'entity_id'), $setup->getTable($employeeEntityTable), 'department_id', $setup->getTable($departmentEntityTable), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE);
     $setup->endSetup();
 }
开发者ID:Galillei,项目名称:B05032-Foggyline_Office,代码行数:8,代码来源:UpgradeSchema.php

示例11: install

 /**
  * Installs DB schema for a module
  *
  * @param SchemaSetupInterface $setup
  * @param ModuleContextInterface $context
  * @return void
  *
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     $connection = $setup->getConnection();
     $setup->startSetup();
     $table = $connection->newTable($setup->getTable('ui_bookmark'))->addColumn('bookmark_id', Table::TYPE_INTEGER, null, ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], 'Bookmark identifier')->addColumn('user_id', Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false], 'User Id')->addColumn('namespace', Table::TYPE_TEXT, 255, ['nullable' => false], 'Bookmark namespace')->addColumn('identifier', Table::TYPE_TEXT, 255, ['nullable' => false], 'Bookmark Identifier')->addColumn('current', Table::TYPE_SMALLINT, 1, ['nullable' => false], 'Mark current bookmark per user and identifier')->addColumn('title', Table::TYPE_TEXT, 255, ['nullable' => true], 'Bookmark title')->addColumn('config', Table::TYPE_TEXT, Table::MAX_TEXT_SIZE, ['nullable' => true], 'Bookmark config')->addColumn('created_at', Table::TYPE_DATETIME, null, ['nullable' => false], 'Bookmark created at')->addColumn('updated_at', Table::TYPE_DATETIME, null, ['nullable' => false], 'Bookmark updated at')->addIndex($setup->getIdxName('ui_bookmark', ['user_id', 'namespace', 'identifier'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE), ['user_id', 'namespace', 'identifier'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)->addForeignKey($setup->getFkName('ui_bookmark', 'user_id', 'admin_user', 'user_id'), 'user_id', $setup->getTable('admin_user'), 'user_id', Table::ACTION_CASCADE)->setComment('Bookmark');
     $connection->createTable($table);
     $setup->endSetup();
 }
开发者ID:IlyaGluschenko,项目名称:test001,代码行数:17,代码来源:InstallSchema.php

示例12: install

 /**
  * {@inheritdoc}
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     /**
      * Create table 'tax_class'
      */
     $table = $setup->getConnection()->newTable($setup->getTable('tax_class'))->addColumn('class_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['identity' => true, 'nullable' => false, 'primary' => true], 'Class Id')->addColumn('class_name', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 255, ['nullable' => false], 'Class Name')->addColumn('class_type', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 8, ['nullable' => false, 'default' => 'CUSTOMER'], 'Class Type')->setComment('Tax Class');
     $setup->getConnection()->createTable($table);
     /**
      * Create table 'tax_calculation_rule'
      */
     $table = $setup->getConnection()->newTable($setup->getTable('tax_calculation_rule'))->addColumn('tax_calculation_rule_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['identity' => true, 'nullable' => false, 'primary' => true], 'Tax Calculation Rule Id')->addColumn('code', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 255, ['nullable' => false], 'Code')->addColumn('priority', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['nullable' => false], 'Priority')->addColumn('position', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['nullable' => false], 'Position')->addColumn('calculate_subtotal', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['nullable' => false], 'Calculate off subtotal option')->addIndex($setup->getIdxName('tax_calculation_rule', ['priority', 'position']), ['priority', 'position'])->addIndex($setup->getIdxName('tax_calculation_rule', ['code']), ['code'])->setComment('Tax Calculation Rule');
     $setup->getConnection()->createTable($table);
     /**
      * Create table 'tax_calculation_rate'
      */
     $table = $setup->getConnection()->newTable($setup->getTable('tax_calculation_rate'))->addColumn('tax_calculation_rate_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['identity' => true, 'nullable' => false, 'primary' => true], 'Tax Calculation Rate Id')->addColumn('tax_country_id', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 2, ['nullable' => false], 'Tax Country Id')->addColumn('tax_region_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['nullable' => false], 'Tax Region Id')->addColumn('tax_postcode', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 21, [], 'Tax Postcode')->addColumn('code', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 255, ['nullable' => false], 'Code')->addColumn('rate', \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, '12,4', ['nullable' => false], 'Rate')->addColumn('zip_is_range', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, [], 'Zip Is Range')->addColumn('zip_from', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['unsigned' => true], 'Zip From')->addColumn('zip_to', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['unsigned' => true], 'Zip To')->addIndex($setup->getIdxName('tax_calculation_rate', ['tax_country_id', 'tax_region_id', 'tax_postcode']), ['tax_country_id', 'tax_region_id', 'tax_postcode'])->addIndex($setup->getIdxName('tax_calculation_rate', ['code']), ['code'])->addIndex($setup->getIdxName('tax_calculation_rate', ['tax_calculation_rate_id', 'tax_country_id', 'tax_region_id', 'zip_is_range', 'tax_postcode']), ['tax_calculation_rate_id', 'tax_country_id', 'tax_region_id', 'zip_is_range', 'tax_postcode'])->setComment('Tax Calculation Rate');
     $setup->getConnection()->createTable($table);
     /**
      * Create table 'tax_calculation'
      */
     $table = $setup->getConnection()->newTable($setup->getTable('tax_calculation'))->addColumn('tax_calculation_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['identity' => true, 'nullable' => false, 'primary' => true], 'Tax Calculation Id')->addColumn('tax_calculation_rate_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['nullable' => false], 'Tax Calculation Rate Id')->addColumn('tax_calculation_rule_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['nullable' => false], 'Tax Calculation Rule Id')->addColumn('customer_tax_class_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['nullable' => false], 'Customer Tax Class Id')->addColumn('product_tax_class_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['nullable' => false], 'Product Tax Class Id')->addIndex($setup->getIdxName('tax_calculation', ['tax_calculation_rule_id']), ['tax_calculation_rule_id'])->addIndex($setup->getIdxName('tax_calculation', ['customer_tax_class_id']), ['customer_tax_class_id'])->addIndex($setup->getIdxName('tax_calculation', ['product_tax_class_id']), ['product_tax_class_id'])->addIndex($setup->getIdxName('tax_calculation', ['tax_calculation_rate_id', 'customer_tax_class_id', 'product_tax_class_id']), ['tax_calculation_rate_id', 'customer_tax_class_id', 'product_tax_class_id'])->addForeignKey($setup->getFkName('tax_calculation', 'product_tax_class_id', 'tax_class', 'class_id'), 'product_tax_class_id', $setup->getTable('tax_class'), 'class_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->addForeignKey($setup->getFkName('tax_calculation', 'customer_tax_class_id', 'tax_class', 'class_id'), 'customer_tax_class_id', $setup->getTable('tax_class'), 'class_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->addForeignKey($setup->getFkName('tax_calculation', 'tax_calculation_rate_id', 'tax_calculation_rate', 'tax_calculation_rate_id'), 'tax_calculation_rate_id', $setup->getTable('tax_calculation_rate'), 'tax_calculation_rate_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->addForeignKey($setup->getFkName('tax_calculation', 'tax_calculation_rule_id', 'tax_calculation_rule', 'tax_calculation_rule_id'), 'tax_calculation_rule_id', $setup->getTable('tax_calculation_rule'), 'tax_calculation_rule_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->setComment('Tax Calculation');
     $setup->getConnection()->createTable($table);
     /**
      * Create table 'tax_calculation_rate_title'
      */
     $table = $setup->getConnection()->newTable($setup->getTable('tax_calculation_rate_title'))->addColumn('tax_calculation_rate_title_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['identity' => true, 'nullable' => false, 'primary' => true], 'Tax Calculation Rate Title Id')->addColumn('tax_calculation_rate_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['nullable' => false], 'Tax Calculation Rate Id')->addColumn('store_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false], 'Store Id')->addColumn('value', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 255, ['nullable' => false], 'Value')->addIndex($setup->getIdxName('tax_calculation_rate_title', ['tax_calculation_rate_id', 'store_id']), ['tax_calculation_rate_id', 'store_id'])->addIndex($setup->getIdxName('tax_calculation_rate_title', ['store_id']), ['store_id'])->addForeignKey($setup->getFkName('tax_calculation_rate_title', 'store_id', 'store', 'store_id'), 'store_id', $setup->getTable('store'), 'store_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->addForeignKey($setup->getFkName('tax_calculation_rate_title', 'tax_calculation_rate_id', 'tax_calculation_rate', 'tax_calculation_rate_id'), 'tax_calculation_rate_id', $setup->getTable('tax_calculation_rate'), 'tax_calculation_rate_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->setComment('Tax Calculation Rate Title');
     $setup->getConnection()->createTable($table);
     /**
      * Create table 'tax_order_aggregated_created'
      */
     $table = $setup->getConnection()->newTable($setup->getTable('tax_order_aggregated_created'))->addColumn('id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], 'Id')->addColumn('period', \Magento\Framework\DB\Ddl\Table::TYPE_DATE, null, ['nullable' => true], 'Period')->addColumn('store_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true], 'Store Id')->addColumn('code', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 255, ['nullable' => false], 'Code')->addColumn('order_status', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 50, ['nullable' => false], 'Order Status')->addColumn('percent', \Magento\Framework\DB\Ddl\Table::TYPE_FLOAT, null, [], 'Percent')->addColumn('orders_count', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false, 'default' => '0'], 'Orders Count')->addColumn('tax_base_amount_sum', \Magento\Framework\DB\Ddl\Table::TYPE_FLOAT, null, [], 'Tax Base Amount Sum')->addIndex($setup->getIdxName('tax_order_aggregated_created', ['period', 'store_id', 'code', 'percent', 'order_status'], true), ['period', 'store_id', 'code', 'percent', 'order_status'], ['type' => 'unique'])->addIndex($setup->getIdxName('tax_order_aggregated_created', ['store_id']), ['store_id'])->addForeignKey($setup->getFkName('tax_order_aggregated_created', 'store_id', 'store', 'store_id'), 'store_id', $setup->getTable('store'), 'store_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->setComment('Tax Order Aggregation');
     $setup->getConnection()->createTable($table);
     /**
      * Create table 'tax_order_aggregated_updated'
      */
     $setup->getConnection()->createTable($setup->getConnection()->createTableByDdl($setup->getTable('tax_order_aggregated_created'), $setup->getTable('tax_order_aggregated_updated')));
     /**
      * Create table 'sales_order_tax_item'
      */
     $table = $setup->getConnection()->newTable($setup->getTable('sales_order_tax_item'))->addColumn('tax_item_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], 'Tax Item Id')->addColumn('tax_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false], 'Tax Id')->addColumn('item_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => true], 'Item Id')->addColumn('tax_percent', \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, '12,4', ['nullable' => false], 'Real Tax Percent For Item')->addColumn('amount', \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, '12,4', ['nullable' => false], 'Tax amount for the item and tax rate')->addColumn('base_amount', \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, '12,4', ['nullable' => false], 'Base tax amount for the item and tax rate')->addColumn('real_amount', \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, '12,4', ['nullable' => false], 'Real tax amount for the item and tax rate')->addColumn('real_base_amount', \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, '12,4', ['nullable' => false], 'Real base tax amount for the item and tax rate')->addColumn('associated_item_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['nullable' => true, 'unsigned' => true], 'Id of the associated item')->addColumn('taxable_item_type', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 32, ['nullable' => false], 'Type of the taxable item')->addIndex($setup->getIdxName('sales_order_tax_item', ['item_id']), ['item_id'])->addIndex($setup->getIdxName('sales_order_tax_item', ['tax_id', 'item_id'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE), ['tax_id', 'item_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE])->addForeignKey($setup->getFkName('sales_order_tax_item', 'associated_item_id', 'sales_order_item', 'item_id'), 'associated_item_id', $setup->getTable('sales_order_item'), 'item_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->addForeignKey($setup->getFkName('sales_order_tax_item', 'tax_id', 'sales_order_tax', 'tax_id'), 'tax_id', $setup->getTable('sales_order_tax'), 'tax_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->addForeignKey($setup->getFkName('sales_order_tax_item', 'item_id', 'sales_order_item', 'item_id'), 'item_id', $setup->getTable('sales_order_item'), 'item_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->setComment('Sales Order Tax Item');
     $setup->getConnection()->createTable($table);
     $setup->endSetup();
 }
开发者ID:opexsw,项目名称:magento2,代码行数:48,代码来源:InstallSchema.php

示例13: install

 public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     /**
      * Create table 'tudock_helloworld'
      */
     $table = $setup->getConnection()->newTable($setup->getTable('tudock_helloworld'))->addColumn('id', Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false, 'default' => '0', 'primary' => true], 'ID of text')->addColumn('product', Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false, 'default' => '0'], 'Product ID')->addColumn('text', Table::TYPE_TEXT, 255, ['unsigned' => true, 'nullable' => false, 'default' => '0'], 'Text')->setComment('HelloWorld demo table')->addIndex($setup->getIdxName('tudock_helloworld', 'id', \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE), 'id', ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE])->addIndex($setup->getIdxName('tudock_helloworld', 'product'), 'product')->addForeignKey($setup->getFkName('tudock_helloworld', 'product', 'catalog_product_entity', 'entity_id'), 'product', $setup->getTable('catalog_product_entity'), 'entity_id', Table::ACTION_CASCADE);
     $setup->getConnection()->createTable($table);
     $setup->endSetup();
 }
开发者ID:TUDOCK,项目名称:tudockblog-magento2-example,代码行数:10,代码来源:InstallSchema.php

示例14: install

 /**
  * {@inheritdoc}
  */
 public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     $connection = $setup->getConnection();
     /**
      * Create table 'vde_theme_change'
      */
     $table = $connection->newTable($setup->getTable('vde_theme_change'))->addColumn('change_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], 'Theme Change Identifier')->addColumn('theme_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['nullable' => false, 'unsigned' => true], 'Theme Id')->addColumn('change_time', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, ['nullable' => false], 'Change Time')->addForeignKey($setup->getFkName('vde_theme_change', 'theme_id', 'theme', 'theme_id'), 'theme_id', $setup->getTable('theme'), 'theme_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->setComment('Design Editor Theme Change');
     $connection->createTable($table);
     $setup->endSetup();
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:14,代码来源:InstallSchema.php

示例15: updateSchemaVersion200

 /**
  * @param SchemaSetupInterface $setup
  */
 public function updateSchemaVersion200(SchemaSetupInterface $setup)
 {
     /**
      * Create table 'adyen_order_payment'
      */
     $table = $setup->getConnection()->newTable($setup->getTable(self::ADYEN_ORDER_PAYMENT))->addColumn('entity_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], 'Adyen Payment ID')->addColumn('pspreference', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 255, ['unsigned' => true, 'nullable' => false], 'Pspreference')->addColumn('merchant_reference', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 255, ['unsigned' => true, 'nullable' => false], 'Merchant Reference')->addColumn('payment_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, 11, ['unsigned' => true, 'nullable' => false], 'Order Payment Id')->addColumn('payment_method', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 255, ['unsigned' => true, 'nullable' => true], 'Payment Method')->addColumn('amount', \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, '12,4', ['unsigned' => true, 'nullable' => false], 'Amount')->addColumn('total_refunded', \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, '12,4', ['unsigned' => true, 'nullable' => false], 'Total Refunded')->addColumn('created_at', Table::TYPE_DATETIME, null, ['nullable' => false], 'Created at')->addColumn('updated_at', Table::TYPE_DATETIME, null, ['nullable' => false], 'Updated at')->addIndex($setup->getIdxName(self::ADYEN_ORDER_PAYMENT, ['pspreference'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE), ['pspreference'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE])->addForeignKey($setup->getFkName(self::ADYEN_ORDER_PAYMENT, 'payment_id', 'sales_order_payment', 'entity_id'), 'payment_id', $setup->getTable('sales_order_payment'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->setComment('Adyen Order Payment');
     $setup->getConnection()->createTable($table);
     // add originalReference to notification table
     $connection = $setup->getConnection();
     $column = ['type' => Table::TYPE_TEXT, 'length' => 255, 'nullable' => true, 'comment' => 'Original Reference', 'after' => \Adyen\Payment\Model\Notification::PSPREFRENCE];
     $connection->addColumn($setup->getTable('adyen_notification'), \Adyen\Payment\Model\Notification::ORIGINAL_REFERENCE, $column);
 }
开发者ID:Adyen,项目名称:adyen-magento2,代码行数:15,代码来源:UpgradeSchema.php


注:本文中的Magento\Framework\Setup\SchemaSetupInterface::getFkName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。