| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- <?php
- /**
- * Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License").
- * You may not use this file except in compliance with the License.
- * A copy of the License is located at
- *
- * http://aws.amazon.com/apache2.0
- *
- * or in the "license" file accompanying this file. This file is distributed
- * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
- namespace Amazon\Login\Setup;
- use Amazon\Login\Model\ResourceModel\CustomerLink;
- use Magento\Framework\DB\Adapter\AdapterInterface;
- use Magento\Framework\DB\Ddl\Table;
- use Magento\Framework\Setup\InstallSchemaInterface;
- use Magento\Framework\Setup\ModuleContextInterface;
- use Magento\Framework\Setup\SchemaSetupInterface;
- class InstallSchema implements InstallSchemaInterface
- {
- /**
- * @SuppressWarnings(PHPMD.UnusedFormalParameter)
- */
- public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
- {
- $table = $setup->getConnection()->newTable($setup->getTable(CustomerLink::TABLE_NAME));
- $table
- ->addColumn(
- 'entity_id',
- Table::TYPE_INTEGER,
- null,
- [
- 'identity' => true,
- 'unsigned' => true,
- 'primary' => true,
- 'nullable' => false
- ]
- )
- ->addColumn(
- 'customer_id',
- Table::TYPE_INTEGER,
- null,
- [
- 'unsigned' => true,
- 'nullable' => false
- ]
- )
- ->addColumn(
- 'amazon_id',
- Table::TYPE_TEXT,
- 255,
- [
- 'nullable' => false
- ]
- )
- ->addIndex(
- $setup->getIdxName(
- CustomerLink::TABLE_NAME,
- ['customer_id', 'amazon_id'],
- AdapterInterface::INDEX_TYPE_UNIQUE
- ),
- ['customer_id', 'amazon_id'],
- ['type' => AdapterInterface::INDEX_TYPE_UNIQUE]
- );
- $setup->getConnection()->createTable($table);
- }
- }
|